carlos / platform Public

demo-snapshot-unit-check

Prompts

Human

<paseo-system version="1" kind="agent-message" source-agent-id="39e7acfa-a56a-470b-8ef5-70de5c57a6f2" message-id="2663ba2c-829a-4665-97c3-69d741a852d5" source-agent-title="agent /start demo program controller"> From 39e7acfa: A, then B. Run the witness on the root runner now: a throwaway t4g.small in dev (kass), the existing root-runner pattern; my brief allows a small dev box for minutes. Terminate it at the end, confirm it&apos;s gone, and record the instance ID and its termination on #527. Hold the merge until the witness result, so any fault lands on the same branch (at most two more fault rounds, then stop and report). B follows naturally: after v0.34.12 reaches box-1, the claimAvailable check and your prepare.sh, with no live-demo conflict, are the real-box proof. </paseo-system>

Human

<task-notification> <task-id>bhd20pg5o</task-id> <tool-use-id>toolu_018FjWVwRSeDnqQcCAFPMrGN</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/22215d20-2b53-4378-8426-ae55e2362d13/tasks/bhd20pg5o.output</output-file> <status>completed</status> <summary>Background command "S=/home/paulca/.cache/tmp/dsuc; until [ -f $S/done ]; do sleep 20; done; tail -1 $S/log; cat $S/final.md" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>be99ltiuk</task-id> <tool-use-id>toolu_01Y28FPtpXYArBZqWxG9AfkH</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/22215d20-2b53-4378-8426-ae55e2362d13/tasks/be99ltiuk.output</output-file> <status>completed</status> <summary>Background command "cd /home/paulca/amadan.net/carlos/platform/.claude/worktrees/demo-snapshot-unit-check; git push origin demo-snapshot-unit-check 2&gt;&amp;1 | grep -- '-&gt;'; amadan task set 621 -status Done &gt;/dev/null; amadan task set 622 -status Started &gt;/dev/null; aws --profile kass --region eu-west-1 ec2 describe-instances --filters Name=tag:purpose,Values=plan14-root-runner Name=instance-state-name,Values=pending,running --query 'Reservations[].Instances[].InstanceId' --output text; S=/home/paulca/.cache/tmp/dsuc; timeout 1500 python3 -I $S/runner.py --worktree $PWD --pkg ./internal/instancectl --run '^TestDemoClaimSnapshotRuntimeDevWitness$' &gt; $S/witness1.log 2&gt;&amp;1; echo "rc=$?" &gt;&gt; $S/witness1.log; echo finished" completed (exit code 0)</summary> </task-notification>

Human

<paseo-system version="1" kind="agent-message" source-agent-id="39e7acfa-a56a-470b-8ef5-70de5c57a6f2" message-id="82c2c846-468c-4c94-897a-659253cfc30f" source-agent-title="agent /start demo program controller"> From 39e7acfa, FYI from the release agent&apos;s claimAvailable check (false, as expected). sophie and dennis are fully ready: seed + moved capabilities, protocol 2, floor v0.34.9, prev allowed v0.34.9. One extra line from demo box-1 for you to judge while you&apos;re in this code: its edges-file pass logs &quot;could not load box snapshots (fleetapi: list status/boxes/: unexpected status 404)&quot;. You said fleet boxes publish no edges file. Is this 404 harmless noise, or does anything on the claim path (moved delivery, readiness) need that list? Answer when the witness is done. If it&apos;s a fault, it joins the same branch. </paseo-system>

Human

<task-notification> <task-id>b6q95n1kw</task-id> <tool-use-id>toolu_01RRseQsdtvngYyswXQtMZCQ</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/22215d20-2b53-4378-8426-ae55e2362d13/tasks/b6q95n1kw.output</output-file> <status>completed</status> <summary>Background command "S=/home/paulca/.cache/tmp/dsuc; sleep 5; until [ -f $S/done ]; do sleep 20; done; tail -1 $S/log; cat $S/final.md" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>aac96ef463c16c2ab</task-id> <tool-use-id>toolu_0156RkwERCZnw9vzJEiLLk9c</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/22215d20-2b53-4378-8426-ae55e2362d13/tasks/aac96ef463c16c2ab.output</output-file> <status>completed</status> <summary>Agent "Review snapshot unit fix branch" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Review of `demo-snapshot-unit-check`, round 1 of 3: no P1 or P2, one P3.** Under stopping rule 1 the review stops here. The P3 goes on the branch's follow-up list and doesn't start a round. ## Finding **P3: `OpenWorkerSource` is wider than it needs to be** (`internal/democlaim/source_linux.go:37`) - **Fault family:** only the unprivileged worker may use the weaker open. - **Problem:** it is exported, but its only production caller is in the same package (`worker.go:41`). It accepts any absolute `dir` and follows symlinks in that path's earlier components. `TestWorkerSourceDoesNotUseOpenat2` only checks that the worker doesn't use `Openat2`, not that root or the agent stay away from the weak open. - **Failure scenario:** none today. A later root or agent caller could compile against it, and only the census card would catch that. - **Fix:** rename it to `openWorkerSource`, update `source_other.go` and the claims file, and rerun `census-propose`. It doesn't need to block this merge. ## Your checks **(a) Reachability: holds.** - `OpenWorkerSource` is called only from `RunSnapshotWorkerIn`, after the `Geteuid() == 0` refusal (`worker.go:21`). - That function's production path is `main.go:43` → `RunSnapshotWorker` → the fixed `/work`. Other `RunSnapshotWorkerIn` callers are tests. - Root (`demo_snapshot.go:448`) and the agent (`demo_claim_snapshot.go:30`) keep `OpenSource`, with the same directory open and openat2 flags, and no ENOSYS fallback. - `openFile` is set only at `source_linux.go:62`, and nothing else builds a `democlaim.Source`. - `ExportSQLite` (`snapshot.go:46`) is a third `OpenSource` caller your brief didn't list. Only tests call it, so it isn't a production path. **(b) Equivalence: holds in production.** - The old `openDir` refused symlinks at every component of `dir`; the new open protects only the last. For `/work` the only earlier component is `/`, which is read-only to a dynamic UID under `ProtectSystem=strict`. - The real host directory sits under a root-only `0700` parent. Before the worker starts, `/work` holds only files root created, and the worker is the only other user. - For one validated name with `O_NOFOLLOW`, `RESOLVE_BENEATH` and the no-symlink flags add nothing. - The regular-file, `nlink == 1`, size and `VerifyUnchanged` checks are shared code. - A FIFO opens without blocking under `O_NONBLOCK`, then fstat refuses it. The tests cover this. **(c) Root's read of helper-written files: unchanged.** The `result` function isn't in the diff. The `realWorker` witness also ran it against a worker-owned WAL (the log shows `64301`). **(d) Blocked syscalls: I found none on the paths the run didn't reach.** | Path | Status | |---|---| | `ftruncate`, `unlink`, shm and `-wal` creation | Live evidence: the WAL's owner changed from root to `64301`, and `-shm` exists | | No-WAL case | Root always writes a `-wal` file, 0 bytes when there is no WAL. `checkWALBounds` returns early, so nothing new is called. Not witnessed live | | Truly absent WAL | Reached only in unit tests | | Trimmed reused WAL | Only `ReadAt` and `Truncate`, the same calls as the witnessed run | | Over-limit or failure | Only `os.Remove` then exit, and `unlink` is already witnessed. Not witnessed live | | Large `integrity_check` temp files | Ordinary create and unlink under `TMPDIR=/work`. Not witnessed live | These unwitnessed paths use only the filter's permitted calls, so they don't need another runner pass. The agent's `OpenSource` also still works under its unit: `carlos-edge.service` deliberately omits `RestrictSUIDSGID`. **(e) `checkUnit`: nothing else weakened.** - The only diff is moving one key out of the want-map and adding the `!= ""` check at `demo_snapshot_disk.go:155`. It is still requested, and non-empty is still refused. - An omitted or empty value is accepted. Any other omitted key still fails closed. - `p.initialize` runs the real `checkUnit` against the installed template at the start of the witness, so the fix was also exercised live and not only through the fixture. **(f) Witness helper and fixture: safe.** - The helper is in a `_test.go` file and gated by `CARLOS_SNAPSHOT_WITNESS_HELPER`, which no non-test Go code mentions. - `checkUnit`'s exact `Environment` match would also refuse that variable. - The fixture is byte-identical to `systemctl-show.txt`. It holds only unit properties, fixed paths and the all-`A` id, with no secret, tenant or account. ## Census verdicts The card is `docs/superpowers/notes/census-proposal-demo-snapshot-unit-check.md`. I compared against `origin/main`, which was `7bab9473` locally; I didn't fetch. I reviewed as Opus. Astra wrote every census unit; Claude's commit `b8ad2fac` only touches a test file. | Unit or envelope | Verdict | Basis | |---|---|---| | `worker.go` `RunSnapshotWorkerIn` | APPROVED | One line at `:41`; root refusal and fixed names intact | | `demo_snapshot_disk.go` `checkUnit` | APPROVED | `:135` and `:155`; no new read, and only the omitted case is newly accepted | | `source_linux.go` `Source.open` | APPROVED | `:95` uses the opener chosen at construction; checks at `:99-106` unchanged; root still gets openat2 | | new `OpenSource` | APPROVED | `:26-32`; same directory open and flags as before; `legacy` disposition is correct | | new `OpenWorkerSource` | APPROVED | `:37-45`; reachable only by the non-root worker | | new `openWorkerFile` | APPROVED | `:47-52`; single validated component, worker only | | envelope `internal/democlaim` | APPROVED | `openSource` moved code unchanged; `source_other.go` is only stubs | | envelope `internal/instancectl` | APPROVED | Only `checkUnit` changed outside tests | Root gains no new open, run, query or follow, and no check root relies on is weakened. ## What I ran **Passed or clean:** - `go test ./internal/democlaim`, the whole package. - `TestDemoSnapshotCheckUnitSystemd257` and `TestDemoClaimSnapshotEffectiveUnit` in `internal/instancectl`. - `TestPlan14RootReadCensus`. - `make census-card`, which reports clean with seal `1e83ce23…`, matching the card. - `go vet` of `internal/democlaim` for darwin. **Blocked by the sandbox:** the Go cache at `~/.cache/go-build` is read-only here. `TestCensusRebaseProof*` fails with `read-only file system` when it builds its fixture module. I only viewed the first 30 lines of that output, so I can't vouch for the rest of `TestCensus*` from this run. Astra's report has that set passing at the tip, and CI will rerun it. **Other limits:** - `go vet` of `internal/instancectl` for darwin and windows fails on `hardening_test.go:137`, a file this branch doesn't touch. - I didn't rerun the `internal/host` tests or the wider `TestDemoClaimSnapshot` set; I relied on Astra's report for those. I made no edits or git changes. You still need to record these verdicts on #280, because this review was read-only. ## Verdicts for tip `53940194` - **Code: READY** - **Census: APPROVED**</result> <usage><subagent_tokens>131746</subagent_tokens><tool_uses>14</tool_uses><duration_ms>314728</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>biim6pm6n</task-id> <tool-use-id>toolu_01HxtV15fWhLkfp1bZW11oQA</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/22215d20-2b53-4378-8426-ae55e2362d13/tasks/biim6pm6n.output</output-file> <status>completed</status> <summary>Background command "sleep 60; until ! amadan ci status carlos/platform -branch demo-snapshot-unit-check 2&gt;&amp;1 | head -1 | grep -q 'running\|queued\|pending'; do sleep 60; done; amadan ci status carlos/platform -branch demo-snapshot-unit-check 2&gt;&amp;1 | head -3" completed (exit code 0)</summary> </task-notification>