[BUG] "Don't ask again" on unsandboxed prompt is a no-op
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When a command runs with dangerouslyDisableSandbox: true (e.g. git commit needing GPG access to ~/.gnupg), the prompt offers "Yes, and don't ask again for: git commit:*". This saves Bash(git commit:*) to permissions.allow, but that only skips the permission prompt — not the sandbox escape prompt.
Next time: the command auto-approves → runs sandboxed → fails → Claude retries unsandboxed → user is prompted again. Option 2 achieved nothing.
What Should Happen?
Option 2 should not be shown on unsandboxed command prompts since it cannot fulfill its promise of "don't ask again".
Reproduction case
GPG-signed git commits with sandbox enabled:
Bash command (unsandboxed)
git commit -m "fix typo"
This command requires approval
1. Yes
2. Yes, and don't ask again for: git commit:*
3. No
This prompt appears because git commit needs write access to ~/.gnupg for GPG signing, which the sandbox blocks. Selecting option 2 adds Bash(git commit:*) to permissions, but the next commit still fails sandboxed and prompts again when retried unsandboxed.
Steps to Reproduce
- Enable sandbox with
autoAllowBashIfSandboxed: true - Have GPG commit signing enabled,
~/.gnupgNOT inallowWrite - Ask Claude to commit — sandboxed attempt fails, retries unsandboxed
- Select "Yes, and don't ask again for: git commit:*"
- Ask Claude to commit again — prompted again
Is this a regression?
I don't know
Claude Code Version
2.1.79 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
ghostty/fish
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗