Repository navigation
review-pr: a queued run past its gate is the box's queue, not a starved one - #7642
Merged
Merged
Conversation
…ed one Caught live, 12 minutes after the gate watch merged: a request past its gate -- gate completed, review waiting for the single box -- reads `queued` at run level too. The first real queue after the merge left one such run one slow review away from crossing 30 min inside the page window: a false page about a healthy, busy box. The gate job's state is the discriminator, same as queue_gate.py's: past its gate, the request is the box's queue and the in-run watchdog's to watch; short of it, nothing in the run can ever start. gate_watch.py now reads each in-window run's jobs and stays quiet about the ones whose gate completed. The new case went red on the live bug before the fix and green after; a new mutant breaks the discriminator and turns it red again. selftest 140 green / 0 red, check_prompts 0 drift. Co-Authored-By: Claude Code <[email protected]>
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
junhaha666
approved these changes
Nov 9, 2026
ruanjm
pushed a commit
that referenced
this pull request
Nov 10, 2026
…ed one (#7642) Caught live, 12 minutes after the gate watch merged: a request past its gate -- gate completed, review waiting for the single box -- reads `queued` at run level too. The first real queue after the merge left one such run one slow review away from crossing 30 min inside the page window: a false page about a healthy, busy box. The gate job's state is the discriminator, same as queue_gate.py's: past its gate, the request is the box's queue and the in-run watchdog's to watch; short of it, nothing in the run can ever start. gate_watch.py now reads each in-window run's jobs and stays quiet about the ones whose gate completed. The new case went red on the live bug before the fix and green after; a new mutant breaks the discriminator and turns it red again. selftest 140 green / 0 red, check_prompts 0 drift. Co-authored-by: zufayu <[email protected]> Co-authored-by: Claude Code <[email protected]>
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.
What this changes
Caught live, 12 minutes after #7638 merged: a request past its gate — gate completed, review waiting for the single box — reads
queuedat run level too. The gate watch's premise ("run-levelqueued= the gate job never started") was wrong, and the first real queue after the merge put one such run one slow review away from a false page about a healthy, busy box.The fix is the same discriminator
queue_gate.pyalready uses: the gate job's state.gatejob completed) → the request is the box's queue and the in-run watchdog's to watch — stay quietgatestill queued) → nothing in the run can ever start — pageHow it was caught
Verification of #7638 with a real queue: two review requests fired 3 min apart. The second's gate notice confirmed #7615's measured ETA ("queued behind 1; expect to start in about 27 min" — the old constant said 50). But the run-level API showed that same request — gate completed, review queued for the box — as
status=queued, sitting in the exact list gate_watch pages from.Also confirmed live: the bot's own comments trigger runs that wait on the workflow's concurrency group at
status=pending, which thestatus=queuedfilter does not return — that half of the design held.The mechanism
gate_watch.py— for each in-window queued run, read its jobs; skip runs whosegatejob completed. The jobs read joins the runs read inside the same try, so an API failure still fails loudly.gate_watch_test.py— new case ("stays quiet about a request past its gate and waiting for the box") went red on the live bug before the fix and green after; a new mutant breaks the discriminator and turns it red again. The fake grew a/jobsendpoint.selftest 140 green / 0 red, check_prompts 0 drift, ruff F,E9 clean.
PR Self-Review
Reviewed revision
d27971d
Behavior and intent
The gate watch (#7638) pages when a review request sits at run-level
queuedfor 30-45 min, on the premise that run-levelqueuedmeans the gate job never started. That premise is wrong: a request past its gate -- gate job completed, review queued for the single self-hosted box -- also readsqueuedat run level. The first real queue after that merge produced exactly that, and the watcher paged about a healthy, busy box (2026-11-09T06:34Z, one spurious mail). This PR adds the discriminatorqueue_gate.pyalready uses: the gate job's state. Past its gate, the request is the box's queue and the in-run watchdog's to watch -- stay quiet; short of it, nothing in the run can ever start -- page.Validation and unverified scope
TDD: the new case "stays quiet about a request past its gate and waiting for the box" went red on the live bug before the fix and green after; a new mutant breaks the discriminator and turns it red again.
python3 .claude/skills/review-pr/gate_watch_test.py-- 18 green / 0 red;bash .claude/skills/review-pr/selftest.sh-- 140 green / 0 red;python3 .claude/skills/review-pr/check_prompts.py-- 0 drift; ruff F,E9 clean; CI selftest passed. Live evidence: the 06:34Z false page named run 42570670181, whose gate job was completed/success -- the exact shape the fixed code now skips. Unverified: a real hosted-runner starvation event cannot be produced on demand; its coverage stays with the existing "pages when a request has sat queued past the threshold" case (queued run, no completed gate job, still pages).PR-specific question
The most important boundary: the discriminator must not silence real starvation. A starved run has no jobs at all, or its gate job still queued -- both still page; the mutant test proves the check is load-bearing, and the original page case passes unchanged. The second boundary: the jobs read joins the runs read inside the same try, so an API failure mid-read still fails loudly ("fails loudly when the queue cannot be read") rather than passing for a healthy watcher.
Changed op tests
None -- no
op_tests/file changed; the only test changed isgate_watch_test.py, the watcher's own suite.🤖 Generated with Claude Code