Repository navigation
Conversation
…rktree lock Architecture-Review: unchanged; admission still uses the existing marker and lock and queue waiting starts after the lock is released. Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
…request-replacement
Architecture-Review: unchanged; a new queue request still checks the integrated size before admission. Co-Authored-By: Codex <noreply@openai.com>
…request-replacement
There was a problem hiding this comment.
loopzero primary review by codex on d04f563cad9750aa1b933784eda3e0db34742db4, 53.8s: request_changes (0 critical, 2 important, 1 suggestion)
Same-family fallback: independent reviewers failed: claude: not authenticated. Cross-family review is preferred.
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model gpt-6.2-astra (effort medium); CLI-reported model gpt-6.2-astra (effort medium); configured model gpt-6.2-astra (effort medium)
Raw reviewer output
Native Codex transcript retained in the restricted local review receipt; public evidence is publisher-derived, not backend attestation. Exact raw SHA256: a7ed64a39b21c60cebc3ad106c3edb1e919c87e9532bdf783cae323d5e01ca19
|
|
||
|
|
||
| @pytest.mark.parametrize("accepted", [True, False]) | ||
| def test_overlapping_mergify_command_after_lost_reply(wt, gh, monkeypatch, accepted): |
There was a problem hiding this comment.
important: Both line budgets block queue admission
Running scripts/size_budget.sh bb2aae139ad0dd62c9465558aceab5c0a23fbb2e exited 1. Source is 8,254 lines against an 8,250 cap, and tests are 13,890 against a 13,850 cap. The prequeue check runs this gate before posting the request. Trim at least four source lines and forty test lines while preserving coverage of both accepted and rejected writes.
| github._api(f"repos/{repo}/issues/{number}/comments", {"body": body}) | ||
| try: | ||
| github._api(f"repos/{repo}/issues/{number}/comments", {"body": body}) | ||
| except (github.GhError, github.ProcTimeout, OSError): |
There was a problem hiding this comment.
important: Stop after a rate-limited POST
A rate-limited comment POST raises GhUnavailable, which this GhError handler catches. It immediately calls markers(), issuing a GraphQL viewer request and potentially paginating REST comments during the required backoff. A failed read can also hide the POST’s reset or Retry-After guidance. Propagate explicit rate-limit rejections directly and reserve marker reconciliation for failures where the write may have succeeded.
| monkeypatch.setattr(github, "_api", transport) | ||
| with ThreadPoolExecutor(max_workers=2) as pool: | ||
| first = pool.submit(cli.main, ["merge"]) | ||
| assert writing.wait(10), "first merge did not reach the command POST" |
There was a problem hiding this comment.
suggestion: Exercise lock release during queue polling
Both invocations use merge without --wait, so the test would still pass if a later change moved _wait_for_mergify inside the lock. Have one invocation enter a paused queue waiter and verify that the other completes admission before polling resumes.
Architecture-Review: unchanged; only ambiguous request failures read the existing queue markers. Co-Authored-By: Codex <noreply@openai.com>
…request-r51 # Conflicts: # src/loopzero/cli.py # tests/test_mergify.py
…request-r51 # Conflicts: # tests/test_cli.py
There was a problem hiding this comment.
loopzero delta review by claude on 93d5730f8c77b9a4cc2169576f274d504f4c8a81, 62.9s: request_changes (0 critical, 1 important, 2 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.
| github._api(f"repos/{repo}/issues/{number}/comments", {"body": body}) | ||
| try: | ||
| github._api(f"repos/{repo}/issues/{number}/comments", {"body": body}) | ||
| except github.GhUnavailable: |
There was a problem hiding this comment.
important: Catching all of GhUnavailable skips the lost-reply check for 5xx, timeouts and resets, not just rate limits
GhUnavailable is broader than rate limiting. github._api raises it whenever rate_limited or _transient_error(...) is true (github.py:411, 428). That covers HTTP 5xx, "timed out", "connection reset", "unexpected end of JSON input" and "error connecting to api.github.com" (TRANSIENT_RE, github.py:125). Those are exactly the lost-reply failures where GitHub may already have created the queue comment. Before this change, request() re-read the markers and treated an accepted comment as success. Now it re-raises right away, so a 502 or a reset after an accepted POST makes loopzero merge fail even though the request is live. The only reason given for the change was keeping the rate-limit guidance.
The tests don't catch this. test_overlapping_mergify_command_after_lost_reply simulates the lost reply with ProcTimeout, which takes the old path. The new mergify test only covers HTTP 429.
Smallest fix: skip reconciliation only when the error is a rate limit. Alternatively, always reconcile and, if reading the markers fails, re-raise the original error (except ...: raise exc from None) so the guidance is kept. Add a test where a 5xx or connection-reset GhUnavailable comes after an accepted POST.
| return sha | ||
| raise closed[0] | ||
| if not confirmed and not requested: | ||
| _prequeue_size_budget(wt, config, pr, readiness, project=admit_by is None) |
There was a problem hiding this comment.
suggestion: Size-budget clone, fetch and script now run while holding the worktree lock
The lock now wraps _prequeue_size_budget (shared clone, fetch from origin, the budget script, and _warn_queue_size fetching predecessor PR refs). It also wraps mergify.membership(..., deadline), which can wait on Retry-After. Any other command that needs lock_local_state (a second merge, check publication, PR-body updates) waits at most 60s (worktree.py:116). After that it fails with TimeoutError: task state is busy instead of sharing the request. Consider running the size budget before taking the lock and re-reading the markers and membership under the lock just before request(). That keeps the lock covering only the check-then-write.
| @@ -3879,6 +3879,49 @@ def test_mergify_merge_requests_once_for_behind_head( | |||
| else: | |||
| assert "queue configuration is unverified" in err | |||
|
|
|||
There was a problem hiding this comment.
suggestion: Conflict resolution left wrong blank-line spacing
Only one blank line separates test_mergify_merge_requests_once_for_behind_head from the next decorated test (line 3881). Three blank lines follow test_overlapping_mergify_command_after_lost_reply (lines 3923-3925). These are PEP 8 E302/E303 violations left by the merge. Normalize both to two blank lines.
Architecture-Review: unchanged; the GitHub transport distinguishes confirmed rate limits before the existing queue reconciliation. Co-Authored-By: Codex <noreply@openai.com>
|
Independent Claude review of the fix-only delta from This is the prior fix review record. It is an unregistered approval and does not change this PR's review-round state. The replacement will receive its own registered primary review. |
Serialize Mergify queue requests in a task worktree
Context and goal
Closes #1327
Supersedes #1428 after resolving the conflict with main's queue budget check. Both review rounds were already used on #1428.
Acceptance
Notes
The overlapping queue-request tests passed locally. Full validation and queue admission wait for both size budgets to fit.
Replaces Serialize Mergify queue requests in a task worktree #1346 after Loop Zero declined a delta review of the conflict-resolved merge. Retains the queue-departure reporting from Report Mergify departures for the current queue attempt #1357.
The shared GitHub comments fake reproduces the race with an accepted write and a lost reply. Focused Mergify tests passed.
Base
Base: bb2aae1
Validation
Recorded for
d369112a8b58uv 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