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
+4 -1
View File
@@ -14,11 +14,12 @@ wsbx run alpine # bare VM, interactive shell
wsbx run -w . ubuntu -- make test # one-off command, exit code propagated
wsbx run -p 8000 alpine # host's localhost:8000 reachable as localhost:8000 in the VM
wsbx ls / wsbx rm NAME / wsbx pull IMAGE
wsbx gc # delete cached images no sandbox uses
wsbx kernel [--update | --version TAG] # latest Kata release by default, sha256-verified
```
Defaults for `--cpus`/`--memory` come from the host (half the cores, a quarter of RAM up to 8 GiB). Image tags
are re-resolved after 24 h (cached copy used when offline). `WSBX_KATA_VERSION` pins the kernel release.
are re-resolved after 24 h (cached copy used when offline); the superseded image is deleted automatically. `WSBX_KATA_VERSION` pins the kernel release.
Options: `--name --workspace --cpus --memory --disk --env K[=V] --host-port/-p PORT --fresh --pull --kernel`.
@@ -56,4 +57,6 @@ Remaining risks:
IDE tasks, package scripts). Review changes before running them on the host.
- Egress is unrestricted NAT. Anything the VM holds (keys passed with `--keys`, API keys in pi's `models.json`, `--pi-auth`)
can be exfiltrated. A host-side credential-injecting egress proxy would fix this; it isn't built yet.
- A kernel panic before the root disk mounts (e.g. a corrupt `disk.img`) still restart-loops; panics after boot stop
the VM (exit 1).
- Image layers are unpacked on the host into one tar, so a decompression bomb can fill the disk.