gvisor demos: design builder-check round 2 findings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+116
−0
docs/superpowers/reviews/CODEX-FINDINGS-gvisor-demos-design-R2.md+116 −0
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-gvisor-demos-design-R2.md b/docs/superpowers/reviews/CODEX-FINDINGS-gvisor-demos-design-R2.md| new file mode 100644 |
| index 000000000..df0d927c0 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-FINDINGS-gvisor-demos-design-R2.md |
| @@ -0,0 +1,116 @@ |
| +R1-1 — **Resolved:** §6.3 preserves the prepared executable view and staged-generation binding. |
| +R1-2 — **Partly, P1:** the writable bundle location is fixed, but ExecStart still names the old location. |
| +R1-3 — **Resolved:** the installed binary supplies the pin; the post-adoption oneshot avoids the old-updater/bootstrap mismatch. |
| +R1-4 — **Partly, P1:** the fence omits native builds and does not establish protection across reboot. |
| +R1-5 — **Resolved:** the 180-second authorization window remains unchanged. |
| +R1-6 — **Partly, P2:** successful-start identity is covered; identity after a lost start response is not. |
| +R1-7 — **Partly, P2:** ordinary limits are covered; overlap admission and parent readback remain inconsistent. |
| +R1-8 — **Partly, P2:** the host hook and ownership are addressed; runtime-versus-app exit attribution remains undefined. |
| +R1-9 — **Resolved:** the guest filesystems and real-trampoline compatibility witness are specified. |
| +R1-10 — **Resolved:** the agent retains database reads and streams the snapshot to root. |
| + |
| +Reviewed round 2 at `1fab79f82f3a0fee489459c08a65ce9f076123c1`. No files changed; no tests run. |
| + |
| +1. **P1 — §7: the rollback fence still permits native execution.** |
| + |
| + The fence covers instance templates, but omits `carlos-demo-build@.service` and the native readiness probe. After rollback, the old controller can pass its native probe and initialize its native build worker. That worker then compiles submitted source outside gVisor while host.env still requires gVisor. |
| + |
| + Evidence: the proposed fence’s inventory is at [design:275](/home/paulca/amadan.net/carlos/platform-gvisor-demos/docs/superpowers/specs/2026-11-08-gvisor-demos-design.md:275). The old controller gates build initialization on its own `Ready()` at [server.go:343](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:343), starts the native probe at [server.go:1421](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:1421), and derives the native build name at [unit.go:39](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/demobuild/unit.go:39). |
| + |
| + There is also no durable fence location. The note relies on runtime drop-ins surviving rollback; the controller’s existing writable systemd directory is `/run/systemd/system` ([control unit:44](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/units/carlos-instance-control.service:44)). Those files do not survive reboot. Boot recovery can execute `carlos.prev` ([recovery unit:41](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/units/carlos-system-recover.service:41)), restore its controller, and restart the edge ([systemapply.go:1893](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/systemapply.go:1893)). An unaware binary cannot recreate the fence. |
| + |
| + **Fix:** establish a durable, complete recovery gate before enabling gVisor, including native compilation. Either require a sandbox-aware recovery baseline or specify a persistent fence, its narrowly authorized writer, and boot/recovery enforcement. Also correct the promised escape procedure: an unaware old binary cannot remove this new fence merely because the operator sets `systemd`. |
| + |
| + **Fault family:** no native fallback during recovery — repeated from R1-4. |
| + |
| +2. **P1 — §§6.1, 6.3: the unit opens a different bundle directory from the writer.** |
| + |
| + ExecStart specifies `--bundle /var/lib/carlos-control/oci/<id>`, while §6.3 writes `config.json` under `/run/carlos-control/oci/<id>`. Following both instructions makes every gVisor start fail before the trampoline runs. |
| + |
| + Evidence: [design:127](/home/paulca/amadan.net/carlos/platform-gvisor-demos/docs/superpowers/specs/2026-11-08-gvisor-demos-design.md:127) and [design:162](/home/paulca/amadan.net/carlos/platform-gvisor-demos/docs/superpowers/specs/2026-11-08-gvisor-demos-design.md:162). The controller’s writable directory supports the latter ([control unit:44](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/units/carlos-instance-control.service:44)). |
| + |
| + **Fix:** use one bundle-path constructor for the writer, unit rendering, verifier, and cleanup. Keep the separate rootfs under `/var/lib/carlos/oci-rootfs`. |
| + |
| + **Fault family:** controller filesystem authority and bundle-path agreement — continuation of R1-2. |
| + |
| +3. **P1 — §§4, 7: root’s unit-family selector does not cover agent-side native execution.** |
| + |
| + The note promises that explicit gVisor on a non-demo box refuses every instance start. Its enforcement mechanism and dispatch inventory cover systemd units, but ordinary flat/foreign launches can execute directly from the agent without asking root to select a family. |
| + |
| + Evidence: `Start` dispatches non-nested launches to `startChildAt` at [backend_exec.go:2117](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/activator/backend_exec.go:2117); `spawnChildFrom` selects the host executable at [backend_exec.go:2351](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/activator/backend_exec.go:2351). Staged flat generations have another direct dispatch at [genbackend.go:269](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/activator/genbackend.go:269). |
| + |
| + **Failure:** implementing the listed root dispatch changes still leaves a non-demo flat route able to run natively with `CARLOS_EXEC_SANDBOX=gvisor`. No start response exists on that path to trigger the proposed mismatch check. |
| + |
| + **Fix:** specify an agent-wide refusal before every direct process launch, including seed, generation, and role launches. In this slice, effective gVisor must reject non-demo and non-nested execution before spawning anything. Add these paths to the no-fallback test inventory. |
| + |
| + **Fault family:** mandatory sandbox enforcement across all launch paths. |
| + |
| +4. **P2 — §7: uncertain-start cleanup cannot use a name received only in the missing response.** |
| + |
| + Returning and storing root’s selected unit fixes successful starts. It does not explain how cleanup obtains that identity when root starts the unit but the connection fails before the response arrives. |
| + |
| + Evidence: transport failure returns before decoding anything at [client.go:125](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/client.go:125). Generation cleanup runs before creating a handle at [backend_exec.go:2805](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/activator/backend_exec.go:2805); original-unit uncertainty is handled separately at [backend_exec.go:2818](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/activator/backend_exec.go:2818). |
| + |
| + **Failure:** the required “stored name” does not exist. Reconstructing it from the current mode can target the wrong family after a controller restart. |
| + |
| + **Fix:** define the no-response cleanup protocol. For example, root can serialize cleanup by validated host/role/generation, discover both families independently of configured mode, and prove termination before returning. Do not require a successful start response to clean up an uncertain start. |
| + |
| + **Fault family:** unit identity throughout launch, observation and termination — repeated from R1-6. |
| + |
| +5. **P2 — §6.2: overlap needs a distinct parent-budget contract.** |
| + |
| + Applying `Physical` to ordinary writers and readers does not settle overlap. Two physical small limits total 576 MiB, while demo parent readback is still described as comparing against the single-unit 288 MiB value. |
| + |
| + Evidence: the agent sends an overlap sum through `Parent` at [genbackend.go:333](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/activator/genbackend.go:333) and [containment.go:403](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/activator/containment.go:403). Root validates only logical tiers or their sums, then forces demo parents back to small at [gen.go:711](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/gen.go:711). `assertDemoUnit` applies the same size check to child and parent at [demo_policy.go:88](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/demo_policy.go:88); kernel readback likewise shares one expected value at [demo_policy.go:117](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/demo_policy.go:117). |
| + |
| + **Failure:** sending physical limits fails existing request validation; deriving the correct overlap parent in root still fails a verifier expecting one physical tier. |
| + |
| + **Fix:** define whether the wire carries logical budgets or explicit overlap intent. Derive physical limits once in root, distinguish child and parent expectations, and specify restoration to one physical tier. If demos cannot overlap, refuse that case explicitly instead. |
| + |
| + **Fault family:** consistent hierarchical resource accounting — repeated from R1-7. |
| + |
| +6. **P2 — §6.5: the exit hook has no defined evidence for distinguishing runtime failure from app exit.** |
| + |
| + Adding `--sandbox=gvisor` identifies the runner, not which process failed. A runsc failure and an app exit can produce the same systemd exit code. A journal line containing “sandbox” is not a specified attribution protocol. |
| + |
| + Evidence: the hook currently consumes only systemd invocation/result/code/status at [exit.go:91](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instanceexec/exit.go:91). The record has no kind field at [names.go:600](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/names.go:600). `unitMainExitOf` reads the unit’s main process at [unitproc.go:524](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/activator/unitproc.go:524), which will be runsc. The trampoline also converts child signal deaths into numeric exit codes at [init_linux.go:155](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instanceexec/init_linux.go:155). |
| + |
| + **Failure:** diagnostics can label runtime failure as an application failure, or claim signal attribution that the available evidence does not establish. |
| + |
| + **Fix:** define an invocation-bound runtime/guest status channel, or report ambiguous outcomes as unknown. Specify the additive record shape and consumer behavior; do not simultaneously promise a new kind and byte-identical records. Preserve the independent systemd/cgroup termination proof. |
| + |
| + **Fault family:** exit attribution across the runtime boundary — repeated from R1-8. |
| + |
| +7. **P2 — §9: “chown the work tree” is too broad for the existing cache layout.** |
| + |
| + The work tree contains both the mounted cache view and its backing `cache-upper`/`cache-work` directories. A recursive ownership change would alter more than the compiler’s writable output directories. |
| + |
| + Evidence: those backing directories are deliberately created root-owned with mode 0700 at [unit.go:138](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/demobuild/unit.go:138). The overlay mounts at [unit.go:158](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/demobuild/unit.go:158); the current preparation changes only directory permissions so seed file bytes remain on the lower layer ([unit.go:168](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/demobuild/unit.go:168)). |
| + |
| + **Failure:** a literal recursive chown can copy cached files into the bounded writable layer and make overlay backing directories accessible to the compiler through `/work`. That defeats the stated unchanged cache layout and can consume the build’s scratch budget before compilation. |
| + |
| + **Fix:** enumerate ownership changes and mount order. Keep source, cache backing directories, and lower-layer files root-owned; grant the guest access only to the intended work/output/home/tmp and mounted cache view. Existing output validation can remain unchanged: it safely opens and validates the resulting ELF without requiring a DynamicUser owner ([runner.go:162](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/demobuild/runner.go:162)). |
| + |
| + **Fault family:** build-cache ownership and bounded scratch storage. |
| + |
| +The existing native dispatches that must be migrated or explicitly refused are: |
| + |
| +| Path | Verified location | |
| +|---|---| |
| +| Main/sidecar | [server.go:835](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:835) | |
| +| Generation start/drop-in/stop | [gen.go:316](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/gen.go:316), [gen.go:85](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/gen.go:85), [gen.go:488](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/gen.go:488) | |
| +| Seed and retry | [server.go:964](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:964), [server.go:994](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:994) | |
| +| Cmd/tty | [cmd.go:71](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/cmd.go:71) | |
| +| Rootfs roles/probe | [rootfs.go:573](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/rootfs.go:573), [rootfs.go:1271](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/rootfs.go:1271) | |
| +| Native probe | [server.go:1421](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:1421) | |
| +| Host claims | [claimunit.go:200](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/claimunit.go:200) | |
| +| Egress restart | [egress.go:496](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/egress.go:496) | |
| +| Build launch/recovery | [unit.go:39](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/demobuild/unit.go:39), [unit.go:389](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/demobuild/unit.go:389) | |
| +| Claim-freeze/purge discovery | [demo_cleanup.go:177](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/demo_cleanup.go:177) | |
| +| General sweep/generation leftovers | [server.go:1140](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:1140), [gen.go:555](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/gen.go:555) | |
| + |
| +**P3:** §12 still requires pointer tests “with and without `Runsc`,” although §5 explicitly leaves `SystemPointer` unchanged ([design:352](/home/paulca/amadan.net/carlos/platform-gvisor-demos/docs/superpowers/specs/2026-11-08-gvisor-demos-design.md:352)). Replace that obsolete test description with optional-asset mirroring and target-pin installation coverage. Fault family: verification-document consistency. |
| + |
| +The repeated families trigger stopping rule 2. Before another fix round, Paul’s choices are to gate unsupported transitions up front, cut the problematic transition behavior, or consolidate each invariant into one enforcement point with guard tests. I recommend refusing rollback to a sandbox-unaware baseline and defining one launch/cleanup contract that covers missing responses and both families. Round 3 remains the last round without Paul’s approval. |
| + |
| +**NOT READY** |
| \ No newline at end of file |