Skip to content

Check local receipts before remote readiness gates - #1842

Merged
mergify[bot] merged 3 commits into
mainfrom
lean178/1405-receipt-order-r54
Nov 26, 2026
Merged

mergify[bot] merged 3 commits into
mainfrom
lean178/1405-receipt-order-r54

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Check local receipts before remote readiness gates

Context and goal

Closes #1405

Acceptance

  • Ready and merge --wait resolve the PR, validate its head and hold, and reject an invalid local receipt before any remote readiness read. The open-branch replay uses two REST reads and performs no writes or polling.
  • A receipt replaced during remote gate evaluation blocks readiness and writes. Polls retain workflow-change diagnostics, including when a fresh receipt exists for the new settings.
  • Valid receipts still run the existing gates. Status keeps comprehensive diagnostics, and already-merged cleanup remains available.

Validation notes

  • Focused replays passed for ready and Mergify merge --wait, including both parked blockers and a transient 503.
  • Source delta +18, test delta 0. The bounded discovery uses the existing head-filtered list and detail path while preserving transient retry behavior.

The ready Git-call assertion now accounts for the worktree ownership guard before gates, after them, and before marking ready.

Base

Base: 839d8fa

Validation

Recorded for 283cc1086759

  • 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

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 46ee67f047e18d1c25b1a579f893adce69a4f574, 71.1s: approve (0 critical, 0 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)

Findings without a file location:

  • suggestion: Branch PR lookup description is now wrong for ready and merge — Step 3 still says branch PR lookup starts with the remote head and the commit-to-PR endpoint, then falls back to listing PRs. _pr_readiness now passes list_only=True (cli.py:1224), so ready and merge skip the branch and commit reads and go straight to the head-filtered list and detail path. status, merge --cancel and review still use the commit path. Update the paragraph to say that ready and merge use only the head-filtered list. That way a reader won't put back the commit lookup and break the two-read replay. Also, pr_for_branch now takes two mode flags (open_only, list_only). If the list path is enough for ready and merge, consider whether other callers need the commit path at all. Removing it would beat keeping two lookup modes that can drift apart.

Native Claude output is retained in the restricted local review receipt.

Comment thread src/loopzero/cli.py
return sha
confirmed = state is not None
if confirmed and not confirmed_marker:
_require_receipt(wt, config, pr.head_sha)

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: Receipt guard on mark_confirmed is applied inconsistently

_merge_with_mergify now calls _require_receipt before mergify.mark_confirmed (line 1746), but _wait_for_mergify writes the same marker at line 1703 with no guard. The marker only records that Mergify already queued the PR; it doesn't advance readiness. So the guard at 1746 can only fail in a race, and then it stops the command for a PR that is already in the queue instead of following it. Either drop this guard, keeping receipt checks only on mark_ready, mergify.request and github.merge as the docs describe, or guard both places the same way.

Comment thread tests/test_cli.py
(True, "dirty", "check receipt was recorded in a dirty worktree."),
(True, "commands", "check receipt's plan differs from the trusted workflow."),
*((True, condition, "check receipt is incomplete.") for condition in ("empty", "checkpoint")),
@pytest.mark.parametrize("command", ["ready", "merge"])

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: Rewritten receipt test drops the valid-receipt case and the recovery-hint check

The old parametrization had a matching case, which proved a valid receipt passes and is not short-circuited. It also checked the full recovery hint ("Run loopzero check in this worktree ... local coordinator for delegated stages.") for the legacy and incompatible cases. The new test_delivery_requires_current_receipt only checks the first sentence of each reason. Acceptance item 3 says valid receipts still run the existing gates. Other tests may cover that indirectly, but a passing case next to the new early-exit cases, plus the recovery-text check, would pin it down cheaply.

@eowca
eowca marked this pull request as ready for review November 26, 2026 11:34
@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

🚫 Left the queue · conflict with base branch

3 min in the queue, with no time running CI.

So far

Reason

The pull request conflicts with main

Conflicting file: src/loopzero/cli.py

Before this, the pull request was held in the queue behind 1 pull request ahead of it.

To get back in the queue

  • You should update or rebase your pull request. A pull request in a stack is updated by rebasing the stack onto the branch it conflicts with. A pull request queued by a rule comes back to the queue once updated, as long as the rule still matches.
  • If it was queued with a command, update it, then comment @mergifyio queue to queue it again.

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 added dequeued and removed queued labels Nov 26, 2026
Architecture-Review: unchanged; the new fingerprint validator and receipt-first ordering both remain in effect.
Co-Authored-By: Codex <noreply@openai.com>
@eowca
eowca marked this pull request as draft November 26, 2026 11:39
Architecture-Review: unchanged; this clean base merge preserves receipt-first readiness.
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 delta review by claude on 283cc1086759ebf28e2c89eaa625d44a57a6ca1c, 10.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.

@eowca
eowca marked this pull request as ready for review November 26, 2026 11:50
@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 3c2697f at 12:00 UTC

9 min in the queue, 3 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 11:51 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1859
  • ✅ Merged 12:00 · 3c2697f · 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 3c2697f into main Nov 26, 2026
20 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1405-receipt-order-r54 branch November 26, 2026 12:01
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.

Check the local receipt before fetching remote readiness evidence

1 participant