bypassPermissions mode silently downgrades to acceptEdits after approving a suspicious path prompt
Status Fixed / completed
Maintainer reply ✓ Yes — ashwin-ant
Workaround ✓ Mentioned in thread ↓
Activity 4 comments · opened Apr 1, 2026 · closed Apr 18, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator)
responded on this thread — see the highlighted reply below.
Description
When running Claude Code in bypassPermissions mode (via --dangerously-skip-permissions), if a "suspicious path pattern" prompt appears and the user selects option 2 ("Yes, and always allow access to ... from this project"), the permission mode silently downgrades from bypassPermissions to acceptEdits.
Steps to Reproduce
- Start Claude Code with
--dangerously-skip-permissions(or aliasclaude='claude --dangerously-skip-permissions') - Confirm the mode is
bypassPermissionsin the status bar - Run a task that creates a directory with an underscore in the path (e.g.,
mkdir -p "/path/to/NFLX-Netflix_ Inc.") - Claude Code shows a permission prompt: "contains a suspicious Windows path pattern that requires manual approval"
- Select option 2: "Yes, and always allow access to ... from this project"
- Observe: the mode has changed from
bypassPermissionstoacceptEdits
Expected Behavior
After approving the prompt, the mode should remain bypassPermissions. The user explicitly chose bypass mode and only interacted with the prompt because the system forced it — this should not change the overall permission mode.
Actual Behavior
The mode silently downgrades to acceptEdits. The user has to press Shift+Tab multiple times to cycle back to bypassPermissions.
Environment
- macOS (Darwin 25.0.0)
- Claude Code CLI
~/.zshrcalias:alias claude='claude --dangerously-skip-permissions'settings.json:{"skipDangerousModePermissionPrompt": true}
4 Comments
Root Cause Analysis (source-level)
_Traced through the published source and verified independently via Codex review._
The bug is a missing permission-mode guard in
BashTool/pathValidation.tsandPowerShellTool/pathValidation.tsthat unconditionally downgrades the permission mode toacceptEditswhen a safety-check prompt is approved.---
The bug: unconditional
setMode: 'acceptEdits'in suggestionsFile:
src/tools/BashTool/pathValidation.ts(lines 769–776)When a Bash command triggers a safety-check permission prompt (suspicious path pattern, protected file, etc.), this code unconditionally adds
setMode: 'acceptEdits'to the suggestion list — regardless of the current permission mode.The same bug exists in three locations:
src/tools/BashTool/pathValidation.ts:770— Bash write/create operationssrc/tools/PowerShellTool/pathValidation.ts:1792— PowerShell write/create (first site)src/tools/PowerShellTool/pathValidation.ts:1905— PowerShell write/create (second site)The approval flow that triggers the downgrade
When the user approves a safety-check prompt via "Yes, and always allow..." (
yes-apply-suggestions):BashPermissionRequest.tsx(line ~399) passespermissionResult.suggestionsdirectly toonAllow()interactiveHandler.ts(line ~154) forwards the suggestions unchangedPermissionUpdate.ts(line 55) appliessetModeby direct assignment — no downgrade check:``
typescript
``case 'setMode':
return { ...context, mode: update.mode } // Unconditional
bypassPermissions→acceptEditsWhy safety checks fire in bypassPermissions mode
This is correct behavior —
permissions.tsstep 1g (line 1257–1264) makes safety checks bypass-immune:The prompt should appear (correct), but approving it should NOT downgrade the permission mode (bug).
The fix already exists — in a different file
src/utils/permissions/filesystem.ts(lines 1439–1446) has exactly the guard thatBashToolandPowerShellToolare missing:The file-edit path correctly only suggests
acceptEditswhen the current mode is'default'or'plan'(where it's an upgrade). The Bash/PowerShell paths are missing this same guard.---
Suggested Fix
Add the
shouldSuggestAcceptEditsguard to all three affected sites:Apply at:
src/tools/BashTool/pathValidation.ts:770src/tools/PowerShellTool/pathValidation.ts:1792src/tools/PowerShellTool/pathValidation.ts:1905A centralized downgrade guard in
applyPermissionUpdate()was considered but rejected — that function is used for legitimate downward transitions (e.g., ExitPlanMode → default, permissionSetup → default), so a blanket block would break real flows.---
Immediate Workaround
After the mode downgrades, press Shift+Tab to cycle back through permission modes to
bypassPermissions.---
Related Issues
--dangerously-skip-permissions_Analysis based on source code, verified by independent Codex review._
Additional reproduction data from Windows 11 Desktop app (Claude Opus 4.6, 1M context):
5 occurrences in a single 3-hour session. Trigger confirmed: any Write/Edit tool call targeting paths outside the project root (e.g., ~/.claude/memory/, C:\BugTracker\) causes bypass mode to silently downgrade to acceptEdits. Parallel Agent (Explore) calls reading across multiple directory trees also triggered it.
git push alone (without prior out-of-project writes) did NOT trigger it. Bash echo to /tmp triggered a sandbox prompt but did NOT downgrade the mode — different mechanism.
This matches the 'suspicious path pattern' trigger described in this issue.
This was fixed in v2.1.97 — Approving a suspicious-path prompt no longer silently downgrades bypassPermissions or auto mode to acceptEdits. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.