gvisor demos: implementation plan
Co-Authored-By: Astra (gpt-6-astra) via codex
1 file changed,
+518
−0
docs/superpowers/plans/2026-11-08-gvisor-demos.md+518 −0
CI passed — run details
Intent
diff --git a/docs/superpowers/plans/2026-11-08-gvisor-demos.md b/docs/superpowers/plans/2026-11-08-gvisor-demos.md| new file mode 100644 |
| index 000000000..3aa4bce7f |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-08-gvisor-demos.md |
| @@ -0,0 +1,518 @@ |
| +# gVisor demos Implementation Plan |
| + |
| +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| + |
| +**Goal:** Run anonymous demo applications and their offline builds under pinned gVisor, with an operator-visible sandbox status and a dev-box witness. |
| + |
| +**Architecture:** Root selects the unit family, writes a derived OCI bundle, and verifies systemd's effective properties before starting runsc. The agent retains root's returned unit identity; the existing original-run start fence orders starts, stops and bundle removal. A binary-awareness floor and an activation-baseline check prevent an aware installation from reverting to native execution while gVisor is required. |
| + |
| +**Tech Stack:** Go, Linux systemd/cgroup v2, OCI JSON, runsc `release-20261102.0` with systrap, existing release.Store and signed platform releases. Use standard-library typed OCI structs for the small supported subset; add no container daemon or runtime-spec dependency. |
| + |
| +**Spec:** `docs/superpowers/specs/2026-11-08-gvisor-demos-design.md`, rev 5, FINAL. Read §§15–18 as dispositions of the older findings, not alternative requirements. |
| + |
| +## Global Constraints |
| + |
| +- `CARLOS_EXEC_SANDBOX=auto|systemd|gvisor`; unset means `auto`. This build has `auto` → systemd everywhere behind one constant. The flagship follow-up flip is outside this plan. |
| +- Demo boxes only; no networked gVisor instances, rootfs apps, tty/cmd/seed/sidecar/worker/gen roles, host claims, checkpoint/restore, or KVM. Effective gVisor never falls back to native execution. |
| +- `GVisorOverhead = 32 MiB`; logical size stays `small` (256 MiB), with CPUWeight=50, CPUQuota=50%, IOWeight=50. Physical run memory is 301989888 bytes; MemoryHigh=271790892, MemorySwapMax=301989888, TasksMax=320 (native template 256 + 64). Guest GOMEMLIMIT=241591905 bytes. |
| +- BuildWindow and RuntimeMaxSec stay 180 seconds. Build physical memory is 1107296256 bytes, MemoryHigh=996566625, TasksMax=192 (128 + 64); retain build MemorySwapMax=0. Guest GOMEMLIMIT=966367638 bytes, based on the logical 1 GiB build budget. The warm starter witness must finish in less than 60 seconds. |
| +- Root reads no launch JSON, source file, database or WAL to construct a run bundle. Preserve validated staged executable preparation, unprivileged launch parsing, agent-read/root-streamed snapshots, and the unchanged advisory exit-record schema. |
| +- Bundles: `/run/carlos-control/oci/<id>`; empty rootfs: `/var/lib/carlos/oci-rootfs`, root:root 0755; runtime state: `/run/carlos-runsc`, owned and cleaned by workload units. Root controller never opens or removes runtime state. |
| +- Keep SystemPointer unchanged. Pin both `linux-arm64` and `linux-amd64`; objects are `bootstrap/runsc/<sha256>/runsc-<plat>` (for example suffix `runsc-linux-arm64`). Assets are optional on historical releases and file uploads. |
| +- Keep all common signatures portable. `unix`, Linux stat fields, cgroup/mount syscalls and privileged runner bodies belong in `_linux.go`; provide matching `!linux` refusal stubs wherever common code calls them. CGO_ENABLED=0 throughout. |
| +- This is one implementation branch and one eventual squash merge, not a sequence of separately deployed scaffolding branches. Its first merge includes working status, demo execution and builds. Dev switch-on is this branch's witness; flagship changes wait for the go-live owners. |
| +- All implementation commits use the per-task gate below. Full suites run once at the final gate, not during this planning session or in an iteration loop. Do not change shared caches; scratch and logs go under `~/.cache/gvisor-demos/`, with an explicit inventory and cleanup. |
| +- Production/shared-account changes outside the designated root-runner sandbox need scoped approval. Release/version/window need Paul's quoted go via the design session, manager `8a3d302`, and #421's single release window. Planning authorizes none of those operations. |
| + |
| +## Review Focus |
| + |
| +- A valid start response with a missing, wrong-host or wrong-family unit name must fail closed and run fenced cleanup; it must not create a guessed handle (Task 5, `TestSandboxStartResponseBinding`). |
| +- An accepted request delayed until after `/stop`, or a duplicate concurrent start, must not run after proof or replace a live bundle (Tasks 5–6, `TestGVisorStopOvertakesAcceptedStart`, `TestGVisorConcurrentStart`). |
| +- A dangling link at any activation-baseline path counts as present; permission errors must block readiness rather than imply absence (Task 3, `TestExecSandboxBaselinePresence`). |
| +- A failed build from the previous mode must be stopped before its overlay or bundle is removed, including when worker initialization itself is blocked (Task 7, `TestGVisorBuildRecoveryBothFamilies`). |
| +- A replaced runsc inode, changed pin, or stale probe result must invalidate readiness; diagnostics must not report a previously tested runtime as ready (Tasks 3, 6, `TestRunscIdentityCache`, `TestGVisorProbePinChange`). |
| + |
| +--- |
| + |
| +## File Structure |
| + |
| +| Files | Responsibility | |
| +|---|---| |
| +| `internal/execsandbox/{mode,limits,lock,paths,protocol,oci,hardening}.go`, `runsc.lock.json` | Portable mode/types, physical limits, embedded lock, bundle path, retained marker, typed OCI schema and measured hardening contract | |
| +| `internal/execsandbox/{file_linux,file_other}.go` | Checked opens, file identity, marker/runtime verification; unsupported-platform refusal | |
| +| `internal/instancectl/{sandbox,ocibundle,gvisorunit,gvisorprobe,sandboxstop}.go` | Root family policy, run/probe bundle construction, verification, readiness and fenced cleanup | |
| +| `internal/demobuild/gvisor.go`, existing worker/unit/runner/probe files | Build bundle, family-aware execution, resource budgets and recovery | |
| +| `internal/instanceexec/{sandbox,sandbox_linux,sandbox_other,probe_gvisor,probe_gvisor_linux,probe_gvisor_other}.go` | Guest launch mode, root-owned exit-hook output and guest probe | |
| +| `internal/host/{execsandbox,runscensure,execsandboxfloor}.go` and platform helpers | Startup wiring, runtime installation, recovery/apply floor and baseline | |
| +| Four new `internal/host/units/*gvisor*.service` / `carlos-runsc.service` files | Templates specified in Task 3; root-selected per-instance drop-ins supply pin and ID | |
| +| Existing instancectl client/names/dispatch, activator control/backend/unitproc/swap, host layout/size paths | Identity plumbing, launch gates, stop-then-start updates, physical-limit readers | |
| +| Existing status snapshot, console API projection and CLI layout structs/rendering | Additive box and instance sandbox reports | |
| +| `cmd/runsc-assets/main.go`, `internal/publicrelease/runsc.go`, console mirror helper | Cut-time checksum verification and optional asset mirroring | |
| +| `internal/host/gvisor_*_rootrunner_linux_test.go` | Privileged witnesses, compiled only with `linux && rootrunner` | |
| +| `docs/superpowers/runbooks/gvisor-demos.md` | Internal operator rule, aware-first rollout, witness and rollback | |
| +| Census overlay, chain and proposal card | Reviewed cumulative root-source change, finalized in Task 11 | |
| + |
| +Tests live beside each implementation file with `_test.go`. Existing file:line references below refer to base `55495b36`; new files have no base line. Do not move unrelated code to match this table. |
| + |
| +## Gates and review budget |
| + |
| +For every task: write the named failing tests, observe the intended failure, implement, then run its targeted command and this gate from the repository root: |
| + |
| +```sh |
| +go build ./... |
| +go vet ./... |
| +gofmt -l . |
| +CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o "$HOME/.cache/gvisor-demos/carlos-darwin" . |
| +CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o "$HOME/.cache/gvisor-demos/carlos-windows.exe" . |
| +CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o "$HOME/.cache/gvisor-demos/carlos-linux-arm64" . |
| +``` |
| + |
| +Expect all commands to exit 0 and gofmt to print nothing. Run the precise test regex specified by each task with `-count=1`. Update every interface caller and fake in the same task; a signature migration must never leave the next task responsible for restoring compilation. Set TMPDIR to a task-owned directory below `~/.cache/gvisor-demos/` for commands that create scratch, including census and runner commands. Leave GOCACHE/GOMODCACHE/GOTMPDIR at their defaults. |
| + |
| +Census is not deferred permission to have red commits: when a task changes in-scope bytes, run `make census-card`, update cumulative CLAIMS at `~/.cache/gvisor-demos/claims.tsv`, and refresh the single `gvisor-demos` proposal overlay/chain/card before its gate. Include those generated files in that task's explicit staging list. Task 11 re-proposes the final diff, obtains the independent per-unit/envelope verdict and records it on #280. Run `TestPlan14RootReadCensus`, `TestCensusScopeIsTheRootBinary`, `TestCensusRebaseCarriesDispositions` and `TestPlan14RootInputInventoryCoverage` after each refresh. Do not describe an unapproved intermediate commit as merge-ready. |
| + |
| +Review classes below mean **Opus per-task** for root, security, termination, cache or production-storage changes, and **branch-only** otherwise. No review agent is dispatched by this document-writing task. Implementation reviewer briefs use `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`; a Codex-authored root change gets an Opus/Fable reviewer from the other family. Whole-branch review remains required. |
| + |
| +Carry this history in every brief: design R1 5 P1/5 P2; R2 3 P1/4 P2 and repeated-family stop; Paul's A–D ruling; R3 2 P1/2 P2; authorized narrow R4 1 P1; Paul's accepted refusal cut closes design rev 5. **There is no fifth design round.** Implementation review concerns conformance and new implementation defects. Stop at the first round with no P1; apply P2s without another round; list P3s as follow-ups. A fourth implementation review round needs Paul's go. Two successive findings against the same invariant trigger the three-way refusal/cut/enforce-once choice; renaming a task or changing reviewers does not reset the count. |
| + |
| +### Task 1: Define the portable contract and refuse incomplete gVisor starts |
| + |
| +**Review class:** Opus per-task — launch configuration and binary capability contract. |
| + |
| +**Files:** |
| +- Create: `internal/execsandbox/mode.go`, `limits.go`, `paths.go`, `lock.go`, `runsc.lock.json`, and corresponding tests. |
| +- Modify: `internal/instancectl/server.go:267`, `internal/instancectl/demo_build.go:100`, `internal/host/claimstop_run.go:23`, `internal/host/agent.go:499`, `internal/host/claimunit.go:31`. |
| +- Create: `internal/instancectl/sandbox.go`, `internal/host/execsandbox.go` and tests. |
| +- Read: `internal/cgroup/cgroup.go:94`, `internal/cgroup/sizes.go:17`, `internal/demobuild/runner.go:24`. |
| + |
| +**Interfaces:** |
| +- Produces `type Configured string` with `Auto="auto"`, `Systemd="systemd"`, `GVisor="gvisor"`; `type Effective string` with `EffectiveSystemd`, `EffectiveGVisor`; `type Family string` with `FamilySystemd`, `FamilyGVisor`. |
| +- Produces `Parse(getenv func(string) string) (Configured, error)`, `Resolve(configured Configured, demoBox bool) Effective`, `const AutoDemoGVisor = false`. A private `resolve(configured Configured, demoBox, autoDemoGVisor bool) Effective` permits tests of the future behavior without changing the shipped constant. |
| +- Produces `const GVisorOverhead int64 = 32 << 20`, `const GVisorTaskOverhead int64 = 64`, `Physical(tier cgroup.Limit) cgroup.Limit`, `PhysicalTasks(native int64) int64`, `GuestMemoryLimit(tier cgroup.Limit) int64` (cgroup.HighOf on logical memory: integer division by 10, then multiplication by 9). Physical adds memory only: cgroup.Limit has no task/CPU fields. Callers apply it only for FamilyGVisor, once. |
| +- Produces `BundleDir(id string) string`, `ValidID(id string) bool`; IDs match `[A-Za-z0-9][A-Za-z0-9_.-]{0,254}`, never slashes, backslashes, percent, whitespace or traversal. Invalid IDs yield an empty BundleDir and are refused by callers. |
| +- Produces `type RunscLock struct { Release string; Platforms map[string]RunscPin }`, `type RunscPin struct { TarballURL, TarballSHA512, SHA256 string }`, `LoadRunscLock() (RunscLock,error)`, `RunscFor(platform string) (RunscPin,error)`, `RunscPath(pin RunscPin) string`, `RunscObjectKey(platform string, pin RunscPin) string`. JSON keys: `release`, `platforms`, `tarball_url`, `tarball_sha512`, `sha256`. |
| +- Produces `type Launch struct { Nested, Demo, ThroughRoot bool; Role, Runtime string; Generation uint64 }`, `AgentLaunchAllowed(effective Effective, launch Launch) error`. Only nested binary demo run, generation 0, ThroughRoot=true is allowed in gVisor; direct calls set ThroughRoot=false. |
| +- Produces host `execSandboxConfig(getenv func(string) string) (execsandbox.Configured, execsandbox.Effective, error)` and fixed `Server.SandboxConfigured`, `Server.SandboxEffective`, `Server.SandboxConfigErr`, `Server.SandboxReady func(context.Context) error`. Initial admission only enforces this for gVisor; systemd remains operational. Config errors are enforced independently of that mode check. Missing gVisor readiness callback refuses admission; it never denotes native compatibility. |
| + |
| +- [ ] **Step 1: Write failing contract tests.** `TestParseExecSandbox`: unset/auto/systemd/gvisor accepted, whitespace/case/unknown refused with `EXEC-SANDBOX-CONFIG`. `TestResolveExecSandbox`: shipped auto returns systemd for either box; private helper with true flips only demo auto. `TestPhysicalLimits`: small→301989888, build→1107296256; logical inputs unchanged; tasks 256→320 and 128→192; shares from small stay 50/50/50. `TestBundleDir`: `run-demo.example` maps to `/run/carlos-control/oci/run-demo.example`; invalid IDs return empty. `TestAgentLaunchAllowed`: table covers every role/layout/rootfs/gen/direct combination with zero allowed direct spawns in gVisor. |
| +- [ ] **Step 2: Run** `go test ./internal/execsandbox ./internal/instancectl ./internal/host -run 'Test(ParseExecSandbox|ResolveExecSandbox|PhysicalLimits|BundleDir|AgentLaunchAllowed|SandboxIncompleteAdmission)' -count=1`; expect undefined interfaces or assertion failures. |
| +- [ ] **Step 3: Implement the contract and startup refusal.** Resolve root and agent once, retain errors for readiness/status and log the agent configuration error once. Add admission ahead of all process-start dispatches and demo-build admission; a missing SandboxReady in gVisor returns `EXEC-SANDBOX-RUNSC`, never runs a native probe/build/instance. Preserve stop/reset/sweep endpoints. Refactor the existing early fatal demo+host-claims check in RunInstanceControl/runWithClaim so a gVisor CLAIMS refusal serves cleanup without constructing or enabling the claim launch assembly. Invalid config blocks every start, including non-demo boxes. Inject host.env into control on ordinary boxes too; do not rely on claim/demo-only EnvironmentFile rendering. Later tasks fill the callback, not a new operator switch. |
| +- [ ] **Step 4: Freeze the lock from actual artifacts.** Fetch the immutable `release-20261102.0` tarballs and their upstream SHA512 files, mapping linux-arm64→aarch64 and linux-amd64→x86_64, into task scratch. Verify archive SHA512, extract only the regular `runsc` member, calculate binary SHA256, and write literal lowercase digests into the embedded lock. Never invent or leave placeholder digests, use `latest`, or copy a digest from another architecture. `TestRunscLock` rejects duplicate/missing platform keys, non-HTTPS or non-release-scoped URLs, wrong digest lengths, unknown fields and trailing JSON. Record both verified upstream source URLs in the task review evidence. No downloads execute as root. |
| +- [ ] **Step 5: Run the targeted tests and common gate; refresh census and commit.** Stage only this task's files and cumulative census outputs. Subject: `gvisor demos: define sandbox contract and fail-closed admission`. |
| + |
| +### Task 2: Run the real trampoline and measure host-unit hardening |
| + |
| +**Review class:** Opus per-task — guest security, exit hook and privileged runner. |
| + |
| +**Files:** |
| +- Modify: `internal/instanceexec/exec.go:43`, `internal/instanceexec/init_linux.go:60`, `internal/instanceexec/exit.go:29`, `internal/instanceexec/probe.go:116`. |
| +- Create: `internal/instanceexec/sandbox.go`, `sandbox_linux.go`, `sandbox_other.go`, tests; `internal/execsandbox/hardening.go` and tests. |
| +- Create: `internal/host/gvisor_hardening_rootrunner_linux_test.go`, `internal/host/gvisor_fixture_rootrunner_linux_test.go`. |
| +- Create: `internal/host/units/carlos-instance-gvisor@.service`, `carlos-instance-gvisor-probe.service`, `carlos-demo-build-gvisor@.service`, using the exact skeletons printed in Task 3 and this task's measured hardening block. Bootstrap wiring comes in Task 3. |
| +- Read: `internal/instancefs/instancefs_linux.go:20`, `internal/host/units/carlos-instance@.service:14`, `internal/host/units/carlos-demo-build@.service:7`. |
| + |
| +**Interfaces:** |
| +- Produces `execCommand.sandbox execsandbox.Effective`, `gvisorInit(argv0 string, argv, env []string) error`; add `--sandbox=gvisor` before positional arguments. Native flag omission keeps scopedInit. GVisor only accepts binary run without a claim reservation or generation suffix. |
| +- Produces `writeExitRecordOwned(runDir string, role instancectl.Role, inst string, env func(string) string, now time.Time, uid, gid int) error`; native wrapper preserves its signature. A gVisor host hook uses safe O_EXCL open, fchown on that descriptor, 0600, then writes unchanged ExitRecord JSON. |
| +- Produces `execsandbox.GVisorHardening() map[string]string` and `GVisorHardeningLines() string`, returning copies of one pinned, deterministic directive set. Verifiers consume this set, with explicit systemctl normalization mappings in tests. |
| +- Produces self-contained runner fixture `newGVisorFixture(t *testing.T) *gvisorFixture` and rootrunner-only applet dispatch to the real instanceexec RunExec/RunExit/RunProbe functions. It uses the running test executable as the platform trampoline; do not require an untransferred local CLI binary on the remote instance. This early fixture constructs OCI JSON locally in the test from fixed paths; it does not consume Task 4 code or claim to verify the production bundle writer. Task 9 replaces that fixture construction with the completed production path. |
| + |
| +- [ ] **Step 1: Write failing trampoline tests.** `TestGVisorLaunchValidation` preserves all launch/host/executable/openat2 checks and refuses combined rootfs/claim/unsupported roles. `TestGVisorGuestMemoryLimit` supplies hostile duplicate launch GOMEMLIMIT entries and requires one final root-supplied value, 241591905; read the trusted value from the trampoline's initial environment before parsing launch JSON. `TestGVisorExitRecordOwned` asserts carlos uid/gid, 0600, O_EXCL/no symlink following, native-equivalent JSON and advisory failure semantics. No kind field. |
| +- [ ] **Step 2: Run** `go test ./internal/instanceexec -run 'TestGVisor(LaunchValidation|GuestMemoryLimit|ExitRecordOwned)' -count=1`; observe failure, then implement the guest mode. Use existing runInit/runInitChecked with a no-op abstract-scope callback only in gVisor; keep subreaper, fork/setsid, signal forwarding and reaping unchanged. Non-Linux execution returns unsupported. The exit hook's new ownership syscall is Linux-specific. |
| +- [ ] **Step 3: Add `TestRootGVisorHardening` and `TestRootGVisorTrampoline`.** Use real launch JSON, the production safe opens and actual guest init. Assert serving over the host Unix socket, correct carlos uid/gid, no guest capabilities, no-new-privileges, and both openat2 traversal refusals and successful permitted opens. Bound every wait. Missing root/systemd/cgroup-v2 prerequisites fail, never skip. |
| +- [ ] **Step 4: Measure and pin host hardening before writing verifiers.** Begin with the Task 3 unit skeleton and candidate lines below. Exercise run, probe and compiler-shaped processes. Record effective systemctl values and pass/failure evidence per candidate. The selected set must pass on the runner; remove an incompatible candidate only with this task's Opus-reviewed explanation and retain the guest isolation checks. Pin the resulting literal set in hardening.go. Later tasks may not silently omit a pinned property. If runsc or the real trampoline cannot satisfy the guest contract, stop this implementation at the refusal; do not weaken safe opens. |
| + |
| +```ini |
| +ProtectSystem=strict |
| +ProtectHome=yes |
| +PrivateTmp=yes |
| +ProtectKernelTunables=yes |
| +ProtectKernelModules=yes |
| +ProtectKernelLogs=yes |
| +ProtectClock=yes |
| +ProtectHostname=yes |
| +ProtectControlGroups=yes |
| +LockPersonality=yes |
| +RestrictRealtime=yes |
| +SystemCallArchitectures=native |
| +``` |
| + |
| +These are measurement candidates, not claimed passing results. Do not copy native `PrivatePIDs`, `PrivateDevices`, `RestrictNamespaces`, empty CapabilityBoundingSet, MemoryDenyWriteExecute, native syscall filters, or `/run`/`/var` tmpfs overlays. The kernel work needed by root runsc is distinct from the guest's zero capabilities. Exact host hardening is this task's measured output, consumed as a block by all three workload templates. |
| + |
| +- [ ] **Step 5: Run the two exact root tests through the contract's script.** All runner files begin `//go:build linux && rootrunner`. Use one serial invocation with `--pkg ./internal/host --run '^(TestRootGVisorHardening|TestRootGVisorTrampoline)$'`. The fixture fetches only pinned runsc artifacts as an explicitly declared network exception; hash before execution. It creates exclusive fixture paths/units and refuses pre-existing production paths, cleans only its own users/mounts/units, and never binds an IP listener off loopback. Runner details and scope are under Task 9. |
| +- [ ] **Step 6: Run ordinary tests and common gate, review the measured set, refresh census and commit.** Subject: `gvisor demos: establish guest and host hardening contract`. Record runner run ID and results; pending is not a pass. |
| + |
| +### Task 3: Install the runtime and enforce the aware recovery baseline |
| + |
| +**Review class:** Opus per-task — root installation, executable floor and recovery. |
| + |
| +**Files:** |
| +- Create: `internal/execsandbox/protocol.go`, `file_linux.go`, `file_other.go`, tests; `internal/host/runscensure.go`, `execsandboxfloor.go`, tests. |
| +- Consume/install: the three workload unit files created in Task 2. Create: `internal/host/units/carlos-runsc.service`. |
| +- Modify: `main.go:23`, `system.go:56`, `system.go:79`, `internal/host/bootstrap.go:408`, `internal/host/systemunits.go:36`, `internal/host/systemapply.go:589`, `internal/host/systemapply.go:1884`, `internal/host/systemapply.go:2349`. |
| +- Modify: `internal/host/units/carlos-system-recover.service:41`, `internal/host/units/carlos-instance-control.service:18`, `internal/host/claimunit.go:114`. |
| +- Read: `internal/host/systemapply.go:180`, `internal/host/systemstate.go:29`, `internal/host/rootmovesfloor_boot.go:83`. |
| + |
| +**Interfaces:** |
| +- Consumes Task 1 pin/path/mode functions and Task 2 hardening output. |
| +- Produces `const Protocol = 1`, package-level `ProtocolMarker []byte` containing exactly `CARLOS-EXEC-SANDBOX-PROTOCOL:1\n`; main references it with `runtime.KeepAlive`. Construct the reader prefix from separate pieces so the full marker prefix is not accidentally embedded twice. |
| +- Produces `ScanProtocol(r io.Reader,size int64) (int,error)` for bounded byte parsing, `ReadProtocol(path string) (int,error)`, `AllowsBinary(effective Effective,path string) error`, `type RunscVerifier struct` with `Verify(path string,pin RunscPin) error`. Linux implementation uses no-follow open and fstat; other platforms refuse. Protocol cap is 96 MiB (existing systemArtifactLimit), read in 64 KiB chunks with boundary overlap, exactly one prefix occurrence, nonempty decimal protocol terminated by newline, no overflow. Absent marker means protocol 0; malformed/duplicate marker is an error; awareness is protocol >=1. |
| +- Produces host `RunSystemRunscEnsure(args []string)`, `ensureRunsc(ctx context.Context, getenv func(string) string, store release.Store, systemctl func(context.Context,...string)(string,error)) error`, `RunSystemExecSandboxAllowsPrev(args []string)`, `checkExecSandboxBaseline(optDir,unitDir string,recovery []byte) error`. |
| +- Produces `Server.SandboxBaseline func() error`, wired in host to the exact embedded recovery bytes, and a runsc verification callback. Add host `verifiedSandboxCandidate(src io.Reader,wantSHA string,effective execsandbox.Effective) ([]byte,error)` for the pre-staging check. Keep host's embedded units out of instancectl's import graph. |
| + |
| +- [ ] **Step 1: Write floor/installer tests.** `TestExecSandboxFloor` requires unaware target/prev rejection in gVisor and allowance in systemd, malformed setting refusal and no staged unit/journal/binary mutation on rejection. `TestExecSandboxBaselinePresence` table-tests journal plus guard executable, census.json and guard/moves as files, directories, symlinks and dangling links; all present/error cases block with `EXEC-SANDBOX-BASELINE` and path. Test installed recovery bytes differing by one byte. `TestRunscEnsure` covers no-op systemd, absent/bad hash/owner/mode/link count, target pin changes, interrupted temp write, same-version retry and refusal without installation on bad download. `TestRunscIdentityCache` tests dev/inode/size/mtime changes and repeated metadata validation even on a cached hash. |
| +- [ ] **Step 2: Run** `go test ./internal/execsandbox ./internal/host -run 'Test(ExecSandbox|Runsc)' -count=1`; expect failure; implement checked opens and installer. Reuse system-update's store opening and bounded fetching, with a 96 MiB runsc binary cap. Existing runsc requires root-owned 0755, single-link regular file and matching SHA256; validate root-owned ancestors, never follow an attacker-created link. Write an exclusive temp in the pin directory, fsync file, chmod 0755, rename, fsync directory. Cache hashes only on verified identity. Retry the oneshot from Ready with 2,4,8,16,30-second capped backoff and no concurrent retries. |
| +- [ ] **Step 3: Integrate floor before mutable staging and every restore.** Read the candidate once into a buffer bounded by systemArtifactLimit, verify its SHA256 against the signed pointer, then ScanProtocol over that same buffer before stageCandidate clears/creates staging or executes `version`; write precisely those verified bytes to staging and recheck the root-owned staged target with ReadProtocol. Do not hash, rewind and rescan a mutable agent cache file. Check `.prev` before rollback/recovery restoreFiles too. Systemd mode does not require awareness. Result is `refused: exec-sandbox floor`. This closes aware updater paths without changing pointers or introducing a native-unit fence. Baseline uses Lstat absence checks on each Ready; journal absence is not cached. Never alter guard-exec: any retained guard/trigger configuration is refused by Paul's cut. |
| +- [ ] **Step 4: Install these exact template skeletons, appending Task 2's pinned hardening block to each of the first three.** Empty ExecStart makes an unprepared template unstartable. Root writes the exact command drop-in below before use. No pin placeholders remain in an installed command. |
| + |
| +`carlos-instance-gvisor@.service`: |
| + |
| +```ini |
| +[Unit] |
| +Description=carlos gVisor demo instance %I |
| +BindsTo=carlos-edge.service |
| +Requires=data-instances.mount run-carlos-instances.mount run-carlos-logs.mount |
| +After=carlos-edge.service data-instances.mount run-carlos-instances.mount run-carlos-logs.mount |
| +[Service] |
| +Type=exec |
| +User=root |
| +Group=root |
| +Slice=carlos-instances-%i.slice |
| +ExecStart= |
| +Restart=no |
| +KillMode=mixed |
| +TimeoutStopSec=20 |
| +SuccessExitStatus=129 130 141 143 |
| +StandardOutput=file:/run/carlos/logs/%I.run.sock |
| +StandardError=inherit |
| +RuntimeDirectory=carlos-runsc |
| +RuntimeDirectoryMode=0700 |
| +RuntimeDirectoryPreserve=yes |
| +ReadWritePaths=/run/carlos-runsc /data/instances/%I /run/carlos/instances/%I |
| +TasksMax=320 |
| +OOMScoreAdjust=500 |
| +OOMPolicy=kill |
| +``` |
| + |
| +`carlos-instance-gvisor-probe.service`: |
| + |
| +```ini |
| +[Unit] |
| +Description=carlos gVisor instance probe |
| +Requires=data-instances.mount run-carlos-instances.mount |
| +After=data-instances.mount run-carlos-instances.mount |
| +[Service] |
| +Type=exec |
| +User=root |
| +Group=root |
| +Slice=carlos-instances.slice |
| +ExecStart= |
| +Restart=no |
| +KillMode=mixed |
| +RuntimeMaxSec=30 |
| +TimeoutStopSec=20 |
| +StandardOutput=truncate:/run/carlos-control/gvisor-probe.out |
| +StandardError=journal |
| +RuntimeDirectory=carlos-runsc |
| +RuntimeDirectoryMode=0700 |
| +RuntimeDirectoryPreserve=yes |
| +ReadWritePaths=/run/carlos-runsc /data/instances/_probe /run/carlos/instances/_probe |
| +MemoryMax=301989888 |
| +MemoryHigh=271790892 |
| +MemorySwapMax=301989888 |
| +TasksMax=320 |
| +CPUQuota=50% |
| +CPUWeight=50 |
| +IOWeight=50 |
| +OOMPolicy=kill |
| +``` |
| + |
| +`carlos-demo-build-gvisor@.service`: |
| + |
| +```ini |
| +[Unit] |
| +Description=carlos gVisor offline demo build |
| +BindsTo=carlos-instance-control.service |
| +After=carlos-instance-control.service |
| +[Service] |
| +Type=exec |
| +RemainAfterExit=yes |
| +User=root |
| +Group=root |
| +Slice=carlos-demo-builds.slice |
| +ExecStart= |
| +Restart=no |
| +KillMode=control-group |
| +RuntimeMaxSec=180 |
| +TimeoutStopSec=5 |
| +SendSIGKILL=yes |
| +OOMPolicy=kill |
| +MemoryMax=1107296256 |
| +MemoryHigh=996566625 |
| +MemorySwapMax=0 |
| +TasksMax=192 |
| +CPUQuota=50% |
| +CPUWeight=10 |
| +LimitFSIZE=33554432 |
| +UMask=0077 |
| +StandardInput=null |
| +StandardOutput=null |
| +StandardError=null |
| +RuntimeDirectory=carlos-runsc |
| +RuntimeDirectoryMode=0700 |
| +RuntimeDirectoryPreserve=yes |
| +ReadWritePaths=/run/carlos-runsc |
| +``` |
| + |
| +Build's per-job drop-in adds only its `work/out`, `work/tmp`, `work/home`, and mounted `work/cache` to ReadWritePaths; diagnostics are opened by systemd before the namespace. No `/work` host bind is needed: OCI mounts individual directories. |
| + |
| +`carlos-runsc.service` (no extra measured block): |
| + |
| +```ini |
| +[Unit] |
| +Description=carlos pinned runsc installation |
| +Before=carlos-instance-control.service |
| +[Service] |
| +Type=oneshot |
| +User=root |
| +Group=root |
| +ExecStart=/opt/carlos/carlos system runsc-ensure |
| +EnvironmentFile=-/etc/carlos/host.env |
| +TimeoutStartSec=120 |
| +ProtectSystem=strict |
| +ReadWritePaths=/opt/carlos/runsc |
| +ProtectHome=yes |
| +PrivateDevices=yes |
| +NoNewPrivileges=yes |
| +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 |
| +UMask=0077 |
| +``` |
| + |
| +The installer itself reopens root-owned host.env with existing host-env parsing; it does not trust inherited values as its authority. No RemainAfterExit and no writable temp directory outside `/opt/carlos/runsc`. |
| + |
| +The control dependency edit is two systemd directives (one logical dependency change): add `Wants=carlos-runsc.service` and append `carlos-runsc.service` to its existing mount `After=` line. Wants rather than Requires keeps control reachable for refusals and cleanup if installation fails. Always render `EnvironmentFile=-/etc/carlos/host.env` once in control. |
| + |
| +Recovery is exactly one changed ExecStart line: insert ` && /opt/carlos/carlos system exec-sandbox-allows-prev /opt/carlos/carlos.prev` immediately before the second branch's `; then exec /opt/carlos/carlos.prev system apply --recover`. Preserve all other bytes of the shell expression. `TestExecSandboxRecoveryUnit` asserts that insertion and the absence of percent/dollar characters; it tests a gate execution failure as well as nonzero exit. The first guard branch is unchanged and excluded by baseline. |
| + |
| +Command drop-in for a run uses `pinPath=RunscPath(pin)`, `iid=provision.InstanceID(host)`, `id="run-"+iid`, `bundle=BundleDir(id)`: |
| + |
| +```ini |
| +[Service] |
| +ExecStartPre= |
| +ExecStartPre=-<pinPath> --root=/run/carlos-runsc delete -force <id> |
| +ExecStart= |
| +ExecStart=<pinPath> --root=/run/carlos-runsc --ignore-cgroups --network=none --host-uds=create run --bundle <bundle> <id> |
| +ExecStopPost= |
| +ExecStopPost=/opt/carlos/carlos instance-exit --sandbox=gvisor run %I |
| +ExecStopPost=-<pinPath> --root=/run/carlos-runsc delete -force <id> |
| +``` |
| + |
| +Angle-bracket words here are renderer substitutions, never shell expansion. The minus on delete tolerates an already-absent runtime; acceptance checks must still prove state cleanup, and failures cannot make a live ID reusable. Probe uses id `probe`, same command shape, and no instance-exit hook. Build uses id `build-<hex-job>_<attempt>`, same run/delete shape and no instance-exit hook. Assert the locked runtime's systrap default in Task 2, matching the spec's exact argv; do not introduce a configurable platform. |
| + |
| +- [ ] **Step 5: Wire installation and awareness tests.** Bootstrap/apply create rootfs 0755 and `/opt/carlos/runsc` root-owned 0755; controller never creates rootfs. Add templates to bootstrap and missing-unit repair, keeping them unarmed until an explicit start. `TestRunscGarbageCollection` removes an old pin only after complete loaded-unit/job/installed-command inventory proves no ExecStart names it; enumeration failure retains it. Never prune a pin still referenced by a prepared drop-in or active sandbox. `TestExecSandboxProtocolReleaseBuild` uses ScanProtocol on actual `make build GOOS=linux GOARCH=arm64` and amd64 outputs with `-s -w`, and the last published release fixture (unaware), plus duplicate/chunk-boundary/oversize cases. Ordinary tests separately cover ReadProtocol's owner/link/symlink refusals; Task 9 exercises successful ReadProtocol on root-owned installed bytes. Non-root local builds are not passed off as root-owned files. Preserve any pre-existing `carlos` output; use task-owned copies and remove only generated outputs. |
| +- [ ] **Step 6: Run targeted tests/common gate, review, refresh census and commit.** Subject: `gvisor demos: install pinned runtime and guard recovery`. |
| + |
| +### Task 4: Derive OCI bundles without tenant-controlled root reads |
| + |
| +**Review class:** Opus per-task — root mount and executable authority. |
| + |
| +**Files:** |
| +- Create: `internal/execsandbox/oci.go`, `internal/instancectl/ocibundle.go`, and tests. |
| +- Read/modify as needed: `internal/instancectl/hardening.go:56`, `internal/instancectl/stagedexe.go:105`, `internal/instancectl/gen.go:44`, `internal/instancectl/names.go:148`. |
| + |
| +**Interfaces:** |
| +- Produces portable OCI types `Spec`, `Process`, `User`, `Root`, `Mount`, `Linux`, `Namespace`, `Capabilities`, `Rlimit` in execsandbox. Fields are exactly the supported OCI 1.0.2 JSON subset: process args/env/cwd/user/capabilities/noNewPrivileges/rlimits, root path/readonly, mounts, linux namespaces. Unsupported hooks/devices/host namespaces are not represented. |
| +- Produces `(s *Server) gvisorBundle(host string, role Role, gen uint64) ([]byte,error)`, `(s *Server) writeGVisorBundle(host string,role Role,gen uint64) (id string,raw []byte,err error)`, `GVisorUnitName(host string) string`, `GVisorID(host string,role Role,gen uint64) (string,error)`. |
| +- Private `roleProbe Role="probe"` is for root's own call; never add it to ParseRole. Run requires gen=0. Probe uses host `_probe` only through that private path, id `probe`, and the same constructor. No generation unit is created. |
| +- Produces `execsandbox.WriteBundle(id string, raw []byte) error` and `ReadBundle(id string) ([]byte,error)` with checked root-owned no-follow directories, 0700 bundle directory, 0600 config.json, bounded 64 KiB bytes and read-after-write equality. Common code calls Linux file helpers; non-Linux refuses. |
| + |
| +- [ ] **Step 1: Write `TestGVisorBundle`, `TestGVisorBundleExecutable` and `TestGVisorBundleAuthority`.** Assert deterministic bytes with fixed root inputs; changing tenant launch/source/database bytes changes no bundle byte and invokes no root read of those files. Assert regular resolved app target from ensureHostExeAt/validateStagedExe, correct ro app/live bindings for live and staged original-run starts, and refusal of changed/unvalidated staged targets. Assert malformed host/role/gen never creates a path. Test symlink bundle/config/ancestors and readback mismatch refusal. |
| +- [ ] **Step 2: Run** `go test ./internal/instancectl ./internal/execsandbox -run 'TestGVisorBundle|TestBundle' -count=1`; expect failure, then implement deterministic JSON (struct fields, ordered slices; no map iteration in serialized output). |
| +- [ ] **Step 3: Set the exact guest contract.** Resolve carlos numeric uid/gid from root-owned passwd. Run argv is `[/opt/carlos/carlos,instance-exec,--sandbox=gvisor,run,<iid>]`; cwd `/data/instances/<iid>`; initial environment includes only root-selected trampoline settings and `GOMEMLIMIT=241591905`. No guest capability in any set; noNewPrivileges=true; root.path `/var/lib/carlos/oci-rootfs`, readonly=true. Native inherited rlimits are retained, with the observed native NOFILE soft/hard pair captured by Task 2 and represented explicitly if runsc's defaults differ. |
| +- [ ] **Step 4: Encode the complete mount inventory.** `/proc` type proc; `/dev` tmpfs with runsc's standard minimal null/zero/full/random/urandom/tty devices; `/dev/pts` devpts with newinstance,ptmxmode=0666,mode=0620; `/dev/shm` tmpfs mode=1777; `/tmp` tmpfs mode=1777,nosuid,nodev; `/opt/carlos/carlos`, resolved `/opt/carlos/app` and prepared `/opt/carlos/live` ro bind mounts; only own data/run directories rw bind-mounted at native paths. Use private PID/IPC/UTS/mount/network OCI namespaces, no host namespace paths, no `/sys`. Probe changes process argv to `instance-probe --sandbox=gvisor` and uses `_probe` data/run mounts; root's nonce challenge is process env, never an extra host mount. Assert canonical mount order and flags. Reader/verifier rebuild from the same constructor. |
| +- [ ] **Step 5: Run targeted tests/common gate, review, refresh census and commit.** Subject: `gvisor demos: derive and verify sandbox bundles`. |
| + |
| +### Task 5: Carry root-selected identity and keep cleanup under the start fence |
| + |
| +**Review class:** Opus per-task — termination and no agent-side native launch. |
| + |
| +**Files:** |
| +- Modify: `internal/instancectl/names.go:645`, `internal/instancectl/client.go:161`, `internal/instancectl/client.go:322`, `internal/instancectl/client.go:419`, `internal/instancectl/server.go:1047`, `internal/instancectl/legacystart.go:74`. |
| +- Create: `internal/instancectl/sandboxstop.go`, `sandboxstop_test.go`. |
| +- Modify: `internal/activator/control.go:18`, `internal/activator/backend_exec.go:2092`, `internal/activator/backend_exec.go:2292`, `internal/activator/backend_exec.go:2351`, `internal/activator/backend_exec.go:2823`, `internal/activator/backend_exec.go:2932`, `internal/activator/genbackend.go:274`, `internal/activator/unitproc.go:140`, `internal/activator/unitproc.go:295`, `internal/activator/maintenance.go:415`, `internal/activator/swap.go:393`. |
| +- Create: `internal/activator/sandbox_test.go`, `sandbox_spawn_guard_test.go`; update existing control fakes in `backend_legacy_test.go`, `containment_test.go`, `identity_test.go` and all compiler-identified implementers in this commit. |
| + |
| +**Interfaces:** |
| +- Extend `StartResponse` with `Unit string json:"unit,omitempty"`, `Sandbox execsandbox.Effective json:"sandbox,omitempty"`; keep InvocationID. Add Sandbox to ProbeReport and SeedResponse, and fill it in every start response including one-shot/rootfs native responses. Produce portable `execsandbox.State` with `Configured Configured`, `Effective Effective`, `RunscVersion, RunscSHA256 string`, `Ready bool`, `Blocked string`, with snake_case JSON tags; add `ProbeReport.ExecSandbox *execsandbox.State json:"exec_sandbox,omitempty"`. |
| +- Change `Client.Start`, `StartExe`, `StartGen`, `StartGenExe`, `StartSidecarExe`, Cmd/CmdExe, TTY/TTYExe and rootfs start methods from `(string,error)` to `(StartResponse,error)` in one atomic migration. Seed keeps SeedResponse with additive Unit/Sandbox. Change corresponding Control/GenControl/StagedExeControl/RootfsControl/TTYControl and test fakes together. No string-return compatibility wrapper that guesses unit identity. |
| +- Keep public Ready/ReadyDemo signatures `(context.Context) error`; Client stores immutable expected effective mode and an internal `readyReport(ctx,path,requireDemo) (ProbeReport,error)`. Missing/unequal root mode is `EXEC-SANDBOX-MISMATCH`, retaining the existing build-header comparison. Add `Client.SandboxStatus(ctx context.Context) (execsandbox.State,error)` which preserves a decoded not-ready report on HTTP 503 and supplies the root state to host reporting; transport failure marks it unavailable, never ready. |
| +- Change `newUnitProcFor(..., started instancectl.StartResponse, ...)` in place of `inv string`; retain `unit`, `invocation` and new `sandbox` on unitProc. Add `UnitIdentity() (string,execsandbox.Effective)` to that concrete handle; optional interface access for status. |
| +- Produces `(s *Server) stopRunFamilies(ctx context.Context, host string) error`, invoked **inside** existing fenceLegacyStarts from `/stop`, plus safe bundle cleanup only after proof. `/stop` input stays host/role, never an agent-supplied unit string. |
| + |
| +- [ ] **Step 1: Write identity/fence tests.** `TestSandboxStartResponseBinding` rejects empty/wrong family/wrong host/malformed unit fields and proves uncertain cleanup invoked before lease release. `TestGVisorStopLostResponse` drops a successful gVisor start response and proves original-run `/stop` finds it. `TestGVisorStopOvertakesAcceptedStart` pauses before beginLegacyStart registration, lets stop capture connSeq watermark, then resumes; require zero submissions. `TestGVisorStopJoinsStart` covers preparation and last-before-submit cancellation; `TestGVisorStopProofFailure` retains bundle/lease if either family is active, has a queued job, ControlPID, nonempty cgroup, or unreadable proof. |
| +- [ ] **Step 2: Run** `go test ./internal/instancectl ./internal/activator -run 'Test(SandboxStartResponseBinding|GVisorStop|AgentSandbox|SandboxSpawnGuard)' -count=1`; expect failure, then migrate responses and callers. Server returns the actual selected unit even in native mode. Stops on a retained handle dispatch by its retained identity's parsed kind; original-run cleanup still asks root to fence and stop both siblings. Observation, cgroup reads, exit attribution, reset and finalization use that retained name, never the route to reconstruct its sandbox family. |
| +- [ ] **Step 3: Extend the existing fence, not a second lock.** Under /stop's host fence, cancel/join original-run starts, derive both original unit names, stop every loaded one, prove invocation inactive/no jobs/empty cgroup and completed stop-post, then remove only that host's bundle before releasing the fence. All start bundle work remains an attempt covered by beginLegacyStart. Add a per-host admission bit under legacyMu to reject a second in-flight gVisor original start; retain existing watermark and join semantics. Do not touch markGenStarting for native generations. Discovery and cleanup remain available with invalid config, claims refusal, missing runtime or changed mode. |
| +- [ ] **Step 4: Gate every direct agent launch.** At ExecBackend.Start and direct entries startChildAt, spawnChildFrom, Seed/SeedExe/seedChild, StartGenExe, sidecar, cmd and tty launch paths, build Launch from actual layout/route/role and call AgentLaunchAllowed before spawning. The primitive spawnInCgroupGated/strict.Start/StartChild sites also refuse gVisor direct work. Config errors remain a separate earlier refusal. `TestAgentSandboxNoNativeSpawn` drives each path with fake spawners and requires calls==0. `TestSandboxSpawnGuard` uses Go AST and an explicit call-site inventory to reject any new exec.Cmd Start/Run/Output/CombinedOutput, StartChild*, strict Start or direct spawn wrapper without a gate; include a fixture showing a renamed/aliased new spawn fails the scan. Treat systemctl control subprocesses as explicit reviewed exemptions, not tenant spawns. |
| +- [ ] **Step 5: Force stop-then-start updates.** Route gVisor demo updates through the existing non-overlap update path for every CARLOS_SWAP value. Both agent staged-generation entry and root gen admission refuse. Test `TestGVisorSwapUsesOriginalRun`: stop proof precedes new bundle/start, generation stays zero, retained identity changes only after successful start. Do not call swapOverlap or invent gVisor generations. |
| +- [ ] **Step 6: Run targeted tests/common gate, review, refresh census and commit.** Subject: `gvisor demos: retain unit identity and fence both families`. |
| + |
| +### Task 6: Select, verify and probe the gVisor run family |
| + |
| +**Review class:** Opus per-task — root launch, readiness and resource enforcement. |
| + |
| +**Files:** |
| +- Create: `internal/instancectl/gvisorunit.go`, `gvisorprobe.go`, tests; `internal/instanceexec/probe_gvisor.go`, `probe_gvisor_linux.go`, `probe_gvisor_other.go`, tests. |
| +- Modify: `internal/instancectl/sandbox.go` (Task 1), `server.go:718`, `server.go:774`, `server.go:835`, `server.go:964`, `server.go:994`, `server.go:1128`, `server.go:1421`, `demo_policy.go:47`, `names.go:148`. |
| +- Modify: `internal/instancectl/gen.go:85`, `gen.go:316`, `gen.go:488`, `gen.go:555`, `cmd.go:71`, `rootfs.go:573`, `rootfs.go:1271`, `claimunit.go:200`, `egress.go:496`, `demo_cleanup.go:177`, `demo_claim.go:70`. |
| +- Modify: `internal/host/demo_policy.go:33`, `internal/host/claimstop_run.go:23`; test the dispatch inventory below. |
| + |
| +**Interfaces:** |
| +- Produces `(s *Server) unitFamily(effective execsandbox.Effective, role Role, route *registry.Route) (execsandbox.Family,error)`. Private roles `roleGen`, `roleProbe`, `roleBuild` are root-internal and rejected by ParseRole. All public starts pass the validated registry route; only root probe/build calls permit nil route with DemoBox=true. HostClaims is a fixed Server flag from hostwrite.Enabled. |
| +- Produces `(s *Server) assertGVisorUnit(ctx context.Context,host,unit string) error`, `(s *Server) gvisorReady(ctx context.Context) error`, `(s *Server) runGVisorProbe(ctx context.Context) ProbeReport`, `(s *Server) assertSandboxDrain(ctx context.Context) error`. |
| +- Produces `demoSizeShown(out string,family execsandbox.Family) error`; existing demoCgroup(host,unit) derives family from the validated unit. Add `sliceTierFor(..., logical cgroup.Limit,family execsandbox.Family) error`; retain native sliceTier wrapper for existing claim callers. |
| + |
| +- [ ] **Step 1: Write policy/readback tests.** `TestGVisorFamilyPolicy` covers every refusal code: CONFIG, UNSUPPORTED (non-demo box/route), ROOTFS, CLAIMS, ROLE (including gen), RUNSC, BASELINE, DRAIN, OVERLAP and MISMATCH. `TestGVisorUnitMutations` independently mutates every expected property, runsc pin/path/argv, drop-in reload state, bundle byte and parent/kernel limit; each refuses before start. `TestGVisorConcurrentStart` interleaves two starts and a stop around bundle write/readback; at most one submission, no live bundle replacement. `TestGVisorLimits` requires both parent and child physical memory/high/swap/tasks and logical CPU/IO values. |
| +- [ ] **Step 2: Run** `go test ./internal/instancectl ./internal/instanceexec -run 'TestGVisor(Family|Unit|Concurrent|Limits|Probe|Drain|Dispatch)' -count=1`; expect failure, then implement root selection. Build/probe use this same selector via a callback; demobuild never duplicates policy or imports instancectl. In systemd mode preserve each existing native/rootfs dispatch. In gVisor mode assert the baseline and verified pin on every Ready/ReadyDemo request and before any probe or start; refuse unsupported roles before preparing their files. Check no active unit/nonempty cgroup/queued start of either family for the host before bundle preparation. Recheck the attempt context immediately before systemctl submission. |
| +- [ ] **Step 3: Write the run drop-in and verify its effective state.** Use Task 3 command recipe, Task 4 exact BundleDir, physical limits and pinned hardening. Read User=root, Group=root, Type=exec, Slice, KillMode, restart/stop dependencies, stop timeout, ordered pre/start/post commands, pin path, all hardening properties and NeedDaemonReload=no from systemctl; compare structured command arguments, not substrings. Rebuild and compare bundle bytes. Read parent and child memory.max/high/swap.max, pids.max, cpu.max/weight and io.weight. Native demo.conf is never applied to gVisor units. Probe uses the same bundle writer and verifier with its own fixed slice/limits/output contract. |
| +- [ ] **Step 4: Implement the guest probe and root proof.** `TestGVisorProbeChecks` has one failing case per check: numeric carlos uid/gid; CapEff=0; NoNewPrivs=1; locked runsc's gVisor uname/proc-version signature; io_uring_setup=ENOSYS; only loopback; public TCP connect refused; root-created abstract socket unreachable; root fixture outside mounts absent; guest Unix socket created in host-visible run dir and dialled by root. Use a named check token per assertion in ProbeReport. Challenge nonce and socket names are root-derived. Root verifies actual runsc/gofer/Sentry/helper PIDs belong to the unit subtree while running, then waits for stop-post and empty cgroup. `TestGVisorProbePinChange` invalidates a pass when pin/verified identity changes; failed probe blocks starts and records a bounded journal diagnostic. ReadyDemo requires this pass. Do not run native or rootfs probes as a fallback. |
| +- [ ] **Step 5: Make all discovery family-aware.** `TestGVisorDispatchInventory` drives every row below with fake systemctl; no native start/restart in gVisor. `TestGVisorDrain` proves active/opposite-family/nonempty/queued units block Ready and stop endpoints still work; drain succeeds after proven cleanup. Cleanup of stale bundles uses the same original-run fence. Runtime-state cleanup goes through the owning unit's delete hook; controller never traverses `/run/carlos-runsc`. Retained pin-specific drop-ins are kept until cleanup finishes, then removed and daemon-reloaded. |
| + |
| +| Boundary | Required treatment | |
| +|---|---| |
| +| Main and sidecar, server.go:835 | unitFamily before dispatch; only demo run permitted | |
| +| Gen name/drop-in/start/stop, gen.go:85,316,488 | refuse gVisor roleGen before drop-in; continue discovering/stopping old native generations | |
| +| Seed and retry, server.go:964,994 | refuse at both boundaries; never native retry | |
| +| Cmd/tty, cmd.go:71 | role refusal before any start/pty work | |
| +| Rootfs roles/probe, rootfs.go:573,1271 | explicit ROOTFS refusal, no native probe workaround | |
| +| Native probe, server.go:1421 | choose root-private probe family before dispatch | |
| +| Host claims, claimunit.go:200 | CLAIMS readiness/start refusal; cleanup remains usable | |
| +| Egress restart, egress.go:496 | never restart native siblings under gVisor; unsupported route refuses | |
| +| Build naming/recovery, demobuild/unit.go:39,389 | Task 7 consumes selector result; recovery visits both families | |
| +| Freeze/purge, demo_cleanup.go:177 | fenced stop/prove both families and complete runtime delete before DB streaming | |
| +| Sweep/jobs/leftovers, server.go:1128,1147; gen.go:555 | parse both families and queued jobs independent of mode; preserve native generation cleanup | |
| +| Original reset and /parent, server.go:1097,774 | reset both original siblings; physical parent writes in gVisor, logical tier validation unchanged | |
| + |
| +- [ ] **Step 6: Run targeted tests/common gate, review, refresh census and commit.** Subject: `gvisor demos: verify and launch offline demo sandboxes`. |
| + |
| +### Task 7: Build demos with the same family and physical budgets |
| + |
| +**Review class:** Opus per-task — root source handling, build cache and termination. |
| + |
| +**Files:** |
| +- Create: `internal/demobuild/gvisor.go`, `gvisor_test.go`. |
| +- Modify: `internal/demobuild/worker.go:54`, `unit.go:39`, `unit.go:100`, `unit.go:168`, `unit.go:210`, `unit.go:309`, `unit.go:349`, `unit.go:401`, `runner.go:33`, `probe.go:18`. |
| +- Modify: `internal/instancectl/demo_build.go:100`, `internal/instancectl/server.go:267`, `internal/host/claimunit.go:114` (claimUnitContent renders the aggregate build slice), `internal/host/demo_build_linux_test.go:1`. |
| +- Read: `internal/demobuild/job.go:23`, `worker.go:179`, `internal/console/demo_jobs.go:356` — deadline remains unchanged. |
| + |
| +**Interfaces:** |
| +- Produces `(w *Worker) gvisorBuildBundle(l buildLayout) ([]byte,error)`, using Task 4's OCI structs and shared WriteBundle/ReadBundle; `buildLayout` gains `family execsandbox.Family`, `id string`. Produce `layoutFor(root,dir string,family execsandbox.Family) (buildLayout,error)`; keep existing layout/layoutIn as native wrappers for compatibility, while all Worker execution uses layoutFor with its captured family and recovery explicitly constructs both. |
| +- Add `Worker.family execsandbox.Family`; change `NewWorker(getenv,proof)` to `NewWorker(getenv func(string)string,proof func(context.Context)error,family func()(execsandbox.Family,error)) (*Worker,error)` and all callers together. The supplied root callback invokes Task 6 unitFamily with roleBuild; worker captures its result once. Every build rechecks root proof before dispatch. |
| +- Produce `SlicePropertiesFor(slots int,family execsandbox.Family) map[string]int64`; keep native SliceProperties wrapper. Add the resolved mode to claimUnitSettings and have claimUnitContent use SlicePropertiesFor for the installed build slice; validate its readback in Worker.assertBudget. Configured concurrency remains 1–4. Family-specific layout uses one existing validated hex-job/attempt key; never trust a supplied unit/bundle path. |
| +- Fixed guest build uid/gid = 65534/65534; root unit stays uid 0. No DynamicUser or guest host-passwd lookup for compilation. |
| + |
| +- [ ] **Step 1: Write `TestGVisorBuildBundle`, `TestGVisorBuildOwnership`, `TestGVisorBuildBudget`, `TestGVisorBuildRecoveryBothFamilies`, `TestGVisorBuildWindow`.** Require only intended guest mounts; directories out/tmp/home 65534:65534 0700; source/toolchain/backing dirs/lower files remain root-owned. Snapshot lower-layer file inode/bytes and upper-layer contents around ownership changes: no cache-file copy-up. For slots 1–4 assert parent MemoryMax=slots*1107296256, TasksMax=slots*192, CPUQuota=slots*50, swap=0. Assert signed deadline, transport, worker and unit all retain 180 seconds. Recovery stops both named families before any mount/bundle removal and retains work on failed proof. |
| +- [ ] **Step 2: Run** `go test ./internal/demobuild ./internal/instancectl ./internal/host -run 'TestGVisorBuild|TestDemoBuild' -count=1`; expect failure, then implement family-aware prepareUnit/runUnit/assertUnit/cleanUnit/recover. Write bundle after source extraction and overlay mount. Change ownership on only out/tmp/home and mounted cache **directories** (directory mode 0700 owned by build uid), never recursively chown files or cache backing trees. Individual guest mounts prevent traversal to backing directories. |
| +- [ ] **Step 3: Set guest process and mounts.** Argv is `/opt/carlos/demo-toolchain/bin/go build -mod=readonly -trimpath -buildvcs=false -o /work/out/app .`; cwd `/work/src`; environment exactly BuildEnvironment() plus GOMEMLIMIT=966367638. No inherited host env, loader variables or additional Go flags. OCI RLIMIT_FSIZE soft/hard=33554432, umask=0077. Toolchain including module cache and source are ro; `/work/out`, `/work/tmp`, `/work/home`, mounted `/work/cache` rw; guest proc/dev/tmp as Task 4, no host work root or backing dirs. Root-owned source archive parsing remains today's validated extraction, not a new launch-command source. |
| +- [ ] **Step 4: Verify unit/readback and recovery.** Build assertUnit consumes measured hardening and exact Task 3 command recipe; check Type=exec, RemainAfterExit, no DynamicUser, deadlines, limits, slice and byte-identical bundle. Recover enumerates both families for each validated job attempt regardless of current mode, proves both stopped/empty and runtime delete complete, then unmounts overlay/work and removes bundle. Initialization failure keeps the worker closed while cleanup can retry. Build readiness probe uses the selected family and the real warm toolchain cache; never retry a failed gVisor compilation natively. |
| +- [ ] **Step 5: Run targeted tests/common gate, review, refresh census and commit.** Subject: `gvisor demos: build offline demos in pinned sandboxes`. |
| + |
| +### Task 8: Report actual sandbox identity and logical size |
| + |
| +**Review class:** branch-only — additive reports and presentation; any new authority/read is separately classified at census. |
| + |
| +**Files:** |
| +- Modify: `internal/status/snapshot.go:279`, `internal/status/snapshot.go:300`, `internal/host/layoutleg.go:262`, `internal/host/sizestatus.go:67`, `internal/activator/size.go:120`, `internal/activator/unitproc.go:524`. |
| +- Modify: `internal/console/apistatuslayout.go:25`, `internal/console/apistatuslayout.go:82`, `internal/console/apistatuslayout.go:156`, `status_instances.go:163`, `status_instances.go:183` and tests. |
| +- Create: `internal/host/execsandboxstatus_test.go`; extend status snapshot/dry-run leak tests. |
| + |
| +**Interfaces:** |
| +- Add `type ExecSandbox struct { Configured string; Effective string; Runsc *RunscStatus; Ready bool; Blocked string }`, `type RunscStatus struct { Version string; SHA256 string }` in status with snake_case JSON tags. `LayoutReport.ExecSandbox *ExecSandbox json:"exec_sandbox,omitempty"`; `RowLayout.Sandbox string json:"sandbox,omitempty"`. |
| +- Add `Unit string`, `Sandbox execsandbox.Effective` to activator.SizeState, populated from retained unitProc under existing Service locking. Change `readSizeInForce(cgroupRoot,host,unit string,sandbox execsandbox.Effective) (cgroup.Size,bool)`; never reconstruct a gen name. Empty identity means unknown where a live nested unit is expected. |
| +- Add the corresponding fields to console API and CLI structs; no public fleet/private-metrics boundary changes. |
| + |
| +- [ ] **Step 1: Write `TestExecSandboxStatus`, `TestGVisorSizeInForce`, `TestGVisorExitAttribution`, `TestStatusLayoutSandbox`.** JSON round-trip covers configured/effective/pin/ready/blocked; old payload omits fields and displays unknown. GVisor unit memory.max=301989888 maps to small, native 268435456 maps to small, other/unreadable values remain unknown. Assert observed unit from handle wins over configured mode and route-derived native name. Exit text is exactly `exit status via gVisor`; do not attribute advisory records to app versus runtime. |
| +- [ ] **Step 2: Run** `go test ./internal/status ./internal/host ./internal/activator ./internal/console . -run 'Test(ExecSandboxStatus|GVisorSizeInForce|GVisorExitAttribution|StatusLayoutSandbox)' -count=1`; expect failure, then implement reporting and all projections. Match each logical tier against Physical(tier) only for retained gVisor family. Size/shares/billing remain logical; status reads no guest file. |
| +- [ ] **Step 3: Render one exec-sandbox line per box and a SANDBOX instance column.** Source Ready/Blocked and runtime identity from root's latest report, distinguishing missing/stale reports from false. A sleeping instance with no retained unit reports unknown, not the configured mode as an observed fact. Route new UI language through the required copy workflow at implementation time; this plan is an agent instruction, not approved shipping copy. Keep the switch and internal verbs out of public CLI documentation; no new user command is introduced. |
| +- [ ] **Step 4: Run targeted tests/common gate, refresh census and commit.** Subject: `gvisor demos: report sandbox and logical instance size`. |
| + |
| +### Task 9: Prove the integrated runtime on the root runner |
| + |
| +**Review class:** Opus per-task — privileged acceptance and termination evidence. |
| + |
| +**Files:** |
| +- Create: `internal/host/gvisor_lifecycle_rootrunner_linux_test.go`, `gvisor_probe_rootrunner_linux_test.go`, `gvisor_build_rootrunner_linux_test.go`, `gvisor_recovery_rootrunner_linux_test.go`, `gvisor_claim_rootrunner_linux_test.go`. |
| +- Extend: Task 2 `gvisor_fixture_rootrunner_linux_test.go` and `gvisor_hardening_rootrunner_linux_test.go`. |
| +- Read/call production boundaries: `internal/instancectl/server.go:835`, `internal/instancectl/demo_claim.go:70`, `internal/host/demo_claim_snapshot.go:20`, `internal/demobuild/worker.go:194`, `internal/host/systemapply.go:2116`. |
| + |
| +**Interfaces:** |
| +- Consumes the installed templates, real control server, actual instanceexec applets and real demobuild worker. Tests call exported production entry points; the fixture cannot replace the sandbox policy/verifier or termination proof with mocks. |
| +- Produces the exact root acceptance inventory below and a run report (run ID, tip SHA, names, timings, PASS/FAIL/pending), under task scratch and summarized on the implementation branch. |
| + |
| +- [ ] **Step 1: Implement the named witnesses and their assertions.** All new runner files have `//go:build linux && rootrunner`; each top-level test is independently runnable. Test-only applet dispatch calls production RunExec/RunExit/RunProbe and system recovery, with fixture roots fixed by the test. Record fixture seams explicitly: test launch/route ownership is fixture data; production sandbox, safe-open, real unit and cgroup paths are exercised. |
| + |
| +| Exact test name | Required assertion | |
| +|---|---| |
| +| `TestRootGVisorHardening` | Task 2 measured set works for run/probe/build under real systemd; every pinned property reads back | |
| +| `TestRootGVisorTrampoline` | Real launch JSON, safe opens, subreaper/fork/setsid/reaping; carlos process serves over host-visible socket | |
| +| `TestRootGVisorGracefulStop` | SIGTERM reaches guest app; app records graceful shutdown; stop-post writes carlos-owned advisory record and deletes runtime; cgroup empty before stop returns | |
| +| `TestRootGVisorKillRestart` | Commit and acknowledge SQLite rows over socket, kill unit main with SIGKILL, prove whole cgroup dead, restart same id, integrity_check=ok and zero acknowledged rows lost | |
| +| `TestRootGVisorOOM` | Guest memory overrun reaches physical cap, OOMPolicy kills entire runtime subtree; parent/child accounting and empty-cgroup proof hold | |
| +| `TestRootGVisorProbe` | Every §8 check passes on pin; independently break each uid/cap/NNP/kernel/io_uring/network/abstract/outside-file/host-UDS/cgroup-proof input and require that named check to block readiness | |
| +| `TestRootGVisorBuild` | Real pinned toolchain and warm cache build the same starter natively and under gVisor; output bytes/SHA256 equal, ELF accepted, gVisor elapsed <60s; ownership/copy-up rules and cleanup verified | |
| +| `TestRootGVisorRecoveryUnawarePrev` | Install exact embedded recovery unit, gvisor host.env, an unaware previous executable and interrupted aware journal; execute recovery unit and prove current binary handles recovery, unaware prev never executes and never restores native units | |
| +| `TestRootGVisorClaimSnapshot` | Run DB/WAL writes in guest, root freeze waits for stop-post and empty cgroup, then actual agent snapshot path opens DB/WAL and streams to root SnapshotDemo; snapshot integrity/content match acknowledged rows | |
| +| `TestRootGVisorModeDrain` | Both systemd→gvisor and reverse refuse with active opposite-family or populated cgroup; fenced cleanup remains usable; after drain and process restart report and actual next unit agree | |
| + |
| +For negative probe checks that the real runtime cannot deliberately produce (for example io_uring support), inject that single observation into the production check function while the remaining observations come from the running guest. Label those subcases check-function fault injection, not proof that gVisor can be reconfigured into that state. Real network/outside-file/abstract/UDS violations use disposable mutated bundles and must never be accepted for tenant starts. |
| + |
| +- [ ] **Step 2: Compile locally first.** `CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go test -c -tags rootrunner -o "$HOME/.cache/gvisor-demos/gvisor-rootrunner.test" ./internal/host`. Ordinary targeted regression tests and common gate must still pass; no rootrunner dependency leaks into normal CI or non-Linux builds. |
| +- [ ] **Step 3: Run serially, sandbox off, using the existing unmodified script.** Read `~/.cache/tmp/claude-1001/own/after236/root-runner-contract.md` in full before execution. Script: `~/.cache/tmp/claude-1001/own/after236/root-runner.py`. Scope: profile kass, account 640012953448, eu-west-1, throwaway t4g.small, runner's fixed subnet/security-group/SSM instance profile, 30 GiB gp3 deleted on termination. Do not edit runner/contract, create IAM, or use a real demo box. The contract authorizes this sandbox; it does not authorize the dev rollout. At most ten total invocations for this run, counting Task 2; one invocation at a time. Batch the exact names above into one anchored regex, never `TestRoot` or payload helper selectors. |
| + |
| +```sh |
| +python3 -u /home/paulca/.cache/tmp/claude-1001/own/after236/root-runner.py --worktree "$PWD" --pkg ./internal/host --run '^(TestRootGVisorHardening|TestRootGVisorTrampoline|TestRootGVisorGracefulStop|TestRootGVisorKillRestart|TestRootGVisorOOM|TestRootGVisorProbe|TestRootGVisorBuild|TestRootGVisorRecoveryUnawarePrev|TestRootGVisorClaimSnapshot|TestRootGVisorModeDrain)$' |
| +``` |
| + |
| +Fixture artifact downloads explicitly allow HTTPS reads of pinned runsc and the existing locked demo toolchain; no other external test traffic except IMDS and the bounded refused public-connect probe. Before the runner invocation, obtain the existing operator toolchain archive reference and verify it with demobuild.DefaultLock/CheckBundle; freeze its immutable read-only download URL and SHA256 as test-fixture inputs alongside the runsc pin. This is a fixture prerequisite, not a new toolchain distribution service. Include its prebuilt cache and re-run CheckBundle after remote extraction. Obtain artifacts inside the remote fixture because the runner transfers one test binary only. If that archive is not reachable within the stated read-only network exception, keep acceptance pending; do not widen the runner IAM or upload objects outside its contract. All locally started listeners bind 127.0.0.1 or Unix sockets. Record wall time; a 60-second warm-build failure keeps gVisor builds refused and returns §9 for a decision, never increases BuildWindow. Root recovery applet execution is real; an unaware sentinel fixture only records erroneous execution and does not claim to be an actual released binary. Task 3 separately tests the actual previous release's marker. |
| + |
| +- [ ] **Step 4: Check cleanup after every invocation and the final one.** Use the contract's read-only EC2 list for pending/running `purpose=plan14-root-runner`; terminate only an instance whose Name contains this invocation's printed run ID. Verify termination even after failure and remove only task-owned local scratch. Record failures as **Root-runner acceptance: pending**, with failure lines. Historical spike passes do not count for the current tip. |
| +- [ ] **Step 5: Review acceptance evidence, refresh census if fixture bytes are in scope, and commit.** Subject: `gvisor demos: prove sandbox lifecycle on the root runner`. Repeat this exact inventory on the merged SHA before release, within the recorded invocation budget; a budget exhausted before a pass is a stopping point, not permission to invent success. |
| + |
| +### Task 10: Prepare release assets, optional mirroring and the internal rollout |
| + |
| +**Review class:** Opus per-task — release supply and production-storage writer. Runbook prose itself receives branch review/copy workflow only. |
| + |
| +**Files:** |
| +- Create: `cmd/runsc-assets/main.go`, tests; `internal/publicrelease/runsc.go`, tests; `internal/console/runscmirror.go`, tests. |
| +- Modify: `internal/console/apisystemupdate.go:515`, `internal/publicrelease/feed.go:83`, `internal/publicrelease/feed.go:111`. |
| +- Create: `docs/superpowers/runbooks/gvisor-demos.md`. |
| +- Read: `internal/release/systempointer.go:21`, `Makefile:25`; no SystemPointer fields change. |
| + |
| +**Interfaces:** |
| +- Produces `publicrelease.RunscAssetName(platform string) string`, `Feed.OptionalAsset(ctx context.Context,tag,asset string,limit int64) (data []byte,sha string,present bool,err error)`, `(s *Server) mirrorRunscArtifact(ctx context.Context,platform string,data []byte,sha string) error`. |
| +- Cut helper interface: `go run ./cmd/runsc-assets -out <existing-cut-artifact-directory>`. It reads the embedded lock, verifies tarball SHA512 before extraction and binary SHA256 afterward, then writes only `runsc-linux-arm64` and `runsc-linux-amd64`, mode 0755. Output must be beneath the explicit cut directory; safe bounded extraction never follows archive links. |
| + |
| +- [ ] **Step 1: Write `TestRunscAssets`, `TestOptionalRunscAsset`, `TestRunscMirror`.** Reject wrong archive/binary hash, duplicate member/link/traversal/oversize archives. Optional absence is only absence from the **verified signed checksum list**; advertised-but-missing, wrong hash, bad signature and transport failure are errors. Test present and absent assets, historical release and --file upload, existing identical object, collision and CAS retry. Mirror uses asset SHA256 from signed sums, not the console's own compiled runsc pin, so an older aware console can mirror a newer target pin. |
| +- [ ] **Step 2: Run** `go test ./cmd/runsc-assets ./internal/publicrelease ./internal/console -run 'Test(RunscAssets|OptionalRunscAsset|RunscMirror)' -count=1`; expect failure, then implement. In runSystemUpdate's release branch, mirror available linux platform runsc assets before promotion. Content-addressed key and bytes must agree. File-upload branch is unchanged. No pointer field, unconditional historical download, or silent corruption skip. |
| +- [ ] **Step 3: Write the internal runbook through the repository's prose workflow.** State the operator rule prominently: set gvisor only after `carlos status --layout` already displays the exec-sandbox line. State that an unaware binary cannot enforce this setting, and that old-pointer bootstrap/reimage with a retained gvisor setting remains outside this build. Carry a bootstrap-script check as a follow-up on the branch; do not build it here or reopen the closed design. |
| +- [ ] **Step 4: Include the exact release/dev sequence.** Coordinate version/window with manager 8a3d302 and the quoted go; feed cut helper outputs into the existing release cut **before** SHA256SUMS.txt generation/signing and GitHub release attachment. Verify both assets appear in signed sums and match the lock. For a console too old to mirror them, the release agent copies the two verified objects to the dev bucket once within approved scope; document keys and verification, not credentials. Roll aware release with systemd mode first, wait for the apply journal to close and status line to appear, verify guard artifacts absent and recovery unit current, drain, then explicitly set gvisor in root-owned host.env and restart control and agent. Check Ready/probe/pin, box line and instance column, create/build/wake/claim and response version from the newly built release. Keep flagship out of scope. Rollback: set systemd, restart and drain/prove previous family gone, verify systemd status, then roll below the awareness floor if needed. Auto remains systemd; its follow-up change is not part of this release. |
| +- [ ] **Step 5: Record the scoped rollout approval requirement.** Before any dev domain/resource/host configuration mutation, present the actual account, region, box/domain, exact host.env/restart/release/object changes, permissions/traffic, duration/cost, cleanup and checks. Reuse any already granted matching scope. Do not confuse the designated runner scope with dev-box authorization. |
| +- [ ] **Step 6: Run targeted tests/common gate, review, refresh census and commit.** Subject: `gvisor demos: prepare runtime release assets and dev rollout`. |
| + |
| +### Task 11: Final census, whole-branch gate and merge handoff |
| + |
| +**Review class:** Opus/Fable independent census and whole-branch review; apply the existing round history and stopping budget. |
| + |
| +**Files:** |
| +- Regenerate: `internal/provision/testdata/plan14-root-reads-gvisor-demos.tsv`, `internal/provision/testdata/plan14-root-reads-chain.tsv`, `docs/superpowers/notes/census-proposal-gvisor-demos.md`. |
| +- Scratch: `~/.cache/gvisor-demos/claims.tsv`; use `make census-card` output as the exact changed-unit inventory. |
| +- Read: `AGENTS.md:299` (census section; find by heading if base moved), `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`. |
| + |
| +**Interfaces:** |
| +- Consumes the final diff, per-task reviews, cumulative proposal, acceptance results and runbook. Produces the final per-unit/envelope verdict and tested full commit SHA; no new runtime interface. |
| + |
| +- [ ] **Step 1: Check spec coverage and dispatch inventory against the actual diff.** Account for §§4–11 in Tasks 1–8/10, every §12 witness in Task 9, and §13 in Task 10. Verify the final tree has no gVisor generation template, native fallback, guard-exec modification, public switch documentation or auto flip. Newly changed security/root/termination/storage behavior introduced by P2 fixes still receives review inside the same budget. |
| +- [ ] **Step 2: Finalize the census proposal.** Run `make census-card`; write one `<file>:<unit><TAB><claim>` per changed unit in CLAIMS, naming added root reads. Run `make census-propose NAME=gvisor-demos CLAIMS="$HOME/.cache/gvisor-demos/claims.tsv"`. Reviewer reads the entire branch against amadan main, card and all units/envelopes, including runsc.lock.json, marker reader, bundles and embedded service bytes. Reviewer decides new/body/sites/reads/quiet/removed/left/envelope classes. No author self-approval or escalation of census classification to Paul. |
| +- [ ] **Step 3: Run the final local gate once.** `go build ./...`, `go vet ./...`, `go test ./... -count=1`, `gofmt -l .`, plus darwin/windows/linux-arm64 root compiles from the common gate. If a failure occurs, fix it, rerun the affected checks, and report exact unrun checks rather than looping the full suite. Check both root binary dependency closures with GOOS=linux GOARCH=amd64/arm64 for the census. Rootrunner-tagged tests remain separate and must have recorded current-tip evidence. |
| +- [ ] **Step 4: Obtain whole-branch and census verdicts.** Stop at the first no-P1 round, apply its P2s, keep P3 follow-ups on the branch. Record the independent census verdict, reviewer and full tip on #280. No fourth review or repeated-family third fix without the required decision. Describe the branch with final behavior, tests, runner run IDs and rollout gates. |
| +- [ ] **Step 5: Commit the final census changes with a short subject and real body newlines.** Push only during the authorized implementation session to the amadan remote, check CI green on the exact full tip, then use `amadan branch merge carlos/platform gvisor-demos -squash -expect <full-tip> -message <short-subject-and-body>`. Check main CI after merge; mirror only already-landed main to GitHub if needed. No GitHub PR/merge. This planning session stops at its one local plan commit and does not perform this step. |
| +- [ ] **Step 6: Complete the release/dev phase only in its approved window.** Re-run privileged acceptance on the merged SHA, then execute Task 10's authorized release/dev witness and retain the receipt. End this plan's implementation session at merge with an explicit release/dev handoff if the window is later; do not remain running while waiting for it. List actual remaining approval or acceptance work. Clean task-owned scratch/processes; leave no server or EC2 instance running. No automatic flagship switch-on. |