Repository navigation
fix(sandbox): mount the guest bridge outside the read-only /opt - #218
Merged
Merged
Conversation
quickbeard
force-pushed
the
sandbox-bridge-mount
branch
2 times, most recently
from
August 13, 2026 06:58
1ba7342 to
3856a9e
Compare
Every bwrap sandbox failed to start with "Can't mkdir /opt/codev-bridge: Read-only file system". bwrap creates missing mount points only where it can write — its own tmpfs root, never inside a read-only bind — and /opt comes from the image rootfs, which ships /opt/codev but no bridge dir. Move GUEST_BRIDGE to a top-level /codev-bridge, so bwrap creates it on the tmpfs root alongside /run/codev and /workspace. Host-side only: existing sandboxes start as they are, with no image republish or re-create. The integration test missed this because its host-rootfs allowlist excludes /opt, so the destination was always created on the tmpfs root; cover the invariant directly instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
quickbeard
force-pushed
the
sandbox-bridge-mount
branch
from
August 13, 2026 07:35
3856a9e to
1c94826
Compare
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.
Problem
Every bwrap sandbox (Linux) fails to start immediately:
bwrapcreates missing mount points, but only where it can write: its own tmpfs root, never inside a read-only bind.GUEST_BRIDGEwas/opt/codev-bridge, and/optis--ro-bind-mounted from the image rootfs a few args earlier, so the mount point can only exist if the image already ships it — and it doesn't.image/Dockerfilecreates/workspace /opt/codev /codev-configonly./opt/codevworks precisely because the image ships it. Every other mount (/workspace,/run/codev,/home/codev) lands on a path bwrap builds on its tmpfs root, since those names are inMANAGED_ROOTFS_ENTRIESand are never bound from the rootfs. The bridge was the one destination that was neither.Fix
Move
GUEST_BRIDGEto a top-level/codev-bridge.CODEV_CONFIGand bothforward.mjsinvocations follow the same constant, so they move with it.Host-side only, which matters here: it works with already-downloaded images. Adding the directory to the Dockerfile instead would need both arches rebuilt, republished, and every existing sandbox reset, for the same result.
Verification
Ran the real provider against an existing sandbox and the dev server bundle on Ubuntu 22.04:
The bridge mount was the only blocker — the guest boots, the server starts, and the workspace maps correctly.
bun test(94 pass, 0 fail) andbun typecheckclean inpackages/codev-sandbox.Why tests missed it
bwrap.integration.test.tsuses the host's/as the rootfs but filters entries to an allowlist that excludesopt. With no/optbind present, bwrap creates/opt/codev-bridgeon the tmpfs root and the test passes — a case the real image hits and the test rootfs structurally cannot.The added test in
args.test.tscovers the invariant directly: no mount destination may nest inside a read-only rootfs bind. Confirmed it fails on the old path and passes on the new one.Notes
No
DIVERGENCES.mdrow:packages/codev-sandboxis fork-only.CHANGELOG.mdgets an Unreleased entry since Linux sandboxes were documented as working.🤖 Generated with Claude Code