Skip to content

Checkpoint recorded stages in the sandbox check loop - #1696

Merged
mergify[bot] merged 4 commits into
mainfrom
lean178/1694-check-complexity
Nov 26, 2026
Merged

mergify[bot] merged 4 commits into
mainfrom
lean178/1694-check-complexity

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Checkpoint recorded stages in the sandbox check loop

Context and goal

Closes #1694.

Acceptance

  • Continue recording the incomplete marker and cached unvisited stages at the same point, before exit status is reported.
  • Preserve the first-failure verdict, offline preflight, cache behavior, and the dirty-worktree fallback rejection.
  • Pass the focused sandbox, delegated-stage and checkpoint interruption tests and the full check.

Notes

  • Base bf1002c2b7c1. Ruff ranked the five as config._build (32 branches), cli.cmd_review (28), runners._codex_evidence (16), sandbox.run_checks (16), and cli.cmd_merge (16). Source delta is 14 added and 22 deleted, net −8. The 40-line target was not reached within the eligible files.
  • The loop now sets the input key on each fresh result, removing a separate branch. Every execution route starts with the default empty key, including resolved fallback. Ruff keeps the loop at 16 branches while the checkpoint helper disappears. Callback order, report contents, and final verification stay the same. No delivery interface or trust boundary changes.
  • Python 3.14 branch tracing on the 54 stage-runner tests reached the resolved fallback at base and never reached the empty-result error. The fallback invokes run_checks with one command, no runner, no preparations and no input keys. Every completed call appends one stage before returning. A thrown exception still passes through the existing error path.
  • The sandbox suite passed 91 tests at base and after the edit. The stage runner suite passed 54 tests in each run, and six checkpoint and offline preflight CLI tests passed after the edit.
  • Parked by r49 steering at pushed head 8916b1a6c0b4, PR Checkpoint recorded stages in the sandbox check loop #1696 still draft. Hosted checks passed; the queued local check was cancelled at the slot supervisor before review. Focused tests and the size gate passed. The final measured reduction, net 8 source lines, is posted on Keep loop-zero improvement builders full: refill continuously (Marcin standing order) #575. Resume with a full slotted check, then primary review.

Validation

Recorded for c3f8fd66c5a7

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

  • primary, claude, c3f8fd6, approve

Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero primary review by claude on c3f8fd66c5a729c61782d747b4eebf9a8a0c8f1d, 26.3s: approve (0 critical, 0 important, 1 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.

Comment thread src/loopzero/sandbox.py
checkpoint, CheckReport(head, dirty, tuple(results), settings_sha256),
previous, commands[index + 1:],
)
if checkpoint is not None and result.input_key and result.exit_code == 0:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Moving the checkpoint helper into run_checks makes the loop nest deeper

This change is meant to reduce complexity in run_checks. Moving the checkpoint logic into the loop keeps Ruff's branch count at 16, but the code now nests four levels deep in the main loop (with → for → if → if). It also builds the checkpoint report inside the loop. I checked the behaviour and it matches the old helper. input_key defaults to None, and _input_key returns None or a hash, so the unconditional replace(result, input_key=key) gives the same values as the old if key: path. commands[ordinal:] is the same slice as the old commands[index + 1:]. Removing the not local.results guard is safe: with _resolved=True and checks=(command,), the loop always appends exactly one result or raises. A smaller option is to keep a helper that takes (results, commands[ordinal:]) and is called only when checkpoint is not None and result.input_key and result.exit_code == 0. That still avoids building an unused report and keeps the nested block out of the hotspot function. This is optional.

@eowca
eowca marked this pull request as ready for review November 26, 2026 10:38
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as 8bcb9cd at 10:44 UTC

6 min in the queue, 4 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 10:38 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1816
  • ✅ Merged 10:44 · 8bcb9cd · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 26, 2026
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit 8bcb9cd into main Nov 26, 2026
18 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1694-check-complexity branch November 26, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify the sandbox check loop after the source complexity audit

1 participant