Repository navigation
Honor Retry-After on Mergify queue observations - #1757
Conversation
Co-Authored-By: Codex <noreply@openai.com>
…retry-after-v2 # Conflicts: # src/loopzero/cli.py # tests/test_mergify.py
There was a problem hiding this comment.
loopzero primary review by claude on d3973c45f04e37674707fb645b6f973105f3631c, 51.8s: 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)
Findings without a file location:
- suggestion:
ready --waitdoesn't pass the wait deadline to its first readiness read, butmerge --waitdoes —cmd_mergenow computesdeadlinebefore calling_pr_readinessand passes it asmergify_deadline. With--wait=0, that means the firstmergify.configuredread happens once and is not retried.cmd_readycalls_pr_readinesswithoutmergify_deadline, so its first Mergify configuration read falls back to the no-deadline path, which allows a 2s backoff, even forready --wait=0. Its later polls in_wait_for_checksdo usestarted + timeout. So the same--waitbudget gives different retry behavior depending on the command, which doesn't match the requirement to use the caller's wait deadline for retry admission. Smallest fix: movestarted = time.monotonic()above the_pr_readinesscall incmd_readyand passmergify_deadline=None if args.wait is None else started + args.wait, ascmd_mergedoes.
Native Claude output is retained in the restricted local review receipt.
| except (OSError, json.JSONDecodeError, UnicodeDecodeError, http.client.IncompleteRead) as exc: | ||
| detail, transient = _queue_read_failure(exc) | ||
| if not retry or not transient: | ||
| raise MergifyError(detail) |
There was a problem hiding this comment.
suggestion: Queue read errors no longer keep the original exception
The old code raised MergifyError(...) from exc. The new code raises MergifyError(detail) after the except block has ended, so the error has neither __cause__ nor __context__. HTTP, socket and TLS tracebacks for a failed queue read are lost. Smallest fix: keep the caught exception (for example, error = exc in both handlers) and raise MergifyError(detail) from error at both raise sites (lines 125 and 127).
| raise MergifyError(detail) | ||
| if not _wait_to_retry(delay, deadline): | ||
| raise MergifyError(f"{detail}; retry delay exceeds the wait budget") | ||
| return None |
There was a problem hiding this comment.
suggestion: Removed blank line leaves only one blank line between top-level functions
The diff deletes one of the two blank lines between api_get and _unmet_conditions. Ruff doesn't fail on this because the configured rule set doesn't include E3. It's still inconsistent with the rest of the module. Fix: restore the second blank line.
| if not retry or not transient: | ||
| raise MergifyError(detail) | ||
| if not _wait_to_retry(delay, deadline): | ||
| raise MergifyError(f"{detail}; retry delay exceeds the wait budget") |
There was a problem hiding this comment.
suggestion: Over-budget message mentions a wait budget that may not exist
Without a deadline (plain merge, status, or the hosted api_get callers), the 5s cap is internal. A 429 with Retry-After: 40 then reports "retry delay exceeds the wait budget", even though the user gave no wait budget. When deadline is None, consider wording such as "exceeds the unattended retry limit", so the explanation points the user to --wait as the remedy.
Architecture-Review: unchanged; conflict resolution preserves the existing deadline and readiness documentation alongside main’s receipt and polling behavior. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the merged readiness helper preserves receipt reporting and forwards the existing retry deadline. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on 10614414ecec4b900392b776e1b2df7052e5efd9, 17.9s: approve (0 critical, 0 important, 0 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.
|
@Mergifyio queue |
✅ Merged into
|
Context and goal
Honor Retry-After on Mergify queue reads and make at most one automatic retry. Carry the merge deadline through the initial configuration observations and stop when the delay cannot fit.
Closes #1499. Supersedes #1563 after main added distinct transport and JSON diagnostics. The replacement preserves both diagnostics.
Validation
Recorded for
10614414ececuv 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 0Focused Mergify API and CLI replays passed after resolving the conflict. They cover persistent throttling, an absent deadline, an insufficient deadline, terminal transport errors, and retry counts. Python source +23 lines, tests −1.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review