What happened
When using Claude Code via the VS Code extension (v2.1.156), the Bash sandbox configured in settings.json is never activated:
- A valid
sandbox block in .claude/settings.local.json (or ~/.claude/settings.json) with "enabled": true and "autoAllowBashIfSandboxed": true is silently ignored — Bash commands continue to go through the normal permission flow and prompt as if no sandbox were configured.
- The
/sandbox slash command does not exist in the extension — typing it returns "No matching commands".
The docs (https://code.claude.com/docs/en/sandboxing) describe /sandbox and sandbox.enabled as the way to turn this on, with no mention that the IDE extension is excluded. The same config works as expected when running claude --sandbox from a terminal.
Why this matters (approval fatigue)
The sandbox is the documented remedy for permission-prompt approval fatigue (Anthropic cites ~84% fewer prompts). Allowlists structurally cannot cover the long tail of harmless commands — command substitution $(...), compound a && b gated by the least-privileged segment, and one-off novel commands all still prompt no matter how complete the allowlist is. For extension users that long tail is currently unfixable, because the one mechanism that would fix it can't be turned on.
Background
This was previously reported and closed-as-duplicate, with the chain ending in issues that are now closed and locked, and were macOS-flavored:
The auto-close bot's message on those explicitly says "please file a new issue." I could not find any open issue tracking specifically "the IDE extension does not pass --sandbox / does not activate the sandbox from settings.json", so filing fresh.
Expected behavior
The VS Code (and Cursor/JetBrains) extension should honor sandbox.enabled from settings.json — i.e. spawn the underlying Claude Code process with sandboxing active (equivalent to --sandbox) — so that autoAllowBashIfSandboxed works and /sandbox (or an equivalent settings-driven activation) is available in the IDE, matching the terminal CLI and the documentation.
Environment
- Claude Code: 2.1.156
- Surface: VS Code native extension
- OS: Linux (Arch), kernel 7.0.x
- Sandbox deps present:
bubblewrap 0.11.2, socat; no AppArmor unprivileged-userns restriction
claude --sandbox from a terminal works correctly with the same settings.json
Repro
- In the VS Code extension, add a valid
sandbox block with "enabled": true to .claude/settings.local.json.
- Restart the extension / reload the window.
- Ask Claude to run a non-allowlisted Bash command (e.g. something using
$(...)).
- Observe: it still prompts for permission;
/sandbox returns "No matching commands".
What happened
When using Claude Code via the VS Code extension (v2.1.156), the Bash sandbox configured in
settings.jsonis never activated:sandboxblock in.claude/settings.local.json(or~/.claude/settings.json) with"enabled": trueand"autoAllowBashIfSandboxed": trueis silently ignored — Bash commands continue to go through the normal permission flow and prompt as if no sandbox were configured./sandboxslash command does not exist in the extension — typing it returns "No matching commands".The docs (https://code.claude.com/docs/en/sandboxing) describe
/sandboxandsandbox.enabledas the way to turn this on, with no mention that the IDE extension is excluded. The same config works as expected when runningclaude --sandboxfrom a terminal.Why this matters (approval fatigue)
The sandbox is the documented remedy for permission-prompt approval fatigue (Anthropic cites ~84% fewer prompts). Allowlists structurally cannot cover the long tail of harmless commands — command substitution
$(...), compounda && bgated by the least-privileged segment, and one-off novel commands all still prompt no matter how complete the allowlist is. For extension users that long tail is currently unfixable, because the one mechanism that would fix it can't be turned on.Background
This was previously reported and closed-as-duplicate, with the chain ending in issues that are now closed and locked, and were macOS-flavored:
The auto-close bot's message on those explicitly says "please file a new issue." I could not find any open issue tracking specifically "the IDE extension does not pass
--sandbox/ does not activate the sandbox fromsettings.json", so filing fresh.Expected behavior
The VS Code (and Cursor/JetBrains) extension should honor
sandbox.enabledfromsettings.json— i.e. spawn the underlying Claude Code process with sandboxing active (equivalent to--sandbox) — so thatautoAllowBashIfSandboxedworks and/sandbox(or an equivalent settings-driven activation) is available in the IDE, matching the terminal CLI and the documentation.Environment
bubblewrap0.11.2,socat; no AppArmor unprivileged-userns restrictionclaude --sandboxfrom a terminal works correctly with the samesettings.jsonRepro
sandboxblock with"enabled": trueto.claude/settings.local.json.$(...))./sandboxreturns "No matching commands".