You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(observability): forward ops-alerts anomalies to Sentry, add a review-burst rule (#3766)
Two changes to the hourly ops-alerts anomaly scan:
1. Fix a Sentry-visibility gap found while investigating the CI-stuck
repeat-review incident: every existing anomaly (gate false-positive
spike, slop score inverting, recommendations not panning out) was
logged via console.warn with an `ev` field. forwardStructuredLogToSentry
only wraps console.log/console.error and keys the issue off a field
literally named `event` -- so none of these anomalies has EVER reached
Sentry, regardless of whether Sentry is active. They only ever reached
Workers Logs, which nobody was watching -- part of why the CI-stuck
bleed went unnoticed for 20+ hours. Switched to console.error + an
`event` field, matching the convention already used by
selfhost_ai_provider_failed / regate_repair_exhausted /
ci_stuck_review_repeat_suppressed.
2. Add a 4th anomaly rule: "review burst" -- flags a PR that published
more than 6 review surfaces within a 2-hour rolling window, the exact
signature of a stuck-CI finalize loop or sweep retry storm. Backed by
a new findHottestReviewTargetForRepo query over the existing
audit_events ledger (github_app.pr_public_surface_published is a
genuine INSERT-only event per publish pass, unlike ai_review_cache or
review_audit's gate_decision rows, which are both upserted at a fixed
head SHA and so cannot see a same-head repeat). This runs on the
existing hourly ops-alerts cron, so a future recurrence of this class
of bleed surfaces within an hour instead of requiring a human to
notice and query the database directly.
`review burst: ${snapshot.reviewBurst.targetKey} published ${snapshot.reviewBurst.count} review surfaces in the last ${REVIEW_BURST_WINDOW_HOURS}h — likely a stuck-CI finalize loop or retry storm, not normal iteration. Investigate why this PR keeps re-triggering a fresh review.`,
120
+
);
121
+
}
122
+
96
123
returnout;
97
124
}
98
125
@@ -127,25 +154,28 @@ async function opsScanRepos(env: Env): Promise<string[]> {
expect(awaitcountRecentAuditEventsForActorAndTarget(env,"chatty","github_app.review_nag_ping","owner/repo#1","2026-06-24T13:00:00.000Z")).toBe(0);// none after the cutoff → count(*) returns 0
557
558
});
558
559
560
+
it("findHottestReviewTargetForRepo returns the PR with the most published surfaces in the window, scoped to ONE repo (#orb-ci-stuck-repeat)",async()=>{
0 commit comments