[BUG] "Don't ask again" on unsandboxed prompt is a no-op

Resolved 💬 4 comments Opened Mar 19, 2026 by davidgm0 Closed May 24, 2026

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

  1. Enable sandbox with autoAllowBashIfSandboxed: true
  2. Have GPG commit signing enabled, ~/.gnupg NOT in allowWrite
  3. Ask Claude to commit — sandboxed attempt fails, retries unsandboxed
  4. Select "Yes, and don't ask again for: git commit:*"
  5. 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

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗