bypassPermissions mode not persisted — resets mid-session and prompts for file edits
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment
- Version: 2.1.86 (broken since 2.1.77)
- Platform: Windows 11 Pro, VS Code extension + CLI
- Permission mode:
bypassPermissionsset in~/.claude/settings.json
Description
bypassPermissions mode is not respected — file edits (Write/Edit tools) still prompt for user approval. The mode also silently resets to default mid-session (after compaction or error recovery).
Root Cause (found via source analysis)
Three bugs compound:
persistDefaultPermissionMode()explicitly excludesbypassPermissions:
``js`
if(K!=="default"&&K!=="auto"&&K!=="acceptEdits")return
bypassPermissions` from ever being saved to session state.
This guard prevents
sessionBypassPermissionsModehardcoded tofalse:
Session state always initializes with false, so any state reconstruction loses bypass.
- Mid-session recovery can't restore bypass: Compaction or error recovery reloads from persisted state, but bypass was never saved (due to #1), so it falls back to default.
What Should Happen?
bypassPermissions should be respected when set, to not prompting for permissions.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Set
"permissions": {"defaultMode": "bypassPermissions"}in~/.claude/settings.json - Start a session (CLI or VS Code)
- Ask Claude to edit any file
- Expected: Edit happens without prompting
- Actual: User is prompted for approval
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.76
Claude Code Version
2.1.86
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Attempted Workaround
Patched extension.js to add &&K!=="bypassPermissions" to the guard — did not resolve the prompting, suggesting there's an additional check upstream.
Related Issues
- #36168 — Broken after v2.1.77
- #37181 — Edit prompts despite bypass
- #37157 — .claude/ hardcoded protections
- #39057 — Mode resets mid-session
- #12604 — VS Code ignores setting
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗