From 9a9d619750116b6fa4ee663d87292eda8e05050d Mon Sep 17 00:00:00 2001 From: eowca <4008965+eowca@users.noreply.github.com> Date: Thu, 26 Nov 2026 02:23:40 +0100 Subject: [PATCH 1/2] Document the coordinator route for remote check receipts Co-Authored-By: Codex --- SETUP.md | 23 +++++++++++++++++++++++ docs/ARCHITECTURE.md | 6 ++++++ tests/test_cli.py | 22 ++++++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/SETUP.md b/SETUP.md index 8d2b47eb..1a4b307d 100644 --- a/SETUP.md +++ b/SETUP.md @@ -334,6 +334,29 @@ access to the configured GitHub repository even before a PR exists. See the [workflow diagram](docs/WORKFLOW.md#1-from-idea-to-merged) and [Blockers](core/CONTRACT.md#blockers) for the rest of the workflow. +### Check receipts with remote execution + +Run the current `loopzero check` coordinator from the task worktree with +the same effective settings used by `loopzero ready`. To execute stages +remotely, configure an operator-trusted `[checks].runner` that implements the +[stage protocol](docs/ARCHITECTURE.md#check-stage-runners). The local coordinator +writes the receipt. + +Without a stage adapter, run the whole check locally. Use a local slot if the +host requires one. On miki, run this from the task worktree. + +```sh +HEAVY_SLOT_REMOTE_HOSTS="$HOME/.cache/intelflo-scratch/locks/no-remote-hosts.json" "$HOME/.cache/intelflo-scratch/locks/heavy-slot.sh" loopzero check +``` + +A whole-job remote worker writes its own receipt. Ready can use it only if it +passes the existing checks for a clean, passing receipt at the exact head, +with the current ordered commands and matching settings fingerprint. An older +worker can omit the fingerprint. A current worker can produce a different +fingerprint, for example when its inherited `PATH` differs. GitHub required +CI supplies separate evidence. The [owner queue route](core/CONTRACT.md#blockers) +applies only under its documented conditions. + ## Removing an abandoned task worktree For a merged PR, retry cleanup from a durable directory with diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 2a3213d0..51c367e8 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -498,4 +498,10 @@ Receipts that use saved stage results bind the current head and check settings. For delegated checks, both the receipt and the stage key bind the runner's launch path, resolved executable path and executable bytes. Unavailable runner identity prevents receipt reuse. +A worker running the entire check is itself the coordinator and writes a +receipt with its own effective settings. Transferring it preserves the +fingerprint, if present. Local readiness applies the same receipt predicate +as for any other coordinator. See [check receipts with remote execution](../SETUP.md#check-receipts-with-remote-execution) +for the operator route. + CI and merge-queue candidates run fresh without a local worktree receipt. diff --git a/tests/test_cli.py b/tests/test_cli.py index 4b779553..4ad20c67 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2988,6 +2988,28 @@ def change_policy(_seconds): assert run(capsys, *args, "check")[0] == 1 +@pytest.mark.parametrize("worker", ["legacy", "different-path", "matching"]) +def test_ready_checks_transferred_whole_job_receipt(wt, gh, capsys, head, tmp_path, monkeypatch, worker): + arm_approved_ready_pr(gh, head, wt, readiness={"local_exit": None}, isDraft=False) + with monkeypatch.context() as worker_env: + if worker != "matching": + worker_env.setenv("PATH", str(tmp_path / "worker-bin"), prepend=":") + assert run(capsys, "check")[0] == 0 + + receipt = wt / ".loopzero/checks.json" + payload = json.loads(receipt.read_bytes()) + if worker == "legacy": + # Older producers serialize these results without a settings fingerprint. + del payload["settings_sha256"] + # Whole-job transport preserves the producer's fields. + receipt.write_text(json.dumps(payload)) + assert run(capsys, "ready")[0] == (0 if worker == "matching" else 1) + + if worker != "matching": + assert run(capsys, "check")[0] == 0 + assert run(capsys, "ready")[0] == 0 + + @pytest.mark.parametrize("fixed", [False, True]) def test_ready_matches_effective_inherited_check_environment( wt, gh, capsys, head, tmp_path, monkeypatch, fixed, From cb879abde5acf3dc6c8a716fb76621585db27376 Mon Sep 17 00:00:00 2001 From: eowca <4008965+eowca@users.noreply.github.com> Date: Thu, 26 Nov 2026 02:26:33 +0100 Subject: [PATCH 2/2] Separate the legacy receipt and PATH mismatch cases Co-Authored-By: Codex --- docs/ARCHITECTURE.md | 1 + tests/test_cli.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 51c367e8..70572baa 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -498,6 +498,7 @@ Receipts that use saved stage results bind the current head and check settings. For delegated checks, both the receipt and the stage key bind the runner's launch path, resolved executable path and executable bytes. Unavailable runner identity prevents receipt reuse. + A worker running the entire check is itself the coordinator and writes a receipt with its own effective settings. Transferring it preserves the fingerprint, if present. Local readiness applies the same receipt predicate diff --git a/tests/test_cli.py b/tests/test_cli.py index 4ad20c67..297b7535 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2992,7 +2992,7 @@ def change_policy(_seconds): def test_ready_checks_transferred_whole_job_receipt(wt, gh, capsys, head, tmp_path, monkeypatch, worker): arm_approved_ready_pr(gh, head, wt, readiness={"local_exit": None}, isDraft=False) with monkeypatch.context() as worker_env: - if worker != "matching": + if worker == "different-path": worker_env.setenv("PATH", str(tmp_path / "worker-bin"), prepend=":") assert run(capsys, "check")[0] == 0