Repository navigation
ci: stuck-run watchdog (report always, cancel only superseded runs); timeout-minutes on every non-release job - #1276
Merged
Merged
Conversation
This was referenced Oct 5, 2026
bpalermo
marked this pull request as ready for review
October 5, 2026 20:04
publish.yaml, proxy-release.yml and pages.yaml serialise with cancel-in-progress: false, and GitHub keeps one pending run per group, so a run whose job never gets a runner blocks the group silently. On 2026-10-05 a publish run (b1dc1c0) sat queued for five hours and a pages run queued since 2026-10-02 blocked the website for three days. .github/workflows/stuck-runs.yaml (every 30 min + workflow_dispatch, dry run by default on dispatch) runs scripts/stuck-runs.sh: a run pending/waiting/ requested, or with a job queued, for more than 60 minutes is reported on one rolling issue (commented only when the stuck set changes, closed when clear), and cancelled only when it is superseded: push/pull_request, first attempt, same repository, and its branch is gone or its commit is not the branch head AND a newer run of the same workflow on that branch is queued, running or succeeded. The head's own run is never cancelled. Job permissions: contents read, actions write, issues write. //scripts:stuck_runs_test pins the decisions on canned API JSON (10 fixtures, including the 10-05 publish incident) and drives `run` through a fake gh: --dry-run writes nothing, a real run cancels exactly the superseded run. jq for it comes from jq.bzl (already in the module graph), made visible as a direct bazel_dep. Also: timeout-minutes on every job that lacked one outside the release workflows (ci.yaml x14, main.yaml x3, pages.yaml x2, proxy.yml x4, quay-smoke.yaml, e2e.yaml report-failure), sized from the last 100 runs. publish.yaml and proxy-release.yml still lack them and are left untouched. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
A new workflow can only be dispatched once GitHub has registered it, which for a file that exists only on a branch means after it has run there. The pull_request trigger (paths: the workflow and its script) is also the self- test: a change runs the watchdog against the live run list, always as a dry run. Concurrency is per ref so a pull request never cancels main's tick. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
force-pushed
the
upgrade/ci-stuck-run-watchdog
branch
from
October 5, 2026 22:05
e0ac885 to
a7904d9
Compare
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.
Stack 1/3 (#1276 → #1278 → #1279).
Problem (confirmed)
publish.yaml(grouppublish-main),proxy-release.yml(proxy-release-main) andpages.yaml(pages) usecancel-in-progress: false. GitHub keeps at most one pending run per group. So when one run's job never gets a runner, it blocks every later run of that workflow, and nothing flags it.Today's evidence (
gh run list):b1dc1c04) was created at 14:11 and only ended,cancelled, at 19:19. In between, seven newer publishes were each replaced ascancelled(14:27 → 17:38). Onlydf3a1136published, at 19:29.cancelled. 37344777943 waited 2.5 h before itsbuildjob started at 19:28.proxypull_requestrun, has beenqueuedsince 2026-09-12 with zero jobs. Its branchchore/proxy-image-bump-733802bno longer exists.degraded_performance("Incident with Actions", opened 19:11Z). This PR's own runs sat queued for a while because of it.Watchdog
.github/workflows/stuck-runs.yamlrunsscripts/stuck-runs.sh.Triggers.
7,37 * * * *: acts.workflow_dispatch: a dry run unlessdry_run=false;threshold_minutesis an input.pull_requesttouching the watchdog or its script: always a dry run, against the live run list. This trigger is also what lets GitHub register the workflow so it can be dispatched from a branch.Stuck, using a 60-minute threshold (publish and proxy-release take about 10 minutes):
pending/waiting/requestedfor longer than the threshold, measured fromrun_started_at; orqueued/in_progressand has a job sittingqueuedfor longer than the threshold, measured from the job's creation. A run that waited its turn behind another one and then got a runner quickly is therefore not stuck. This was the pages run's situation at 19:35.queuedwith no jobs at all.Reported: every stuck run, on one rolling issue, CI: workflow runs stuck before they started:
Each tick also writes a
::warning::and a job summary.Cancelled only if superseded. All of these must hold:
push/pull_request;The newer-run condition is not in the brief. I added it after the dry run against live data:
pagesis path-filtered, andmainhad moved past28b2680awith no newer pages run coming, so cancelling that run would have dropped the deploy. The watchdog never cancels the head's own run, a re-run, a schedule or dispatch run, a fork run, or a run whose head lookup failed. Those are reported only, with the manual remedy in the runbook.Permissions:
contents: readat the workflow level. The job addsactions: write(list and cancel runs) andissues: write.What it would do right now (local
collect+decideagainst the live API, 19:46Z):I have not cancelled it. That is yours to decide, or the first scheduled tick after merge will do it.
Test:
//scripts:stuck_runs_test, hermetic and inbazel test //....runend to end through a fakegh:--dry-runwrites nothing;--dry-runact, each turn the test red.jq for the test comes from
jq.bzl0.6.0. It was already in the module graph viaaspect_rules_lint; here it becomes a directbazel_depplususe_repo(jq_toolchains).MODULE.bazel.lockis unchanged.timeout-minutes
A timeout does not rescue a queued job, which is why the watchdog exists. It does stop a hung running job.
Jobs that had no timeout (values sized from the slowest successful run among the last 100 of each workflow):
ci.yamlmain.yamlpages.yamlproxy.ymlquay-smoke.yamle2e.yamlStill without a timeout, left untouched as instructed:
publish.yamlpublish, andproxy-release.ymlbuild-push,manifest,signandbump-chart.Proof
bazel test //scripts:stuck_runs_test //e2e:kind_pin_test //website:site_test: pass.bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //scripts:all: clean.make format-check: clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr