Repository navigation
[CI] review-pr: watch for review requests starved of a hosted runner - #7638
Conversation
When GitHub-hosted runners starve, a review request sits at run-level queued with no job started: no gate, no review, no watchdog, no report, no mail. Every guard that could speak lives inside the very run that cannot start, so the silence is structural -- the rollout watched runs sit queued 30+ min with nothing to show for it. review-bot-gate-watch.yml is the one watcher outside the runs it watches: a */15 cron poll that fails its own job to page (a failed scheduled run notifies the workflow author; zero write permissions, no bot token anywhere in the file). gate_watch.py pages a request only while its age is inside [30, 45) min -- one poll wide, so exactly once per stuck request with no state to keep. A late or skipped poll can miss a window entirely; that is the silence that exists today, and it beats paging about the same stuck request every fifteen minutes. The thresholds are constants, not env: the window must stay one poll wide, and check_prompts.py now asserts the cron interval equals WINDOW_MINUTES, alongside the owner-fallback row that keeps gate_watch's handle in step with _notify.py. gate_watch_test.py drives the shipping script against a fake API and a fixed clock: 8 cases (quiet when merely queueing, pages once per stuck request not per poll, quiet about already-paged runs, override owner, loud when the queue cannot be read, stuck request found under a 120-run backlog) and 6 mutants that each turn a named case red. selftest 115 green / 0 red, check_prompts 0 drift. Co-Authored-By: Claude Code <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
When GitHub-hosted runners starve, a review request sits at run-level queued with no job started: no gate, no review, no watchdog, no report, no mail. Every guard that could speak lives inside the very run that cannot start, so the silence is structural -- the rollout watched runs sit queued 30+ min with nothing to show for it. review-bot-gate-watch.yml is the one watcher outside the runs it watches: a */15 cron poll that fails its own job to page (a failed scheduled run notifies the workflow author; zero write permissions, no bot token anywhere in the file). gate_watch.py pages a request only while its age is inside [30, 45) min -- one poll wide, so exactly once per stuck request with no state to keep. A late or skipped poll can miss a window entirely; that is the silence that exists today, and it beats paging about the same stuck request every fifteen minutes. The thresholds are constants, not env: the window must stay one poll wide, and check_prompts.py now asserts the cron interval equals WINDOW_MINUTES, alongside the owner-fallback row that keeps gate_watch's handle in step with _notify.py. gate_watch_test.py drives the shipping script against a fake API and a fixed clock: 8 cases (quiet when merely queueing, pages once per stuck request not per poll, quiet about already-paged runs, override owner, loud when the queue cannot be read, stuck request found under a 120-run backlog) and 6 mutants that each turn a named case red. selftest 115 green / 0 red, check_prompts 0 drift. Co-authored-by: zufayu <[email protected]> Co-authored-by: Claude Code <[email protected]>
What this changes
The last uncovered silence from the rollout: when GitHub-hosted runners starve, a review request sits at run-level
queuedwith no job started — no gate, no review, no watchdog, no report, no mail. Every guard that could speak lives inside the very run that cannot start, so the in-run watchdog structurally cannot cover it. This adds the one watcher outside the runs it watches:review-bot-gate-watch.yml— a*/15cron on hosted runners that runsgate_watch.pyand pages by failing its own job: a failed scheduled run notifies the workflow author. Zero write permissions (actions: read+contents: read), no bot token, and no PR association needed — a run-level queued run's PR is not readable from the run anyway.gate_watch.py— listsstatus=queuedruns ofaiter-review-bot.yml(paginated; under a burst the run stuck longest is on the last page) and pages for requests aged 30–45 min.Why a 30–45 min window
Exactly once per stuck request, with no state to keep: the cron fires every 15 min and a request pages only while its age is inside
[30, 45)— one poll wide. A run already paged by an earlier poll is out of the window and stays quiet. A late or skipped poll can miss a window entirely; that is the silence that exists today, and under-paging beats paging about the same stuck request every fifteen minutes.STUCK_MINUTES/WINDOW_MINUTESare constants, not env: the window must stay one poll wide, and an env override could drift from the cron with no guard seeing it.check_prompts.pyasserts the cron interval equalsWINDOW_MINUTES, and carriesgate_watch.pyin the owner-fallback check so its@handlestays in step with_notify.py'senvclass.The mechanism
gate_watch_test.py— 8 cases + 6 mutants against a fake API and a fixed clock (16 green): quiet when merely queueing, pages once per stuck request not once per poll, quiet about already-paged runs, override owner, fails loudly when the queue cannot be read, finds the stuck request under a 120-run backlog.selftest.sh— new[gate watch]section; the no-git-checkout case now copies the whole review-bot workflow family (its*review-bot.ymlglob predated a second workflow being read).review-bot-selftest.yml— watches the new workflow file too, since a guard now asserts across it.selftest 115 green / 0 red, check_prompts 0 drift, ruff F,E9 clean, actionlint clean on the new workflow.
🤖 Generated with Claude Code