Repository navigation
Retry safe GitHub observations once within their budget - #1560
Conversation
Architecture-Review: unchanged; remains fail-closed while trusted evidence is unavailable, with the same status context and publisher. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; remains fail-closed while trusted evidence is unavailable, with the same status context and publisher. Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; evidence and publication failures remain distinguishable within the existing hosted trust boundary. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; transient fetch diagnostics remain inside the existing isolated checkout. Co-Authored-By: Codex <noreply@openai.com>
…e-observation-retry # Conflicts: # src/loopzero/github.py # src/loopzero/hosted.py # tests/test_hosted.py
Architecture-Review: unchanged; hosted eligibility still requires verified Git objects before accepting inherited evidence. Co-Authored-By: Codex <noreply@openai.com>
…e-observation-retry
Architecture-Review: unchanged; remains fail-closed while trusted evidence is unavailable, with the same status context and publisher. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; evidence and publication failures remain distinguishable within the existing hosted trust boundary. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; transient fetch diagnostics remain inside the existing isolated checkout. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; hosted eligibility still requires verified Git objects before accepting inherited evidence. Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; the evidence outcome changes while the existing retry and wait behavior remains in force until #1502. Co-Authored-By: Codex <noreply@openai.com>
…safe-observation-retry # Conflicts: # src/loopzero/github.py # src/loopzero/hosted.py # tests/test_hosted.py
…ervation-retry # Conflicts: # src/loopzero/github.py # tests/test_hosted.py
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on c1d8bb702d1a23abad48c2ac08a81b43faea5800, 79.1s: 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.
| tail = "\n".join(part for part in (done.stderr, body) if part) | ||
| if done.exit_code and _rate_limited(status, headers, tail): | ||
| guidance = (_redact_tokens(_rest_rate_limit(headers), selected) if rest_api | ||
| if _retry_pause(_rate_limit_delay(headers, delay), timeout): |
There was a problem hiding this comment.
suggestion: Rate-limit diagnostics are lost when the retry check finds the deadline already passed
In a retry scope, a secondary-limit response with Retry-After goes to _retry_pause(_rate_limit_delay(...)), which calls _read_timeout(limit). If the response arrives at or after the deadline, _read_timeout raises ReadDeadline before the code builds the _rest_rate_limit guidance. The status, X-RateLimit-* and Retry-After evidence are then dropped, and cli.py:1333 reports a plain timeout. The transient path at line 402 has the same issue: a 5xx with a request ID becomes a bare ReadDeadline. That conflicts with "retain GitHub diagnostics". Smallest fix: in _retry_pause, treat an exhausted budget as "no retry" by catching ReadDeadline and returning False, so the usual rate-limit or transient error is raised with its detail.
| message_tail=None if diagnostic_api else tail) | ||
| raise GhUnavailable(("GitHub API request",), detail, token=selected, guidance=guidance) | ||
| raise GhUnavailable(argv, tail, token=selected, guidance=guidance) | ||
| raise GhUnavailable(("gh", *args), tail, token=selected, guidance=guidance) |
There was a problem hiding this comment.
suggestion: Rate-limit guidance says "No automatic retry" even when a retry was attempted, and the error argv differs from the general error path
_rest_rate_limit still ends with "No automatic retry.". After this change a secondary limit may already have been retried once after Retry-After, so the message is misleading. Also, the rate-limit raise now uses ("gh", *args) without --include, but the general error path at line 405 still reports argv, which includes --include. The same request is therefore described differently depending on the failure type. Consider rewording the guidance (for example, "retry once honored" / "not retried: delay exceeds budget") and using one command representation in both raise sites.
Architecture-Review: unchanged; scoped deadlines are still applied only to reads, and non-idempotent writes keep their original outcomes. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on 6ac05fda4af5301a0f3a7ed62fa78f4705271d83, 40.1s: approve (0 critical, 0 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.
| if scope and scope[2]: | ||
| _read_timeout(timeout) | ||
| if delay is None or not retryable: | ||
| _read_timeout(timeout, scoped=bool(scope and scope[2])) |
There was a problem hiding this comment.
suggestion: Post-timeout deadline check now differs from the run-timeout clamp in non-retry read scopes
The timeout passed to run is clamped with scoped=read_only (line 376), so the shared deadline still limits reads inside bounded_reads(..., retry=False). But after a ProcTimeout, the check uses scoped=bool(scope and scope[2]). When such a read times out past the deadline, it now raises a plain ProcTimeout. Before this change it raised ReadDeadline. No production code hits this today: both bounded_reads callers (cli.py:916 and cli.py:1328) pass retry=True. Still, the code now uses two different rules for 'does the deadline apply', and they could drift apart. The smallest fix is scoped=read_only on line 381, the same rule as lines 376, 382, 392 and 402. Writes would still skip the check, because scope is None for them. Alternatively, add a comment explaining why non-retry scopes should surface a raw ProcTimeout.
| monkeypatch.setattr(github.time, "monotonic", lambda: 10.0 + sum(sleeps) + int(failure == "write" and bool(timeouts))) | ||
| error = github.GhError if failure == "transient" else _proc.ProcTimeout | ||
| with pytest.raises(error), github.bounded_reads(10 + budget, retry=True): | ||
| github.mark_ready("acme/widgets", 7) if failure == "write" else github.api_get("repos/acme/widgets/pulls/7/reviews") |
There was a problem hiding this comment.
suggestion: The new 'write' case covers only the ProcTimeout path, not the scoped=read_only changes to _retry_pause
mark_ready is a non-idempotent write, so it gets delays=(None,) and _retry_pause returns before it reads the scope. The case does catch the line-381 regression: before the fix it would have raised ReadDeadline instead of ProcTimeout. But the scoped=read_only edits at lines 382, 392 and 402 only change behaviour for retry_idempotent writes (thread resolution) inside a bounded_reads scope, and nothing tests that. No caller combines the two today, so this isn't blocking. Also, the monotonic lambda that leans on bool(timeouts) is hard to read. A named clock stub would make it clearer without adding test lines.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Context and goal
Use one backed-off retry for safe reads and idempotent thread resolution. Keep review read-back within its original deadline and preserve throttle diagnostics.
Closes #1502.
Validation
Recorded for
6ac05fda4af5uv 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 0GitHub transport, review recovery, and finding-resolution replays passed. Source +19 lines, tests −1.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review