Repository navigation
whim v0.4.0 — persistent MicroVM boxes (run -d, exec -it, rm)
whim shells are disposable by default — the VM terminates when you disconnect or the command finishes. This release adds an opt-in way to keep one around: persistent boxes.
whim run -d --idle 15m --suspend-after 2h # prints the id, returns immediately
whim exec -it microvm-abc123 # attach an interactive shell
# ...work, then Ctrl-] to detach — the box keeps running...
whim exec -it microvm-abc123 # reconnect later: fresh shell, disk intact
whim rm microvm-abc123 # done — terminate itWhat's new
- whim run -d launches a persistent box instead of a throwaway one: it prints the bare id and returns without attaching or terminating. --idle / --suspend-after / --auto-resume configure its idle policy.
- whim exec -it attaches an interactive shell to a running or suspended box — Ctrl-] detaches without terminating it. Unlike docker exec -it, it takes no trailing command: the shell endpoint always starts a fresh shell, with no wire mechanism to select a program over that connection. Run your command once you're attached instead.
- whim rm <id…> terminates by id — like suspend/resume/exec, no ownership check (contrast the owned-bulk gc). Idempotent on an already-gone id; a failure on one id in a list doesn't stop the rest.
- exec/put/get/exec -it all resume a suspended box transparently on first use, via a single change to Manager.Attach — no per-command resume logic needed (put/get needed no code changes at all).
The idle policy's real behavior — read this before relying on it for cost control
Both directions were verified against real AWS, and one is the opposite of what you'd guess:
- A detached box (no attached shell) with a background job running does suspend after --idle with no traffic, and the job actually freezes, not just billing. It resumes — and the job continues — the next time anything touches it.
- A box with an attached shell, even sitting idle at the prompt sending nothing, does NOT suspend. Merely holding the connection open counts as traffic. So whim exec -it left attached while you walk away keeps the box running and billed until --ttl, detach, or rm — --idle only protects you once you actually detach (Ctrl-]).
- A session's lifetime is governed by the VM's own --ttl (hard cap, ≤8h) and its idle policy — not by any client-side token-refresh mechanism. There isn't one: an established shell connection is unaffected by its underlying auth token expiring in the background (confirmed live, including a permanent opt-in canary test that re-checks this platform behavior).
What persists across a detach/reconnect, and what doesn't
- ✅ Files on disk, and any background process still running.
- ❌ Your terminal state — the open editor, shell history-in-progress, current directory. Reconnecting always gives you a fresh shell. Run tmux inside the box if you want the session itself, not just the disk, to survive.
Validated live
Full round trip: launch a persistent box → attach and write a marker file → detach (Ctrl-]) → reconnect (fresh shell, different pid, marker still there) → suspend → exec auto-resumes and reads the marker back → rm. Plus a permanent, opt-in integration suite (WHIM_INTEGRATION=1) covering concurrent multi-attach independence, idle-suspend with a real frozen background job, the open-shell-prevents-suspend finding, and resume-on-use.
Compatibility
Purely additive and opt-in — whim shell/whim run are unchanged, and every existing command keeps working exactly as before.
Install
go install github.com/udgover/whim/cmd/whim@v0.4.0