Repository navigation
feat(claude-code): share Bun's store across projects; keep sandbox volumes separate - #239
Merged
Merged
Conversation
…re across projects devcontainer.json `mounts` reach Compose as service volumes, which Compose prefixes with the project name. myproject and myproject-sandbox therefore never shared the volumes the README said they shared (#209). - Both compose files declare the Claude config, zsh history, gh and cf volumes with fixed `name:`s, so both variants mount the same ones. - The default variant also mounts `bun-global-store` at ~/.bun/install/cache, shared by every project. The sandbox doesn't mount it. - node_modules stays in `mounts`, per variant and per worktree: with Bun's global store, the default's node_modules link into a volume the sandbox lacks. - The image pre-creates ~/.bun/install/cache node-owned, so a new store volume needs no chown. CI verify checks it. - The template's mise.toml pins Bun 1.4.4, the first release whose global store keeps @types-peered packages' types (oven-sh/bun#36795). - README: a new Volumes section covering the shared Bun store, how to opt in with globalStore, the trust model, and how to upgrade existing volumes. The upstream-sync skill substitutes the compose volume names. Closes #236 Closes #209
…t variant Sharing ~/.claude, the gh and cf logins and shell history with the sandbox let a prompt-injected sandbox agent plant user-scope hooks or bypassPermissions that run in the default variant (passwordless sudo, no firewall), and handed it the gh token while GitHub is allowlisted. - Config volumes go back to devcontainer.json `mounts`, where Compose's project prefix keeps each variant's own. No volume rename, so no migration. - Only bun-global-store stays compose-declared with a fixed name. - README: "Why the variants don't share volumes"; the sandbox signs in with CLAUDE_CODE_OAUTH_TOKEN, gh with a fine-grained token. - Review rule and sync skill flag sharing as a security regression.
…urrent Hugo pin - The Bun store reset uses `bun pm cache rm`, which the Bun docs give for clearing the cache including the global store, and needs no container stopped. Deleting the volume stays as the heavier option. - The sandbox gh sign-in pastes the token on stdin instead of reading token.txt, which in a devcontainer tends to land in /workspace, the host repo. - The template mise.toml pins Hugo 0.168.0 (was 0.155.1), the version ralphex-fe ships and one #211's safe.directory fix applies to.
gatezh
force-pushed
the
feat/shared-volumes
branch
from
October 22, 2026 22:45
208a4cc to
c7d1f10
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.
What
Every project's default variant now shares one Bun package store. The sandbox and the default variant deliberately share no volumes, and the docs now say so.
Why
node_modules, which filled Docker's disk in a downstream pilot. Bun 1.4.4 (2026-10-22) fixes the global-store bug that blocked the pilot.devcontainer.jsonmountswith the project name (myproject_…vsmyproject-sandbox_…). This PR first made them share through fixed-name compose volumes. Review showed that this is a sandbox escape, so the second commit keeps them separate and corrects the docs instead:bypassPermissionsand skips workspace trust only for user settings (~/.claude/settings.json), and edits there don't show ingit diff. A sandbox agent, which runs with prompts skipped, could plant a hook or bypass mode that runs in the default variant (passwordless sudo, no firewall).~/.config/ghhands the sandbox thegh auth logintoken (repo,gistscopes) while GitHub is allowlisted. The cf login and shell history leak the same way.Changes
bun-global-storeat~/.bun/install/cache, declared indocker-compose.ymlwith a fixedname:so every project shares it. The sandbox doesn't mount it./home/node/.bun/install/cachenode-owned, so a new store volume is seeded with the right owner.verify-image.shchecks the owner on both targets.mounts, one set per variant and worktree, as on master. No volume is renamed, so existing projects keep their sign-ins.devcontainer.jsonfiles drop "default and sandbox variants share volumes", and the sandbox'sCLAUDE_CODE_OAUTH_TOKENis now the documented sign-in path, not an optional one.linker = "isolated",globalStore = true, trust model, CI cache note, reset)..claude/rules/devcontainer.md(now also loaded fordocker-compose.yml), and thedevcontainer-upstream-syncskill reports a project that shares sandbox volumes as a security finding.mise.toml: Bun 1.3.8 → 1.4.4, Hugo 0.155.1 → 0.168.0.bun pm cache rm, Bun's documented way to clear the cache including the global store. The sandbox gh sign-in pastes the token on stdin instead of reading atoken.txt, which in a devcontainer tends to land in/workspace.Notes
docker-compose.ymlvolume block. Linking needsglobalStore = truein itsbunfig.toml.CLAUDE_CODE_OAUTH_TOKENfromclaude setup-token.mounts.Testing
End-to-end with the devcontainer CLI 0.89.0 on the first commit, in a helper container. Two projects were made from the template with React 19,
cmdk, TypeScript,linker = "isolated",globalStore = trueand Bun 1.4.4:bun-global-storeis unprefixed and owned bynodewith no chown.reactlinks into~/.bun/install/cache/links/.tscpasses.bun installtook 39 ms, linkingreactfrom the same store entry as project A.tscpasses.bun-global-storenot mounted. Firewall verification passed.oven/bunimagesTS7006(cmdkloses React types). 1.4.4 typechecks cleanly.On the second commit:
docker compose configon both compose files, a JSONC parse of bothdevcontainer.jsonfiles (the config mounts match master), and a check that every README#anchorresolves.Closes #236
Closes #209