Repository navigation
feat(sandbox): support extra host folder mounts on a sandbox - #233
Merged
Merged
Conversation
This was referenced Aug 14, 2026
SandboxConfig gains an optional mounts list of extra host folders shared into the guest alongside projectDir. Guest paths are derived at start (/mnt/<basename> on vz/bwrap, wslpath output on WSL) and travel on RunningSandbox and the ready runtime so the app always sees what the guest actually mounted. The controller's new updateSandboxMounts replaces the list: hot via the new optional provider applyMounts (WSL only — the distro's namespace is shared and drives are automounted, so it is pure path translation and doubles as the validation gate before persisting), otherwise by restarting a live sandbox. Stopped or failed sandboxes persist the change for their next start; updates racing a create/reset are rejected rather than aborting the job. Provider side: vz appends one virtiofs share per mount and rewrites mounts.json into the config share every start (empty list included, so a stale list from the previous boot cannot survive); bwrap adds --bind pairs and marks mnt as a managed rootfs entry so the mount points are creatable on its tmpfs root; extra mounts whose folder vanished are skipped at start instead of failing it — only projectDir stays fatal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
quickbeard
force-pushed
the
sandbox-mounts-core
branch
from
August 14, 2026 06:30
40e78e1 to
027741a
Compare
This was referenced Aug 14, 2026
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.
First of three stacked PRs adding "mount more folders into an existing sandbox" (core → image → desktop/app UI).
What
SandboxConfig.mounts?: { path }[]— extra host folders shared into the guest alongsideprojectDir; shaped as objects so areadOnlyflag can be added later without migrating persisted records.src/mounts.ts: guest-name derivation (/mnt/<sanitized-basename>, in-order dedup, capped somnt-<name>virtiofs tags stay under the 36-byte limit) and purevalidateMountPaths(duplicates — case-insensitive for Windows-shaped paths, nesting in either direction vs the project dir and other mounts, UNC rejection) with discriminated error codes for i18n mapping downstream.controller.updateSandboxMounts(id, mounts)(whole-list replace): hot path via the new optionalSandboxProvider.applyMounts— implemented by WSL only, where it is purewslpathtranslation and runs before persisting so a bad path never lands in the stored config; restart path everywhere else (persist first so the new set survives a failed restart, restart only a live sandbox). Stopped/failed sandboxes persist for their next start; an update racing a create/reset is rejected rather than aborting the job. No new job kind — restart busy-ness already shows asruntime.kind === "starting".{ path, guestPath }[]travels onRunningSandbox→ thereadyruntime, so the existing{type:"state"}event is the entire hot-apply signal — no new event kind.mounts.jsoninto the config share every start (empty list included, so a stale list from the previous boot cannot survive; the guest side lands in the next PR); bwrap emits--bindpairs and addsmnttoMANAGED_ROOTFS_ENTRIESso mount points are creatable on its tmpfs root; WSL translates viawslpathwith zero guest work. Extra mounts whose folder vanished are skipped at start instead of failing it — onlyprojectDirstays fatal.Tests
cd packages/codev-sandbox && bun test && bun typecheck— 122 pass. New:mounts.test.ts(names/dedup/tag cap/validation matrix), controller coverage (persist-without-start, restart-to-apply, hot apply patches the ready runtime without restarting, failed hot apply persists nothing, mid-job rejection), vz share/manifest/skip assertions, bwrap/mntbind ordering + managed-entry, WSL skip-at-start +applyMountsthrow.🤖 Generated with Claude Code