fix(smolmachines): exclude /tmp+/var/tmp from snapshot; mkdir -p on boot
lint / lint (push) Successful in 1m45s
test / unit (pull_request) Successful in 35s
test / integration (pull_request) Successful in 19s

On resume from a committed snapshot, smolvm's pack process remaps all
file uids to the host uid (501 on macOS). Files in /tmp that were
created during the session (e.g. /tmp/claude-1000 owned by node=uid
1000) get remapped to 501. Claude Code then refuses to use the temp
directory because it's owned by a different uid.

Two-part fix:
- Exclude ./tmp and ./var/tmp from the tar in _exec_tar_to_file.
  Both directories are ephemeral; a resumed VM should start with clean
  temp directories identical to a fresh VM.
- Add mkdir -p /tmp /var/tmp to _init_vm before chown/chmod, so the
  directories are created if the committed snapshot omitted them.
This commit is contained in:
2026-06-23 18:06:41 +00:00
committed by didericis
parent b2919b6148
commit e74a5e0219
2 changed files with 13 additions and 0 deletions
@@ -120,6 +120,13 @@ def _exec_tar_to_file(machine: str, dest: Path) -> None:
"--exclude=./sys",
"--exclude=./dev",
"--exclude=./run",
# /tmp and /var/tmp are ephemeral. Their stale contents
# (e.g. /tmp/claude-<uid>) have uid remapped by smolvm's
# pack process, causing Claude Code to refuse to use them
# on resume. Exclude both; _init_vm recreates them with
# mkdir -p + correct ownership on every boot.
"--exclude=./tmp",
"--exclude=./var/tmp",
f"--file={_VM_COMMIT_TAR}",
"--directory=/",
".",