anthropics / anthropics/claude-code
[BUG] CLI ExitPlanMode prefers auto over the configured acceptEdits default — plan-exit can't return to acceptEdits
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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?
On the CLI, approving a plan offers one elevated accept row chosen by a fixed availability priority —
bypassPermissions > auto > acceptEdits — plus "manually approve edits" (default). With permissions.defaultMode:"acceptEdits" but auto mode merely available, the auto row displaces the acceptEdits row: the dialog shows "Yes, and use auto mode" / "Yes, and manually approve edits" / "No, keep planning" — no acceptEdits option. A user who deliberately configured acceptEdits (opting out of auto) can only approve into auto (rejected) or default, never their configured mode, so every plan approval silently moves the session off acceptEdits.
**Cause (from the bundle, cf. #94716)**: the exit-plan option builder (SBt) selects the elevated row by availability, not by configured default — else if (isAutoModeAvailable) {auto row} fires before the else {acceptEdits row}.
### What Should Happen?
the elevated accept row should follow the session's configured / pre-plan defaultMode, or offer a "return to prior mode" row. Same theme as #94716 (VS Code hardcodes the rows) and #93207 (iOS discards prePlanMode).
### Error Messages/Logs
```shell
```
### Steps to Reproduce
**Preconditions:** CLI (terminal); auto mode available for your account/model (it appears in the shift+tab permission-mode cycle); permissions.defaultMode: "acceptEdits".
1. In ~/.claude/settings.json set "permissions": { "defaultMode": "acceptEdits" }. Start a fresh claude session.
2. Confirm the session is in acceptEdits, and that auto is also selectable (cycle shift+tab — plan / acceptEdits / auto all present).
3. Enter plan mode and give the model a task so it produces a plan (e.g. "plan a small refactor").
4. Approve the plan when the ExitPlanMode chooser appears.
5. Observe the accept rows: Yes, and use auto mode / Yes, and manually approve edits / No, keep planning — there is no row that keeps/returns to acceptEdits.
6. Pick either accept row and check the mode (shift+tab indicator / statusline): the session is now auto or default — never back in acceptEdits.
**Contrast:** on a session where auto mode is not available, the same flow offers an acceptEdits accept row instead of the auto one (the else branch of SBt in #94716). So the trigger is specifically auto-available + defaultMode acceptEdits — the auto row displaces the acceptEdits one.
### Claude Model
Opus
### Is this a regression?
I don't know
### Last Working Version
_No response_
### Claude Code Version
2.1.236 (Claude Code)
### Platform
Anthropic API
### Operating System
macOS
### Terminal/Shell
Terminal.app (macOS)
### Additional Information
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the CLI flow with permissions.defaultMode set to acceptEdits and auto mode available, then inspect the bundled exit-plan option builder identified as SBt and the behavior discussed in #94716. Trace how the configured or pre-plan mode is selected for the elevated accept row. Done means plan approval offers a way to remain in or return to acceptEdits and the session mode reflects that choice.
Written by the indexing model from the issue text.
Assessment
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100