Repository navigation
Conversation
Architecture-Review: unchanged; queue admission and landing verification are unchanged while queue I/O now shares the existing wait deadline. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the deadline applies to observations and leaves the merge request timeout in place. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the resolution preserves both branches’ CLI tests. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; existing wait semantics now bound queue observations while retaining current merge verification and transport behavior. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; synchronous merge verification and cleanup retain their existing contract, with the deadline scoped to queue observation. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the branch preserves main transport behavior and only scopes queue observations. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on eb3ec183c5e2b111220f4a50ebf5bcfa4d961a69, 111.0s: approve (0 critical, 0 important, 4 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| sha = merged_sha(repo, number, expected_head=head_sha) | ||
| if sha: | ||
| # A synchronous merge already in flight still needs verification and cleanup. | ||
| if strategy != "queue" and (sha := merged_sha(repo, number, expected_head=head_sha)): |
There was a problem hiding this comment.
suggestion: A direct merge whose first verification read lags past the deadline now exits 3 with a merge-queue message
For squash/merge/rebase, only the first merged_sha read runs outside the read budget. The confirmation that follows it does run inside bounded_reads(admit_by): merge_pending and then the "queue may have landed" re-read in _verify_merge_request. Suppose the synchronous gh pr merge write (300s, unbounded) finishes after the --wait deadline and GitHub's first read still shows the PR as open. The next bounded read then raises ReadDeadline. _merge_and_follow turns that into None, so cmd_merge prints "timed out waiting for the merge queue to land PR #N" and returns 3. Cleanup is skipped even on a repo with no merge queue, and the PR may already be merged. Before this change, the re-read would have verified the merge and cleaned up. The task says a direct merge already in flight keeps its own verification, and this edge partly breaks that. Smallest fix: open the observation budget only when the strategy is queue, or when merge_pending reports the PR as queued. Then the whole non-queue verification sequence stays outside the deadline, as before.
| return None | ||
|
|
||
|
|
||
| def _queue_wait( |
There was a problem hiding this comment.
suggestion: _queue_wait duplicates the bounded-scope and timeout-notice logic of _wait_with_deadline
_queue_wait repeats the pattern from _wait_with_deadline (cli.py:1411-1426) almost line for line. Both open bounded_reads(deadline, token=None, retry=True), track reported_timeout, catch ReadDeadline and print a timeout notice only when the inner wait hasn't already reported one. _queue_wait adds two things: it re-checks the deadline when the poll raises an error, and it keeps a SHA that was verified before the scope check on exit. Because the two copies now differ, they can drift apart. For example, the source-check wait does not convert errors that arrive after the deadline into a timeout, but the queue wait does. Consider having _wait_with_deadline call _queue_wait (or one shared helper), so that both waits get the same rules for late responses.
| """Merge SHA if landed; a closed-unmerged read is held as not final (GitHub lags a | ||
| queue merge) and re-raised by the caller only if it persists to the deadline.""" | ||
| """Merge SHA if landed; a closed-unmerged read is held as not final.""" | ||
| github.read_timeout(0) |
There was a problem hiding this comment.
suggestion: Redundant pre-read deadline checks in _landed
_landed calls github.read_timeout(0) both before and after merged_sha. The call before the read is redundant: merged_sha goes through _gh, which already calls read_timeout(timeout, scoped=read_only) before it starts the subprocess, and that raises ReadDeadline at expiry. Only the check after the read is needed to reject a late response. Removing the first call keeps _landed minimal. The same applies to the explicit check after the read in _verify_merge_request when the next statement is already a bounded read.
| if delay is None: | ||
| raise MergifyError("Mergify queue lookup returned no valid JSON") from exc | ||
| _retry_sleep(delay) | ||
| _retry_sleep(github.read_timeout(delay)) |
There was a problem hiding this comment.
suggestion: Mergify retry sleeps to the deadline, while the GitHub retry path fails fast
_retry_sleep(github.read_timeout(delay)) sleeps out the rest of the budget when it is shorter than the backoff, and the next _open then raises ReadDeadline. GitHub's _retry_pause does something different: it skips the retry when delay >= read_timeout(limit). Both end in a local timeout, so the result is correct. The behaviours differ, though, and the test locks in sleeps == [1.0]. If you want consistency, reuse the GitHub rule here: when the delay would reach the deadline, skip the sleep and raise ReadDeadline immediately.
Architecture-Review: unchanged; both observers keep the existing queue admission, receipt, retry and verification contracts. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; resumed queue observations use the same absolute wait deadline. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; a deadline prevents additional observation without changing admission. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; explicit zero wait still observes once. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; Retry-After and the existing request alarm retain their contracts within the wait budget. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; native queue checks retain exact-head recovery within the observation budget. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the local admission lock is released before deadline-bound queue observation. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on 9ffa612c811ea7c7bf17d0c37d5e4ff04c70cc60, 43.3s: approve (0 critical, 0 important, 3 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| confirmed = (deadline is not None and pr.base_ref == config.base_branch | ||
| and mergify.membership(config.repo, pr.number, queue) is not None) | ||
| and mergify.membership(config.repo, pr.number, queue, deadline if bounded else None) is not None) | ||
| except github.ReadDeadline: |
There was a problem hiding this comment.
suggestion: Redundant ReadDeadline handler duplicates the one now in cmd_merge
This delta adds except (_AdmissionDeadline, github.ReadDeadline) to cmd_merge (line 1851). That handler prints the same timed out waiting for Mergify to land PR #N and returns 3. _follow_blocked_mergify also catches github.ReadDeadline, prints the same text and returns None, and cmd_merge then turns that None into exit 3 when --wait is set. The two handlers give the same result, so the message and exit path now live in two places that can drift apart. Smallest fix: delete the except github.ReadDeadline branch in _follow_blocked_mergify and let the exception reach cmd_merge. The new regression test would then call through cmd_merge, or assert with pytest.raises(github.ReadDeadline) that no poll follows.
| except _AdmissionDeadline: | ||
| print(f"timed out before requesting Mergify for PR #{pr.number}") | ||
| except (_AdmissionDeadline, github.ReadDeadline) as exc: | ||
| action = "before requesting Mergify for" if isinstance(exc, _AdmissionDeadline) else "waiting for Mergify to land" |
There was a problem hiding this comment.
suggestion: A ReadDeadline before any Mergify request is reported as 'waiting for Mergify to land'
In _merge_with_mergify, mergify.membership(..., admit_by) at line 1781 runs before mergify.request. If the budget expires during that lookup, the new cmd_merge handler prints timed out waiting for Mergify to land PR #N, even though nothing was requested and the PR may not be in the queue. The admission-path timeout should say timed out before requesting Mergify for PR #N, as _AdmissionDeadline does. Smallest fix: in _merge_with_mergify, convert a ReadDeadline raised inside the pre-request block into _AdmissionDeadline when requested and confirmed are both false, or pick the message from whether a request or confirmation marker exists.
| sha = None | ||
| else: | ||
| closed.clear() | ||
| github.read_timeout(0) |
There was a problem hiding this comment.
suggestion: _landed can discard a verified landing SHA when the read finishes at the deadline
This delta removes the read-budget check before the read in _landed, leaving only github.read_timeout(0) after merged_sha. That check raises ReadDeadline even when merged_sha has just returned a verified SHA. If the landing read finishes as the budget expires, _wait_for_merge and _wait_for_mergify suppress the ReadDeadline. The command then reports a timeout and exits 3 without cleanup, even though the PR landed. This conflicts with the acceptance criterion 'preserve verified landings'. The behaviour predates this delta, but the function was edited here. Smallest fix: return early when a SHA is found (if sha: return sha) before calling github.read_timeout(0), so the post-read check only applies to non-landed observations.
Architecture-Review: unchanged; required CI validation and shared read deadlines both remain in effect. Co-Authored-By: Codex <noreply@openai.com>
Keep merge queue polling inside the wait budget
Context and goal
Closes #1155
Acceptance
Notes
Supersedes Keep merge queue polling inside the wait budget #1214, Keep merge queue polling inside the wait budget #1269 and Keep merge queue polling inside the wait budget #1769. Carries the approved diff from
cd4bf5ff0e2bplus the merge resolution in the CLI tests.Keep the existing admission rules and read endpoints. A direct merge already in flight retains its own verification and cleanup. Bound polling with the deadline already used for source checks. Preserve timeout diagnostics that can be rendered using observations already received.
Pre-fix: GitHub accepted the fake late response and started with a 120-second read timeout. Mergify raised HTTP 503 after its normal retries. The focused merge and queue regression suite passed after the fixes.
Base
main @ 6c58d64
Validation
Recorded for
9ffa612c811euv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 0Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review