VS Code extension ignores sandbox settings.json / /sandbox unavailable (approval-fatigue fix unreachable in IDE)
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
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. - The
/sandboxslash 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:
- #32814 → duplicate of #32416 (both CLOSED, locked)
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:
bubblewrap0.11.2,socat; no AppArmor unprivileged-userns restriction claude --sandboxfrom a terminal works correctly with the samesettings.json
Repro
- In the VS Code extension, add a valid
sandboxblock with"enabled": trueto.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;
/sandboxreturns "No matching commands".
Showing cached comments. Read the full discussion on GitHub ↗
4 Comments
[BUG] IDE Extension fails to pass --sandbox flag / ignores sandbox.enabled in settings.json
Summary
When using Claude Code via the VS Code / Cursor extension, the Bash sandbox configuration is never activated. Even with a valid sandbox block set to
"enabled": trueand"autoAllowBashIfSandboxed": trueinsettings.json(orsettings.local.json), the extension spawns the underlying native binary wrapper without the--sandboxprocess flag. As a result, Bash commands continue to trigger manual permission prompts, causing immense approval fatigue.Additionally, the
/sandboxslash command is completely missing inside the extension ("No matching commands"). The identical configuration works perfectly when runningclaude --sandboxdirectly from a standard system terminal.Current Behavior
settings.jsonvia--setting-sources, but the process spawner ignores thesandbox.enabledboolean.bubblewrap(Linux) orSeatbelt(macOS) constraints.&&), or command substitution ($(...)) triggers an approval prompt./sandboxcommand is unavailable in the IDE chat UI.Expected Behavior
The VS Code extension should inspect the computed settings lifecycle during process initialization. If
sandbox.enabled: trueis present, it must append the--sandboxflag to the spawned execution command so that the Linuxbubblewrapnamespace / socket proxies are stood up correctly, enablingautoAllowBashIfSandboxedto function as documented.Why This Matters (Approval Fatigue)
As cited in Anthropic documentation, sandboxing reduces permission prompts by ~84%. Static allowlists structurally cannot account for the long tail of complex developer commands (e.g., recursive operations, dynamically evaluated variables, or compound pipes). For IDE extension users, this makes the tool significantly more frustrating to use than its terminal counterpart.
Environment
Steps to Reproduce
.claude/settings.local.json:This is a regression, not a feature request — last-good version is known
Adding context that reframes this and should make it cheaper to fix.
#31865 ([BUG]
autoAllowBashIfSandboxedregression in v2.1.70+ VSCode extension — write commands prompt despite sandbox) reports that this exact behavior worked in the extension in v2.1.68 and broke in v2.1.70:That issue was not closed as "won't fix" or "by design" — it was auto-closed by the bot for inactivity (
NOT_PLANNED, "Closing for now — inactive for too long"), with no maintainer ever responding, and is now locked. So the capability is not something that "was never supported in the IDE" — it demonstrably shipped and worked, then regressed and the report quietly aged out.So the ask here is "restore v2.1.68 behavior", not "build something new":
autoAllowBashIfSandboxed)For what it's worth, the sandbox area has had fixes land recently — e.g. #31804 (macOS sandbox prerequisites) was closed
COMPLETED— so this isn't an untouched subsystem; the extension-side activation path just seems to have been missed by that work.Could this be re-triaged as a regression and pinned to a milestone rather than left to auto-close? Happy to provide extension logs or a git-bisect-style confirmation across v2.1.68 → v2.1.70 if that helps narrow the spawn-flag change.
Narrowing the bug: the sandbox runtime is active in the extension — it's
autoAllowBashIfSandboxedthat isn't wired to itCorrecting/sharpening my own report. The problem is not "the extension never starts the sandbox." It does. The problem is that auto-allow is not applied on top of the running sandbox.
Evidence from inside a Bash tool call in the VS Code extension (entrypoint
claude-vscode, v2.1.156, Linux):So the sandbox runtime is up and the network proxy is live. Confirmed empirically:
curl https://registry.npmjs.org/fails withCONNECT tunnel failed, response 403— the proxy is rejecting non-allowlisted domains exactly as designed.…and yet, with this in
.claude/settings.local.json:Bash commands still hit manual permission prompts —
$(...)substitutions, compounda && b, and any non-allowlisted command all prompt, despite the sandbox demonstrably running. SoautoAllowBashIfSandboxed: trueis being ignored even though the very condition it gates on (commands running inside the sandbox) is satisfied./sandboxbehaviorIn this extension build,
/sandboxnow returns "/sandbox isn't available in this environment" (previously "No matching commands"). Consistent with the runtime being managed by the environment rather than the in-app panel — but it leaves users with no UI to toggle auto-allow, and the settings.json key doesn't take effect either.Net
This lines up with the #31865 regression (worked v2.1.68 → broke v2.1.70). The narrowed ask: in the extension, when
SANDBOX_RUNTIMEis active, honorautoAllowBashIfSandboxedso sandboxed Bash auto-approves — i.e. reconnect the auto-allow path to the already-running sandbox, rather than (re)starting anything.Happy to capture extension logs around a prompted command if the proxy/auto-allow handoff is logged.
I'm seeing the behavior @enomado describes, but in addition, when the sandbox is used in the TUI, it asks for permissions for non-allow listed domains, this prompt doesn't appear in VS Code, the request is just blocked automatically.