carlos / platform Public

gvisor demos: design builder-check round 3 findings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 6cdb7854cabc8b3effa46d21db9d17d0e74f2fc1 parent 77e2943
1 file changed, +78 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-gvisor-demos-design-R3.md +78 −0
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-gvisor-demos-design-R3.md b/docs/superpowers/reviews/CODEX-FINDINGS-gvisor-demos-design-R3.md
new file mode 100644
index 000000000..b16dbd496
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-gvisor-demos-design-R3.md
@@ -0,0 +1,78 @@
+R2-1 — **Partly:** the floor replaces the fence, but first activation and guarded recovery can still run unaware code.
+R2-2 — **Resolved:** writer, unit and cleanup share `BundleDir`.
+R2-3 — **Resolved:** the agent-side launch gate covers direct native execution.
+R2-4 — **Partly:** `stop-uncertain` resolves family discovery, but its stated locking does not establish final termination.
+R2-5 — **Resolved:** refusing overlap removes the two-child budget problem.
+R2-6 — **Resolved:** unchanged advisory records and “exit status via gVisor” avoid unsupported attribution.
+R2-7 — **Resolved:** ownership changes exclude cache backing directories and lower-layer files.
+
+Reviewed commit `77e2943c959552c152c896e1e2ffaac910e2cc95`. No files changed; no tests run.
+
+1. **P1 — §§7, 13: the floor is not established before gVisor activation.**
+
+ The rollout says to set `gvisor` and ride a roll restart ([design:421](/home/paulca/amadan.net/carlos/platform-gvisor-demos/docs/superpowers/specs/2026-11-08-gvisor-demos-design.md:421)). On the first aware release, that roll can still be owned by the **old updater process**. Replacing its executable on disk does not replace that process. It calls its own rollback after a failed restart or gate ([systemapply.go:655](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/systemapply.go:655), [systemapply.go:699](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/systemapply.go:699)). Rollback restores `.prev`, restarts control and restarts the edge ([systemapply.go:1893](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/systemapply.go:1893)). Neither the new apply check nor the recovery-unit shell gate runs on this path.
+
+ There is another bypass: the recovery unit’s **first branch** executes `/opt/carlos/system/guard/carlos` before reaching the proposed `&&` check ([recovery unit:41](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/units/carlos-system-recover.service:41)). That executable can select `.prev` itself ([guardexec.go:70](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/guardexec.go:70), [rootmovesfloor_boot.go:83](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/rootmovesfloor_boot.go:83)). Disabling host claims does not exclude this case: retained census state remains authoritative ([production.go:54](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/rootparticipation/production.go:54)).
+
+ **Failure:** an interrupted or unhealthy first roll, or guarded recovery with an unaware executor, restores native demos/builds while host.env requires gVisor.
+
+ **Fix:** require a completed, healthy installation of the aware baseline **while still in systemd mode**, with no old apply transaction running, before enabling gVisor. Include the guard executor and both recovery branches in that prerequisite; refuse retained guard configurations that cannot enforce the floor. Fresh bootstrap also needs an externally enforced aware baseline: an unaware bootstrap binary cannot enforce its successor’s apply check.
+
+ **Fault family:** no native fallback during activation and recovery; continuation of R2-1.
+
+2. **P1 — §7: `stop-uncertain` can prove emptiness before an earlier start submits.**
+
+ The proposed protocol takes an “existing per-unit lock,” stops loaded units and proves emptiness ([design:270](/home/paulca/amadan.net/carlos/platform-gvisor-demos/docs/superpowers/specs/2026-11-08-gvisor-demos-design.md:270)). The existing per-unit hold is specifically for **rootfs** operations ([rootfs_unitlock.go:9](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/rootfs_unitlock.go:9)). Binary generation starts instead use `markGenStarting`, a counter rather than that lock ([gen.go:321](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/gen.go:321), [gen.go:503](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/gen.go:503)).
+
+ Original binary starts have a different, essential protection: `/stop` fences accepted requests, cancels and joins starts, and rejects earlier requests whose handlers register late ([legacystart.go:13](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/legacystart.go:13), [server.go:1072](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:1072)). The replacement protocol does not retain that protection.
+
+ **Failure:** an earlier `/start` is delayed before submission. `stop-uncertain` finds both families empty and succeeds; the agent releases its lease. The delayed request subsequently starts the workload. A mutex alone also permits this ordering if the delayed handler acquires it after cleanup.
+
+ **Fix:** make `stop-uncertain` preserve the accepted-request barrier and cancellation/join contract, covering both original and generation starts. Explicitly identify the shared synchronization used by starts, cleanup and bundle removal. Test cleanup overtaking an accepted-but-delayed start, as well as a response lost after successful start.
+
+ **Fault family:** termination proof must exclude future submission by an earlier start. Family discovery from R2-4 is fixed; this is a defect in the replacement mechanism.
+
+3. **P2 — §7: the proposed binary-awareness reader does not exist as described.**
+
+ The note says to read `execsandbox.Protocol = 1` from the executable “the way `rootFloorBinary` reads” supported floors ([design:297](/home/paulca/amadan.net/carlos/platform-gvisor-demos/docs/superpowers/specs/2026-11-08-gvisor-demos-design.md:297)). That implementation hashes the executable, verifies cached signed identities, and obtains protocol numbers from their `SystemRelease` fields ([rootmovesfloor_refresh.go:178](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/rootmovesfloor_refresh.go:178), [rootmovesfloor_refresh.go:223](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/rootmovesfloor_refresh.go:223)). It does not extract Go constants from binaries.
+
+ **Failure:** following the cited mechanism provides no exec-sandbox protocol value, while §5 promises no pointer change.
+
+ **Fix:** specify a retained, versioned binary marker and its bounded reader, tied to the authenticated executable being checked. Test actual stripped release binaries and unaware binaries. A Go constant alone is not the file-format contract.
+
+ **Fault family:** authenticated capability identification.
+
+4. **P2 — §§6.2, 11: size reporting still treats physical memory as a logical tier.**
+
+ `readSizeInForce` reconstructs the native generation name, reads `memory.max`, then matches it directly against logical sizes ([sizestatus.go:67](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/sizestatus.go:67)). A 288 MiB limit matches no size; `sizeCell` consequently displays `?` ([sizestatus.go:86](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/sizestatus.go:86), [sizestatus.go:92](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/host/sizestatus.go:92)).
+
+ **Failure:** correctly limited gVisor demos lose their reported `small` size in the layout report.
+
+ **Fix:** include this consumer in the design. Read the actual retained unit identity and match observed limits against `Physical(logicalTier)` for that family, returning the logical size.
+
+ **Fault family:** consistent interpretation of logical versus physical limits.
+
+The existing dispatch/discovery sites that must be migrated or explicitly refused remain:
+
+| Path | Verified locations |
+|---|---|
+| Main/sidecar | [server.go:835](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:835) |
+| Generation naming, 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 naming/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) |
+| Sweep, queued jobs, generation leftovers | [server.go:1128](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:1128), [server.go:1147](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/server.go:1147), [gen.go:555](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/instancectl/gen.go:555) |
+| Direct agent launches | [backend_exec.go:2351](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/activator/backend_exec.go:2351), [genbackend.go:274](/home/paulca/amadan.net/carlos/platform-gvisor-demos/internal/activator/genbackend.go:274) |
+
+These sites are covered by rev 3’s stated inventory; their presence in today’s code is not an additional finding.
+
+The trampoline does read launch JSON unprivileged today. The specified Landlock bypass and environment override require changes; execution under runsc remains subject to the real-trampoline witness. The content-addressed runsc supply leaves the pointer unchanged, and the narrowed build ownership is compatible with current output validation. I found no additional design-level cgo or cross-compilation blocker.
+
+The two P1s have different causes: recovery authority and start/stop ordering. Refusing gVisor activation until the aware recovery baseline is established removes the first. The second needs the existing start-fencing guarantee carried into the new verb; cutting overlap does not remove uncertain cold starts. This exhausts round 3; a fourth review requires Paul’s approval.
+
+**NOT READY**
\ No newline at end of file