feat(review): same-rule repeat alarm — detection + alert, no autonomous action - #8092
Conversation
…us action Closes #7983. The existing self-correction system only detects a systematically- wrong rule via precision-over-time (auto-tune.ts), which needs a real, DECIDED sample (>= AUTOTUNE_MIN_DECIDED) accumulated over however long that takes -- too slow for a bug that can mis-close 4 PRs within hours, as the 2026-07-21/22 metagraphed incident did. A much cheaper, ground-truth-free signal already exists: the SAME deterministic rule/blocker code rejecting several DIFFERENT PRs in a short window in the same repo is itself a strong "something's broken" signal, independent of whether any of those rejections is ever confirmed or reversed by a human. New packages/loopover-engine/src/calibration/signal-tracking.ts: evaluateRuleRepeatAlarm(ruleId, fired, threshold) — pure, no ground truth needed, mirrors src/orb/analytics.ts's gamingPatternFlags precedent ("Detection only — never an automatic action"). New src/review/rule-repeat-alarm-wire.ts wires this into ORB for real: every gate block now records a #7982 rule-fired signal per blocker code (nothing called the ORB adapter until now), scoped per-(repo, code) so an unrelated repo or code never contributes to another's count, and checks the repeat alarm inline, immediately after each block — not on a later cron tick, matching the "hours, not days" urgency the incident exposed. A triggered alarm logs a structured console.error (forwarded to Sentry, the same "detected an anomaly" channel src/review/ops-wire.ts's own runOpsAlerts already uses) and writes a cooldown marker so an ongoing incident doesn't re-alert on every subsequent PR. Note on the issue's own cited alert channel: notify-discord.ts/ notify-slack turned out to be the wrong fit on inspection — that's a per-REPO, community-facing channel for PR action notifications, not an operator-facing "an ORB rule may be systematically broken" signal that can span any repo the instance reviews. Sentry (via the existing structured-log forwarder) is the channel actually already used for this class of alert. Validated against a replay of the exact #7469/#7589/#7591/#7594 incident shape: triggers on the 3rd distinct PR, matching the issue's own "should have alerted after the 2nd or 3rd occurrence" bar.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
loopover-ui | 1aa5b63 | Commit Preview URL Branch Preview URL |
Jul 22 2026, 09:40 PM |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8092 +/- ##
==========================================
- Coverage 91.99% 91.98% -0.02%
==========================================
Files 752 753 +1
Lines 76979 77010 +31
Branches 23315 23321 +6
==========================================
+ Hits 70820 70839 +19
- Misses 5053 5061 +8
- Partials 1106 1110 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-22 21:53:52 UTC
Review summary Nits — 5 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Closes #7983.
Summary
auto-tune.ts), which needs a real, DECIDED sample (>= AUTOTUNE_MIN_DECIDED) accumulated over however long that takes — too slow for a bug that can mis-close 4 PRs within hours, as the 2026-07-21/22 metagraphed incident did. A much cheaper, ground-truth-free signal already exists: the SAME deterministic rule/blocker code rejecting several DIFFERENT PRs in a short window in the same repo is itself a strong "something's broken" signal, independent of whether any of those rejections is ever confirmed or reversed by a human.packages/loopover-engine/src/calibration/signal-tracking.ts:evaluateRuleRepeatAlarm(ruleId, fired, threshold)— pure, no ground truth needed, mirrorssrc/orb/analytics.ts'sgamingPatternFlagsprecedent ("Detection only — never an automatic action").src/review/rule-repeat-alarm-wire.tswires this into ORB for real: every gate block now records a Extract a shared, deployment-agnostic calibration/signal-tracking module for ORB + AMS #7982 rule-fired signal per blocker code (nothing called the ORB adapter until now — Extract a shared, deployment-agnostic calibration/signal-tracking module for ORB + AMS #7982 only wired AMS), scoped per-(repo, code)so an unrelated repo or code never contributes to another's count, and checks the repeat alarm inline, immediately after each block — not on a later cron tick, matching the "hours, not days" urgency the incident exposed. A triggered alarm logs a structuredconsole.error(forwarded to Sentry, the same "detected an anomaly" channelsrc/review/ops-wire.ts's ownrunOpsAlertsalready uses) and writes a cooldown marker so an ongoing incident doesn't re-alert on every subsequent PR.notify-discord.ts/notify-slackturned out to be the wrong fit on inspection — that's a per-REPO, community-facing channel for PR action notifications, not an operator-facing "an ORB rule may be systematically broken" signal that can span any repo the instance reviews. Sentry (via the existing structured-log forwarder,forwardStructuredLogToSentry) is the channel actually already used for this class of alert;alerts.ts'srunAnomalyAlerts(the other candidate) turned out to be dead code referencing anotification_deliveriesschema shape that no longer matches the live table.Test plan
npm run typecheck,packages/loopover-engine's ownnpm test(613/613, including 7 newevaluateRuleRepeatAlarmcases)test/unit/rule-repeat-alarm-wire.test.ts(12 cases, 100% line/branch/function coverage): incident replay, per-repo scoping, per-code scoping, alert cooldown, duplicate-code dedup within one call, multiple independent codes, store-failure resilience, alert-marker write failure resiliencenpm run test:coverage: 1092/1092 files, 20387 tests, 0 failuresnpm run engine-parity:drift-check: clean, no version bump needed