Skip to content

review-pr: a queued run past its gate is the box's queue, not a starved one - #7642

Merged
zufayu merged 1 commit into
ROCm:mainfrom
zufayu:fix/gate-watch-box-waiting
Nov 9, 2026
Merged

zufayu merged 1 commit into
ROCm:mainfrom
zufayu:fix/gate-watch-box-waiting

Conversation

@zufayu

@zufayu zufayu commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Caught live, 12 minutes after #7638 merged: a request past its gate — gate completed, review waiting for the single box — reads queued at run level too. The gate watch's premise ("run-level queued = 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.py already uses: the gate job's state.

  • past its gate (gate job completed) → the request is the box's queue and the in-run watchdog's to watch — stay quiet
  • short of its gate (no jobs, or gate still queued) → nothing in the run can ever start — page

How 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 the status=queued filter 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 whose gate job 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 /jobs endpoint.

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 queued for 30-45 min, on the premise that run-level queued means 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 reads queued at 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 discriminator queue_gate.py already 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 is gate_watch_test.py, the watcher's own suite.

🤖 Generated with Claude Code

…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]>
@zufayu
zufayu requested a review from a team November 9, 2026 06:31
@aiter-bot

aiter-bot commented Nov 9, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision d27971d51fa8 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

The gate watch (#7638) pages when a review request sits at run-level `queued` for 30-45 min, on the premise that run-level `queued` means 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 reads `queued` at 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 discriminator `queue_gate.py` already 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 is `gate_watch_test.py`, the watcher's own suite.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@zufayu
zufayu requested a review from junhaha666 November 9, 2026 07:00
@ROCm ROCm deleted a comment from github-actions Bot Nov 9, 2026
@zufayu
zufayu merged commit a0bae86 into ROCm:main Nov 9, 2026
@zufayu
zufayu deleted the fix/gate-watch-box-waiting branch November 9, 2026 08:31
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants