Repository navigation
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>
…retry-draft-activation
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; readiness observes the existing head, receipt and policy before reissuing the same draft transition. Co-Authored-By: Codex <noreply@openai.com>
…retry-draft-activation
Architecture-Review: unchanged; hosted eligibility still requires verified Git objects before accepting inherited evidence. Co-Authored-By: Codex <noreply@openai.com>
…e-observation-retry
…retry-draft-activation
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
…retry-draft-activation
…ervation-retry # Conflicts: # src/loopzero/github.py # tests/test_hosted.py
Co-Authored-By: Codex <noreply@openai.com>
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>
Architecture-Review: unchanged; the initial write and the existing readiness guards remain in place. Co-Authored-By: Codex <noreply@openai.com>
…retry-draft-activation
There was a problem hiding this comment.
loopzero primary review by claude on d630ae123e5b2f100d298e3d1b1973d0ca97e793, 51.1s: request_changes (0 critical, 2 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.
| if deadline is None: | ||
| raise | ||
| failure = f"Draft activation unconfirmed for PR #{pr.number}: {exc}" | ||
| retryable = isinstance(exc, _proc.ProcTimeout) or github._transient_error(exc.tail, False) |
There was a problem hiding this comment.
suggestion: cli.py now depends on private GitHub retry helpers
_activate_draft calls github._transient_error, github._retry_pause and github._read_timeout, and re-derives the transient classification even though _gh already chose between GhUnavailable and GhError for the write. Checking isinstance(exc, GhUnavailable) again with _transient_error duplicates that classification and can drift from it (for example, a rate-limited GhUnavailable is treated differently here than in _gh).
Consider moving the observe-and-retry-once logic into a public helper in github.py, such as mark_ready(..., deadline) that returns whether a retry is allowed. The CLI would then not need these private helpers.
| def _activate_draft(wt: Path, config: Config, pr: github.PR, deadline: float | None, | ||
| args: argparse.Namespace | None) -> None: | ||
| try: | ||
| github.mark_ready(config.repo, pr.number) |
There was a problem hiding this comment.
suggestion: The first activation attempt can outlast the wait budget
The first github.mark_ready(config.repo, pr.number) call still uses the fixed 120 s timeout, while the retry is capped with _read_timeout(120). A hung first write can run past --wait, which guarantees the recovery path then fails on an expired deadline.
Capping the first attempt with min(120, deadline - now) whenever a deadline exists would make the two attempts consistent.
|
|
||
| @pytest.mark.parametrize("settles", [True, False]) | ||
| def test_ready_wait_resumes_after_draft_transition(wt, gh, capsys, monkeypatch, head, settles): | ||
| @pytest.mark.parametrize("settles,fault", [(True, "interrupt"), (False, "interrupt"), (True, "lost"), (True, "retry"), (False, "moved")]) |
There was a problem hiding this comment.
suggestion: The replay does not cover a new blocker or an unknown state
The acceptance criteria say that a new blocker or an unknown state must prevent a second write. The parametrization only covers moved (a changed head). No case has the observed draft gain a non-waitable blocker, or a transient failure where _transient_error is false. Either case would confirm that pr ready is called exactly once and that the error carries the receipt.
Architecture-Review: unchanged; zero-second waits still observe once, and positive waits retain the original deadline and exit guidance. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on 2beb1bc80581501de27a8887a23c5a44617c6f11, 54.4s: request_changes (0 critical, 2 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.
| with github.bounded_reads(observation_deadline, token=None): | ||
| if not observe().is_draft: | ||
| return | ||
| if single_observation: |
There was a problem hiding this comment.
important: --wait 0 hides permanent activation failures as a resumable timeout
When single_observation is true and the PR is still a draft, the code raises ReadDeadline("draft activation is still unconfirmed") before it checks retryable. Take ready --wait 0 where mark_ready failed with a non-transient GhUnavailable, such as a 403/permission tail where _transient_error is False. cmd_ready catches the synthetic ReadDeadline at line 1296 and prints "timed out waiting for required checks … Run loopzero ready --wait to resume", then exits 3. The original failure (failure/exc) is dropped, and the user is told to retry something that will fail the same way every time. Before this change, the same path raised CliError("Draft activation unconfirmed …: <cause> | recovery: …") and exited 1.
The same instance exists for a positive budget: once the deadline has expired, observe()'s ReadDeadline is now re-raised at line 1228. A non-retryable activation failure is then reported as a plain timeout with exit 3 instead of the combined error.
Smallest fix: only turn the outcome into a timeout when the failure was retryable. Check if not retryable: raise CliError(...) before the single_observation raise. In _activate_draft, re-raise ReadDeadline only when retryable; otherwise keep wrapping it with failure so the cause is kept.
| if not observe().is_draft: | ||
| return | ||
| if single_observation: | ||
| raise github.ReadDeadline(("gh", "pr", "ready"), "draft activation is still unconfirmed") |
There was a problem hiding this comment.
important: merge --wait 0 now gets a bare ReadDeadline with no cause or timeout handling
_activate_draft is also called from _wait_for_checks (line 1464). It is reached by cmd_merge through _wait_with_deadline (line 1709). When timeout == 0, _wait_with_deadline (line 1389) calls _wait_for_checks outside its try/except github.ReadDeadline. So the new synthetic ReadDeadline for single_observation (and the re-raise at 1228) skips both the timeout printer and the failure wrapper and goes up to _run. There, as a GhError, it is printed as loopzero merge: draft activation is still unconfirmed and exits 1.
Compared with ready --wait 0, the same condition gives exit 3 plus a resume hint there. For merge, the exit code differs and the original mark_ready error text is lost. Only cmd_ready got the new except github.ReadDeadline wrapper. cmd_merge (the other caller of this defect class) was missed.
Fix: handle the ReadDeadline in one shared place for both callers. For example, move the timeout == 0 branch of _wait_with_deadline inside its existing try, or catch it there. Then drop the large try added around cmd_ready.
| return current | ||
|
|
||
| single_observation = args is not None and args.wait == 0 | ||
| observation_deadline = time.monotonic() + 5 if single_observation else deadline |
There was a problem hiding this comment.
suggestion: The hard-coded 5 s grace only applies to wait == 0, not to other expired budgets
wait == 0 gets a fresh 5-second observation window. A positive budget that has already run out (for example, --wait 1 after slow initial reads) gets no observation, because bounded_reads(deadline) raises right away on the first pr_view. The acceptance criterion ("observe the same PR and head after a transient activation failure") therefore holds only for that one literal value. The magic number also lets --wait 0 exceed what the user asked for.
Consider one rule for both cases, such as a single unbounded-but-short observation whenever the budget is already exhausted. At minimum, make the 5 s a named constant shared with the other single-observation timeouts.
| waited = _wait_with_deadline(wt, config, pr, args.wait, kicked=True, started=started, | ||
| args=args, allow_skipped=True) | ||
| deadline = None if args.wait is None else started + args.wait | ||
| try: |
There was a problem hiding this comment.
suggestion: The broad try in cmd_ready adds a second timeout handler alongside _wait_with_deadline's
The whole body of cmd_ready is wrapped to catch ReadDeadline. _wait_with_deadline already converts ReadDeadline into a printed timeout plus None. This gives two places that print the timeout for one cause, and cmd_merge doesn't get the same behaviour (see the related finding). It's simpler and less likely to drift if ReadDeadline is caught only in _wait_with_deadline and the two direct _activate_draft calls in cmd_ready. Then the _report_ready split isn't needed just to keep the function readable.
Context and goal
Re-read the current PR and head when activation is ambiguous. Resume the wait after a confirmed transition or retry a still-eligible draft once within the original deadline.
Closes #1500. This draft depends on #1560.
Validation
Recorded for
2beb1bc80581uv 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 readiness cases passed, including an applied write, a retry, and a moved head. Source +35 lines, tests +0.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review