bypassPermissions mode not persisted — resets mid-session and prompts for file edits

Resolved 💬 3 comments Opened Mar 28, 2026 by sorfanit Closed May 7, 2026

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: bypassPermissions set 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:

  1. persistDefaultPermissionMode() explicitly excludes bypassPermissions:

``js
if(K!=="default"&&K!=="auto"&&K!=="acceptEdits")return
`
This guard prevents
bypassPermissions` from ever being saved to session state.

  1. sessionBypassPermissionsMode hardcoded to false:

Session state always initializes with false, so any state reconstruction loses bypass.

  1. 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

  1. Set "permissions": {"defaultMode": "bypassPermissions"} in ~/.claude/settings.json
  2. Start a session (CLI or VS Code)
  3. Ask Claude to edit any file
  4. Expected: Edit happens without prompting
  5. 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

View original on GitHub ↗

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