feat(desktop): store VM image + staged binaries in the cache dir#268
Merged
Conversation
The VM disk image (~1GB) and staged runtime binaries lived under the app-data
dir (~/Library/Application Support/com.orcabot.desktop). They're large and fully
regenerable, so move them to the cache dir (~/Library/Caches/com.orcabot.desktop/vm):
- Caches is the OS-purgeable bucket and what uninstallers/cleaners treat as
disposable, so a deleted app no longer strands ~1GB of precious-looking data.
- Application Support now holds only real user data (workspace, D1 db, secrets key).
- One-time migration on first launch after upgrade:
- same-volume: instant atomic rename (the macOS case);
- cross-volume (EXDEV; split XDG dirs / roaming profiles): copy into a temp
sibling, atomically rename it into place — so a crash mid-copy never leaves a
truncated sandbox-<version>.img that ensure_vm_image would boot;
- the old dir is reclaimed (reclaim_old_vm_dir) ONLY after stage_vm_resources
confirms a valid image — never on mere directory existence — so a failed
migration+download (e.g. cache volume full) can't delete the last working image;
- any copy/swap failure preserves the old dir.
- If cache staging fails but the preserved old dir still has a valid image, boot
from it instead of failing every launch; a later writable-cache launch migrates
and reclaims it.
- Falls back to the data dir if no cache dir resolves (no behavior change there).
stage_vm_resources / ensure_vm_image now take the resolved vm_dir instead of
deriving it from data_dir; start_sandbox_vm resolves it from app_cache_dir().
Bumps main + vm-image REVISION markers; updates desktop/CLAUDE.md image-staging.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014t8Ukp4NPWtqJ55X261wMZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The VM disk image (
1GB) and staged runtime binaries lived under the app-data dir (/Library/Application Support/com.orcabot.desktop). They're large and fully regenerable, so move them to the cache dir (~/Library/Caches/com.orcabot.desktop/vm):