claude-code - 💡(How to fix) Fix bypassPermissions state lost after ExitPlanMode — hardcoded reset to 'default' [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45284Fetched 2026-04-09 08:08:57
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1

When launching with --dangerously-skip-permissions, entering plan mode and exiting via ExitPlanMode causes the bypassPermissions state to be permanently lost. The permission mode is hardcoded to reset from "plan" to "default", with no mechanism to preserve or restore the original mode.

Root Cause

When launching with --dangerously-skip-permissions, entering plan mode and exiting via ExitPlanMode causes the bypassPermissions state to be permanently lost. The permission mode is hardcoded to reset from "plan" to "default", with no mechanism to preserve or restore the original mode.

Code Example

permissionMode:O?"plan":"default"

---

"plan"?"default":u
RAW_BUFFERClick to expand / collapse

Bug Report

Summary

When launching with --dangerously-skip-permissions, entering plan mode and exiting via ExitPlanMode causes the bypassPermissions state to be permanently lost. The permission mode is hardcoded to reset from "plan" to "default", with no mechanism to preserve or restore the original mode.

Steps to Reproduce

  1. Launch Claude Code with claude --dangerously-skip-permissions
  2. Enter plan mode (via /plan or automatic skill-triggered plan mode)
  3. Exit plan mode via ExitPlanMode (approve the plan)
  4. Observe: bypass permissions state is gone — tools now prompt for permission
  5. Observe: mode picker does not offer bypassPermissions as an option

Expected Behavior

After ExitPlanMode, the permission mode should be restored to whatever it was before entering plan mode. If launched with --dangerously-skip-permissions, bypass mode should persist through plan mode transitions.

Actual Behavior

  • ExitPlanMode hardcodes the permission mode reset: "plan""default"
  • The original bypassPermissions state is not saved or consulted
  • The mode picker UI after ExitPlanMode does not include bypass permissions as a selectable option
  • All tools (including those in permissions.allow) start prompting for approval

Source Code Evidence (v2.1.96)

In the minified cli.js, the plan mode exit logic contains:

permissionMode:O?"plan":"default"

and

"plan"?"default":u

This confirms a hardcoded transition from "plan" to "default" with no reference to the pre-plan permission mode.

Impact

  • --dangerously-skip-permissions and plan mode are mutually exclusive in practice
  • Any workflow using plan mode (including skills that automatically enter plan mode) breaks bypass permissions
  • Users must restart the session to recover bypass mode

Environment

  • Claude Code version: 2.1.96 (latest)
  • Platform: macOS (Darwin 25.2.0, arm64)
  • Installation: npm global
  • Terminal: CLI

Suggested Fix

Save the current permissionMode before entering plan mode, and restore it when ExitPlanMode is called, instead of hardcoding the reset to "default".

extent analysis

TL;DR

Save the current permission mode before entering plan mode and restore it when exiting plan mode to preserve the bypass permissions state.

Guidance

  • Identify the section of code responsible for resetting the permission mode after ExitPlanMode and modify it to restore the original mode instead of hardcoding to "default".
  • Introduce a variable to store the current permission mode before entering plan mode, allowing it to be restored later.
  • Update the mode picker UI to include bypass permissions as a selectable option after ExitPlanMode if the original mode was "bypassPermissions".
  • Verify the fix by launching with --dangerously-skip-permissions, entering and exiting plan mode, and checking if the bypass permissions state is preserved.

Example

// Before entering plan mode
const originalPermissionMode = permissionMode;

// ...

// When exiting plan mode
permissionMode = originalPermissionMode;

Notes

This solution assumes that the permissionMode variable is accessible and modifiable in the relevant sections of code. The actual implementation may vary depending on the specific code structure and requirements.

Recommendation

Apply workaround: Modify the code to save and restore the permission mode as suggested, as this directly addresses the identified issue and preserves the bypass permissions state.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING