Add image gc, stop VMs on kernel panic, harden first boot

- Add `wsbx gc` to delete cached images that no sandbox uses, and
  drop the superseded image automatically when a tag moves to a new
  digest (unless another ref still points at it).
- Boot the guest with panic=1. Virtualization.framework restarts a
  rebooting guest, so init now leaves a marker in the per-launch
  control share and powers off when it is already there. A kernel
  panic (or a reboot inside the VM) now ends the run with exit 1
  instead of hanging or looping forever.
- Report a VM that stops without an exit status as an error.
- Sync the first-boot image unpack before marking the sandbox
  provisioned; a crash right after first boot previously left an
  empty root filesystem.
- Validate kernel, workspace and state-dir paths before creating any
  sandbox files, so rejected runs no longer leave a sandbox behind.
- Ignore .llm-wiki/, commit .gitignore, fix the remaining Clippy
  warning, and document gc and the panic behavior.
This commit is contained in:
2026-10-02 15:33:30 +02:00
parent 9117f05db9
commit cff6dae88f
6 changed files with 104 additions and 23 deletions
+11
View File
@@ -91,5 +91,16 @@ define the device order), vsock ports, 20 GiB sparse disk, the agent image names
| Medium: pi copy follows symlinks | contained to staged roots (incl. `~/.agents/skills`, which pi reads natively), cycle-safe, no special files, 256 MB cap | unit test + `show-me` still arrives |
| (own) | reference/tag/registry validated before any request (`alpine@sha256:../../x` hit the registry as `/manifests/x`), busybox must be a regular file, Kata tag validated | unit tests |
## Iteration 5: cleanup ✅
- `wsbx gc`: keeps only images whose tag a sandbox uses (freed 1.74 GB here). A tag that moves now deletes the superseded
image automatically, unless another ref still points at it.
- Kernel panics: `panic=1` makes the kernel reboot, and VZ turns that into a restart loop. init writes a `booted` marker into
the per-launch share and powers off when it's already there. A real panic (`panic_on_oom`) now stops in about 2 s with
exit 1 and a message. Limit: a panic before the root disk mounts still loops.
- Found while testing panics: the first-boot unpack wasn't synced before `provisioned` was recorded, so a crash right after
first boot left an empty system. Fixed with a sync before marking.
- Found while reviewing: path validation ran after disk creation, so rejected runs left a sandbox behind. It now runs first.
- `.gitignore` covers `.llm-wiki/`; Clippy is clean.
## Out of scope (add when needed)
Port forwarding, network policy / credential-injecting egress proxy, snapshots, x86_64 hosts, zstd layers.