fix(alerts): clear ci_failed once its changeset settles #502
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
gmackie/ForgeGraph!502
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/settled-changeset-alerts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes the loop the changeset reconciler opened.
A
ci_failedalert is keyedci_failed:<changesetId>. When the changeset merges or closes, the alert is describing a branch that no longer exists — but nothing retires it. The only code that resolves these keys isPOST /api/fg/monitoring/evaluate, and nothing calls that endpoint: its only references are its own tests. Its own comment records the result — "that is how 222 ci_failed alerts accumulated on the live instance, 118 of them for changesets already merged or closed."#489/#490 made this sharper: they retired 372 changesets (698 → 326 active), and every one of those is a candidate for an alert with nothing left to clear it. The reconcile would have traded a stale changeset for a stale alert.
Resolving them is a narrow question — is this alert's changeset still active — so this answers exactly that on each poll, beside the reconciler that creates the condition, rather than running the whole evaluation on the agent hot path.
Deliberately conservative: it only ever resolves, never fires, and only for changesets that have left
draft/open/changes_requested/approved. Checked against the live instance, 8 of the 11 firingci_failedalerts are on branches genuinely 2–8 commits ahead of main with genuinely red CI — those must keep alerting, and this leaves them alone. The other 3 point at deleted branches and clear once the reconciler reaches them.Bounded at 50 per pass so a backlog drains over polls. 5 tests;
turbo run typecheckclean.🤖 Generated with Claude Code
Preview environment is live: https://pr-502-forgegraph.forgegraf.com
Deployed
f9cdc51dwith the beta stage's environment. It redeploys on every push and is destroyed when this PR closes.