ReviewGate: a previous round's pass timer escalates the current round, because attempt resets to 0 each round and timers are never cancelled - #1997
Merged
ryanrborn merged 4 commits intoSep 23, 2026
Conversation
…n't escalate a later round (bd-28u8v4)
attempt resets to 0 at the start of every revise round (bd-bgeo6i), so
round N's implementer and round N+1's implementer are both launched as
the same attempt number. The timer armed for round N's pass was never
cancelled and was matched on attempt alone, so it could fire mid-flight
through round N+1's pass at the same attempt and escalate it as timed
out — even though that pass was still well within its own fresh
budget. round never repeats within a gate's lifetime, so tagging the
timer (and matching handle_info) on {round, attempt} instead makes
timer identity unique for as long as the gate runs.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… reviewer (bd-28u8v4) Round 1's reviewer timer collision with round 2's reviewer (both attempt 1, since attempt resets per round) went through a separate :reviewing / timeout_retries_left handler that the earlier implementer-collision test never exercised. Add a sibling fixture and test covering that path. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…-28u8v4) No behavior change. `mix format` on the test file's Path.expand indentation, and re-anchor 7 docs/review-coverage-and-guard-policy.md citations that review_gate.ex line-number edits from this branch staled (reviewer_commit_check, empty_diff_guard, escalate_pre_review, escalate_timeout, maybe_reprompt, escalate_no_changes, stamp_reviewed_head). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…e-previous-round-s-pass-timer
ryanrborn
deleted the
bugfix/1963-reviewgate-previous-round-s-pass-timer
branch
September 23, 2026 15:58
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.
Summary
ReviewGate's per-pass timeout (
Process.send_after(self(), {:timeout, attempt}, timeout_ms)) tagged its timer only withattempt.attemptresets to 0 at the start of every revise round (bd-bgeo6i, so reprompt budgets start fresh), so round N's implementer and round N+1's implementer are both launched as the sameattemptnumber (typically 2). The timer armed for round N's pass was never cancelled, so it could fire mid-flight through round N+1's pass at the same attempt number and get accepted as belonging to it — escalating a revising pass as timed out well before it had used its own fulltimeout_msbudget. This repeatedly killed live vstim revisions mid-edit.Fixed by tagging the timer (and matching
handle_infoclauses) with{round, attempt}instead ofattemptalone.roundnever repeats within a gate's lifetime, so the pair is unique for as long as the gate runs — no timer ref bookkeeping orProcess.cancel_timer/1needed. Per-round reprompt-budget reset (bd-bgeo6i) is untouched.Test plan
review_gate_test.exs(revise-and-rediscuss loopdescribe block): a round-1 implementer sleeps for most of its per-pass timeout before committing; a round-2 implementer (sameattemptnumber) is still running when round-1's stale timer would fire. Reproduces the bug onmain(fails with "revising pass timed out ... round 2"), passes with the fix. New fixtures:review_reject_twice.sh,revise_slow_then_fast.sh.mix test test/arbiter/worker/review_gate_test.exsplus every otherreview_gate_*_test.exsfile (235 tests, 0 failures).mix precommit— fullarbiterapp suite (1677 tests, 0 failures; the sandbox-connection-killed / Exqlite teardown noise is a documented baseline flake, not caused by this change). Onearbiter_clifailure (ReleaseDeployTest"active workspace resolves") is caused by this worker session's ownARB_*environment variables, not by this diff — confirmed by re-running with those vars unset (38/38 pass).References
bd-28u8v4
Closes #1963