Check workers build the checks a ready change requires before the operator approves it. The valley host is the primary worker and a second check worker takes overflow.
From the plan (2026-10-13):
- Workers pull assignments from the valley; nothing connects in to a worker, which keeps the rule that the agent guest never connects to a worker.
- Each worker builds in an isolated profile, with a trusted runner signing under that worker's own identity.
- The scheduler gives the valley host priority, and hands work to a second check worker only when the host is busy or backed up and the second worker is available.
- Check definitions come from the integrated tip (bd-eaefe82), so a change can't redefine its own checks.
- `approve` stops running checks locally, reuses acceptable evidence already on origin and runs only what is missing. Today a second attestation from the same signer is refused (bd-7b7d58f).
- There is no interim prebuilder: the operator chose to wait for the workers.
Done when a ready version's required checks have evidence on origin before anyone approves it, and `approve` runs nothing that evidence already covers.
Source: 2026-10-13, `plan.md` M4 item 5 and Status ("Trusted-builder latency").
---
Design: the minimal version, revision 2, 2026-10-22. The operator kept the five recommendations and added: keep it simple, and leave no broad mark across the codebase. Astra authored it, and a Claude review cut it down. The full 11-slice design (2026-10-21) is in this knot file's history, and its deferred pieces are listed below.
# Valley check workers: revision 2
A timer on the valley host runs today’s attester for ready changes.
Workers publish today’s statements through today’s Git hook.
Approval fetches evidence, skips covered checks, and builds only the remainder locally.
Worker and local attesters use distinct signing identities.
The integrator independently verifies evidence before submission.
The-valley pilots with one slot, four CPUs, and 8 GiB.
The deployment project follows by configuration once capacity, private inputs, and signer authorization are settled.
No scheduler, leases, worker endpoint, or evidence-format migration is needed.
Source basis: the-valley HEAD and local `origin/main` are `d8c2e54343602a7dfb560a695157b4f29feff1dc`. Source declarations do not establish running host configuration. All proposed mechanisms below are **not built**; operating settings are **deployment choices**.
## Design
### Worker: a timer around existing commands
**Implemented.** Pending JSON selects ready changes whose active version has not landed. `valley-go checks` already returns structured requirements through the Go deriver, given explicit policy directories and commits. `status/pending.go:79`, `status/checks.go:31`, `status/checks.go:94`.
**Decision.** Add a small worker script. One timer and host lock serialize its work across configured projects:
1. Read `valley pending --json` and pin an active version’s head.
2. Resolve integrated policy inputs and the merge base with the target.
3. Call existing `valley-go checks`.
4. Fetch evidence for the candidate tree and identify uncovered, audited Nix checks.
5. Run that set together through `attest run --rev <head>`.
6. Push only the resulting attestation ref.
Policy comes from the integrated side, following the integrator’s existing rule. Check definitions still come from the candidate. No preparation record or alternative merge calculation is introduced. `integrator/refs.go:345`, `integrator/refs.go:363`, `attest/run.go:84`.
**Adopt the derivation cut.** Approval keeps its Bash derivation; integration keeps invoking `valley checks`. A worker disagreement causes extra or missed background work, which approval’s fallback absorbs. There is no derivation migration or disagreement gate. `bin/valley:1652`, `integrator/policy.go:142`.
**Implemented.** The attester stores all selected checks under one subject-and-signer ref. A failed selected check prevents publication. An empty selection means every flake check, so the worker must stop when nothing is missing. `attest/run.go:153`, `attest/run.go:201`, `attest/run.go:284`.
Use `attest run` without `--push`: that option also pushes a source ref. The worker’s explicit Git push carries evidence alone. The hook already verifies the subject and signer independently of the pusher. `attest/run.go:210`, `valleyhook/attestation.go:38`.
**Adopt the operational cuts.** The local attestation ref is the publication recovery record; no separate receipt is needed. After a lost reply, inspect origin and resend the same object. Do not recheck readiness before publication: the evidence remains an observation about its pinned tree, even if that version is superseded or withdrawn. Approval retains its own record recheck.
**Deployment choice.** Poll once a minute, with one batch at a time. Keep bounded logs and a small local failure/backoff record so failing checks do not run every minute. Origin read failures stop the pass. An occupied worker ref that lacks required checks is reported before building; local approval can supply the remainder under its separate signer.
### Approval: reuse first, then run the remainder
**Adopt P1.** Approval must remain usable during a worker outage, before the deployment project is enabled, and for checks the worker cannot run. It builds only uncovered checks locally using the operator’s existing attestation key.
**Implemented.** Approval currently requires that key whenever any check is required and runs the entire required set. Its ordinary fetch does not explicitly fetch attestation refs. `bin/valley:956`, `bin/valley:1666`, `bin/valley:1689`, `bin/valley:1714`.
**Decision.** Add a small coverage helper in `status/`, using the existing signer reader and `attest verify`. Approval performs these steps:
1. Bind the reviewed head and derive requirements as today.
2. Compute its tree digest.
3. List and explicitly fetch origin’s `refs/the-valley/attestations/<digest>/*`, retaining their advertised object IDs.
4. Verify those fetched notes and divide required checks into covered and missing.
5. Print reused checks and their signers, then run only the missing set.
6. Publish newly produced evidence with the existing integration request.
Only evidence confirmed on origin counts as background coverage. Local-only notes are not mistaken for published evidence. Failed inventory or fetch is an error, not an empty result.
When everything is covered, approval needs no attestation key and starts no check. When something is missing, retain the current local execution path and failure behavior. Preserve the reviewed-head checks, record recheck, request compare-and-swap, and empty-push guard. `bin/valley:1784`, `bin/valley:1804`, `bin/valley:1817`.
**Initial coverage is conservative.** Reuse pure Nix evidence for the exact candidate tree when its statement, signature, subject, result, check name, runner, attribute, and project authorization agree. `attest verify` already checks canonical form, schema, signatures, and subject binding without rerunning the check. `attest/verify.go:11`, `attest/verify.go:55`, `attest/verify.go:111`.
**Adopt finding 8.** Comparing the attribute is stricter than the current integrator’s unchanged-tree rule. That rule checks result and predicate kind, then accepts pure evidence without comparing attributes. Keep the stricter client test without changing that gate. `integrator/verdict/verdict.go:366`, `integrator/verdict/verdict.go:390`.
Effectful evidence reuse and cross-tree client reuse remain outside this pilot. Their checks retain local execution. If the target moves, integration applies its existing merge and transfer rules; changed closures may require rebase and fresh evidence. `integrator/refs.go:376`, `integrator/refs.go:419`.
### The collision avoided—and the collision remaining
**Implemented.** The address is one tree digest plus one signer key hash, and the hook refuses updates. `attest/run.go:201`, `valleyhook/policy.go:149`.
Worker evidence and the operator’s complementary local batch therefore coexist when their signing identities differ. Reusing either batch requires no replacement statement.
**Qualify the review’s absolute claim.** This avoids collision with the worker’s ref; it does not eliminate bd-7b7d58f. An existing partial ref from the same local signer still prevents adding another batch. Renewed effectful observations also remain affected. Approval already diagnoses that condition. `bin/valley:1520`, `bin/valley:1823`.
Check the destination before a local build when it already exists. Report an incompatible occupied ref rather than doing work that cannot be published. Keep the general address fix deferred; do not overwrite evidence or rotate keys merely to obtain another address.
### Trust: restrict workers by project
**Implemented.** Registry recognition alone is broad: keys with `signs` enter known-signers, and the hook and integrators use that file. There is no per-check signer field. `identity/render.go:121`, `nix/valley-host.nix:213`, `nix/valley-host.nix:663`, `schema/verification.cue:179`.
**Adopt the smaller restriction.** Configure a list mapping each restricted worker signer to allowed projects. In `integrator.classify`, a cryptographically verified worker signature outside that list becomes `UnknownSigner`. Unrestricted existing identities retain their current treatment. An empty project list denies the worker everywhere.
Enforcement belongs only in classification. No hook, statement, verdict, or general collection change is needed. The existing collector already lets an admissible note replace one classified as unknown. `integrator/evidence.go:125`, `integrator/evidence.go:78`.
Per-check restrictions are deferred. Both inspected project catalogues declare Nix checks. This permits project-level trust; it does **not** technically restrict a compromised worker to the audited subset. Adding effectful checks requires revisiting that decision. `policy/project/policy.cue:76`.
**Adopt publication; qualify “read only by the integrator.”** Known-signers and the integrator name already travel through `refs/the-valley/signers`. Extend that publication with the project list, including publication triggers when it changes. Coverage must read it too, or approval could skip evidence that classification rejects. This is advisory client filtering; the integrator remains the enforcement boundary. No separately installed client bundle is needed. `integrator/signers.go:15`, `status/signers.go:224`, `nix/valley-host.nix:1765`.
**Adopt the memo cut.** Do not add an authority digest. List-only changes retain today’s memo behavior: widening access may leave a previously refused request waiting until head, tip, or evidence changes. Narrowing access does not make a cached refusal land. `integrator/refs.go:140`.
Deploy classification enforcement on every integrator sharing the registry before enabling the worker key. Use a distinct worker signing identity and a Git transport credential without approval or protected-ref authority. Ordinary Git access still permits unprotected source refs; an evidence-only endpoint is deferred. `valleyhook/policy.go:146`, `valleyhook/policy.go:157`.
A compromised worker can fabricate check results throughout an authorized project. It cannot supply the integrator signature required by transfer readers. `rebase/snapshot.go:448`.
Trusted definitions remain deferred: the candidate can weaken its own checks through files the operator reviews. Building the evaluated derivation preserves execution consistency, not independent assertions. `attest/check.go:118`, `attest/check.go:157`.
### Isolation, caps, and the deployment project
**Deployment choice.** Use the valley host’s Nix daemon with sandboxed builds. Put the worker’s evaluation process and the daemon’s build processes under an aggregate four-CPU, 8 GiB budget. Configure one worker batch, `max-jobs = 1`, `cores = 4`, `CPUQuota = 400%`, and `MemoryMax = 8G`. Bound swap, scratch, logs, and build time.
Verify actual cgroup membership, including QEMU and any build scopes. Capping only the attester client is insufficient. CPU and memory limits apply hierarchically. [systemd resource controls](https://www.freedesktop.org/software/systemd/man/260/systemd.resource-control.html).
Use packaged tools and schema, pure evaluation, fixed Nix configuration, and an unprivileged worker account. Keep signing keys and production credentials outside source exports and build sandboxes. Disable remote builders and candidate flake configuration. Evaluation belongs within the budget because the-valley uses import-from-derivation. `flake.nix:10`, `attest/check.go:69`.
**Adopt the host-daemon recommendation.** Do not add a private daemon or outer microVM. Do not add daemon device restrictions that hide KVM. The deployment’s configuration declares KVM support and an agent guest; those declarations justify testing this path, not assuming it works on the running host.
The daemon cap affects its other clients. The deployment separately documents direct root rebuilds outside the daemon and caps the upgrade unit itself. Unchanged-tree integration performs no closure evaluation. Remove the dedicated-daemon question, while measuring actual contention. `integrator/refs.go:419`.
**Enabling the deployment project is configuration, gated on three results:**
1. **Capacity.** Run the largest relevant multi-node checks under 8 GiB, with the agent guest and inference active. Include `resolver-redundancy`, which starts multiple nodes. Deliberate exhaustion must leave host services healthy.
2. **Private inputs.** Test the pinned inputs with the worker’s actual credential-free environment. The deployment project locks inputs hosted under private accounts, but the lock does not establish their visibility. A lock update requires VM checks. Do not solve access by giving candidate execution a general token. If private sources require preparation, settle that separately; local approval remains available.
3. **Signer authorization.** Add the deployment project to both the worker’s project configuration and the integrator’s signer list.
The DNS tests explicitly expect offline sandboxes, which supports the audit but does not replace it.
Pilot the-valley first. It has a nixpkgs input and VM checks exercising the same execution path. Enable the deployment project after these gates pass, without another valley implementation slice or promised calendar deadline. `flake.nix:4`, `policy/project/policy.cue:83`.
### Review and observation
**Adopt the UI cut.** Keep the existing review interface. Approval prints the checks reused from origin and those it will run locally. Missing evidence has no implied queue or running state.
Worker failures and execution progress stay in bounded local logs. Reuse existing check and integrator timing output. `attest/timing.go:46`, `integrator/timing.go:29`.
## Four slices
Each slice’s cited basis belongs in its claim-to-code checklist and change description, reverified before review.
1. **Restrict worker signers to projects.**
Touch `integrator/` classification, flags and signer publication, plus `nix/valley-host.nix`.
**Implemented basis:** verification and replacement of refused notes already exist (`integrator/evidence.go:125`, `integrator/evidence.go:78`).
**Acceptance:** the same worker note is accepted in an allowed project and classified unknown elsewhere; malformed configured lists fail closed; publication follows list changes.
2. **Fetch coverage and run only missing checks.**
Touch `status/` coverage and signer reading, `bin/valley`, and focused CLI checks. Leave derivation and `attest run` unchanged.
**Implemented basis:** normal fetch lacks an evidence refspec; approval runs all requirements (`bin/valley:956`, `bin/valley:1689`).
**Acceptance:** complete coverage needs no key or Nix execution; partial coverage runs exactly the remainder; origin failures and occupied local refs are diagnosed; approval protections remain intact.
3. **Poll ready changes and publish evidence.**
Add a worker script, package wiring, and focused tests.
**Implemented basis:** pending inventory, structured requirements, and local attestation storage exist (`status/pending.go:79`, `status/checks.go:94`, `attest/run.go:201`).
**Acceptance:** evidence precedes approval; concurrent invocations serialize; failed batches back off; lost replies reuse the local ref; superseded heads may finish harmlessly.
4. **Deploy the capped pilot.**
Add a disabled service/timer module and the valley host’s deployment configuration.
**Deployment basis:** KVM and existing VM tests are declared above.
**Acceptance:** the-valley’s complete required batch succeeds under the cap, secret-access probes fail, and exhaustion leaves host services healthy. The deployment project follows through the three configuration gates.
## Deferred pieces
| Piece | Add it when |
|---|---|
| Scheduler, leases, and second-worker overflow | Measured queue delay justifies another worker. The second worker remains opt-in, on mains, idle five minutes, with a local pause. |
| Evidence-only endpoint | Ordinary Git transport authority is too broad. |
| New statement addresses and selection rules | Same-signer additions, fresh observations, or independent partial publication are needed. |
| Prepared-result storage and cross-tree client reuse | Rebase churn materially wastes work. |
| Trusted check definitions | Candidate-controlled assertions cease to be acceptable. |
| Per-check signer restrictions | Projects need different trust for different checks. |
| Outer VM isolation | The audited Nix sandbox boundary is insufficient. |
| Rich review progress | Approval output and local journals no longer suffice. |
## Open questions
- **Do the deployment project’s pinned inputs fetch without credentials?** Recommend testing this before enabling it; retain local fallback until resolved.
- **Does its largest required batch fit 8 GiB under normal host load?** Recommend measuring peak aggregate memory and exhaustion behavior without raising the initial cap.
- **Which deployed keys serve worker and local attestation?** Recommend distinct registered identities, with project restrictions installed before worker activation.
## Risks
A compromised worker can lie within an authorized project. Candidate-controlled assertions remain an accepted review responsibility.
Shared-daemon limits do not contain evaluator, daemon, kernel, or KVM exploits. Private source confidentiality needs explicit treatment before granting fetch access.
Batch failure delays all evidence in that batch. Same-signer partial histories still encounter bd-7b7d58f.
Worker and local fallback can duplicate computation if approval begins before publication. Target movement can invalidate evidence after it was checked.
Signer-list changes alone do not invalidate existing decision memos. Published configuration can also lag deployment; the integrator’s current configuration remains authoritative.
## Changes from revision 1
Adopt review findings 1, 2, 4, 6, 7, and 8: updated citations, explicit evidence fetching, configuration-only rollout to the deployment project, existing `valley-go checks`, fewer operational records, simpler output, and an explicit stricter coverage test.
Adopt finding 3’s project-level restriction and collection/memo cuts. Qualify it by letting coverage read the published restriction list.
Adopt finding 5’s local fallback. Qualify its collision claim: separate worker and local signers avoid each other’s refs, while existing same-signer collisions remain.