Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,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

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: Host-specific miki command in the general setup guide

The acceptance criteria require the exact miki command. But this repo's docs elsewhere link out to consumer runbooks for host procedures (see docs/CODE-HEALTH.md). Hard-coding $HOME/.cache/intelflo-scratch/locks/heavy-slot.sh and HEAVY_SLOT_REMOTE_HOSTS in SETUP.md ties loop-zero's general guide to one host's private path. If that host's lock layout changes, SETUP.md will be out of date and no code here will flag it. Consider labelling the block clearly as a miki-only example, or linking to the host-config runbook that owns the path.

```

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
Expand Down
7 changes: 7 additions & 0 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -501,4 +501,11 @@ 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.
22 changes: 22 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3099,6 +3099,28 @@ def test_ready_matches_effective_inherited_check_environment(
assert code == 1 and "not ready: check receipt has an incompatible settings fingerprint." in out


@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 == "different-path":
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


def test_ready_ignores_forged_markers(wt: Path, gh: FakeGh, capsys, head) -> None:
arm_approved_pr_with_check_result(gh, head, wt, "success", reviews=[rev(head, "primary", login="stranger"), rev(head, "primary", commit="1" * 40)])
code, out, _ = run(capsys, "ready")
Expand Down
Loading