ops: escalate a workflow that has failed on consecutive runs - #10147
Merged
Conversation
selfhost.yml is push-to-main only. It caught migration 0209's SQLite-only AUTOINCREMENT (#10138) correctly on the very first push -- the real-Postgres "applies every migration" test failed exactly as designed -- and then stayed red across five consecutive runs while PRs kept merging. The breakage was found by deploying the resulting image and watching the Orb crash-loop. Nothing was wrong with the test. A post-merge failure blocks nothing and pages no one, so a red run is indistinguishable from one somebody is already on. #9951 solved this exact class for the publish workflows, whose own comment says why it went unnoticed: the only signal was a ::warning:: nobody reads and a red check that looks like release noise. It landed as ~30 lines of inline bash. Needing it in a second place is the point at which it belongs in one place, so the mechanism moves to scripts/escalate-workflow-outage.ts and mcp-release-please.yml now calls that instead of carrying its own copy. Consecutive failures only, threshold 3: a deterministic failure fails identically every time, so one red run is a flake and alerting on it is how an alert gets muted. One open tracking issue is reused rather than a new one filed per commit, for the same reason. The escalation never fails its caller -- that workflow has already failed, and a second red over "could not read the run history" is noise on top of the real problem. leadingNonSuccessCount is unit-tested on the case that is easy to get exactly backwards: a window with no success anywhere. indexOf returns -1 there, and -1 as a count reports "no failures" for a workflow that has never once succeeded -- the precise shape #9951 found and the shape selfhost.yml was in. Cancelled, timed_out and null count as non-successes so a cancelled run cannot silently reset the streak. Behaviour change for the existing caller: the tracking issue title is now workflow-generic rather than publish-specific. No open issue used the old title, so no reuse is broken. Closes #10146
Contributor
|
Important 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏳ LoopOver is waiting…LoopOver has seen this pull request and is waiting on CI checks to finish before reviewing it. This comment will update once the review runs. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟨 Waiting |
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10147 +/- ##
=======================================
Coverage 91.99% 91.99%
=======================================
Files 931 931
Lines 114009 114009
Branches 27524 27524
=======================================
Hits 104886 104886
Misses 7823 7823
Partials 1300 1300
Flags with carried forward coverage won't be shown. Click here to find out more. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10146
selfhost.ymlcaught migration 0209's SQLite-onlyAUTOINCREMENT(#10138) correctly, on the very first push — the real-Postgres "applies every migration" test failed exactly as designed. It then stayed red across five consecutive runs while PRs kept merging, and the breakage was ultimately found by deploying the resulting image and watching the Orb crash-loop.Nothing was wrong with the test. The gap is that
selfhost.ymlis push-to-main only, so its failure blocks nothing and pages no one — a red run is indistinguishable from one somebody is already handling.Second instance of a solved class
#9951 hit exactly this with the publish workflows (MCP and miner failing on every main commit for as far back as the run history went, from a one-line missing build step). Its own comment says why it went unnoticed:
That fix landed as ~30 lines of inline bash inside
mcp-release-please.yml. Needing the same thing in a second workflow is the point at which it stops being one workflow's business — so this moves it toscripts/escalate-workflow-outage.ts, andmcp-release-please.ymlnow calls that instead of carrying its own copy. One implementation, not two that drift.Behaviour
selfhost.ymlgets anescalate-persistent-failurejob gated onfailure()— neveralways(), a success must file nothing — withissues: write, the one permissionbuild-bootdeliberately lacks.The arithmetic, and why it is unit-tested
leadingNonSuccessCounthas one case that is easy to get exactly backwards: a window with no success anywhere.indexOf("success")returns-1, and-1treated as a count reports "no failures" for a workflow that has never once succeeded in its recorded history — precisely the shape #9951 found and the shapeselfhost.ymlwas in for five runs. Returningruns.lengththere is what makes the worst state escalate instead of reading as healthy.Also pinned:
cancelled/timed_out/nullcount as non-successes, so a cancelled run cannot silently reset the streak and suppress the alert; and a success at the head reports 0 however bad the history behind it, so a fixed workflow stops alerting immediately.Verification
typecheck,dead-exports,dead-source-files,checkers-wired,actionlintall clean.Behaviour change worth flagging
The tracking issue title becomes workflow-generic (
workflow outage: X has failed on consecutive runs) rather than publish-specific. I checked before changing it: no open issue currently uses the old title, so no reuse is broken.What this does not do
It does not make
selfhost.ymlpre-merge. That was a deliberate cost decision (#9951-era, ~100 runs/week at ~5 min) and CI runtime is still the binding constraint. This makes the post-merge signal actionable rather than moving the check — the pre-merge counterpart for the specific dialect class is the 11ms invariant added in #10143.