Skip to content

feat: add "Yes, restore previous mode" option when exiting plan mode #3002

@zhangxy-zju

Description

@zhangxy-zju

Problem

When exiting plan mode via the exit_plan_mode tool, users are presented with 3 options:

  1. Yes, and auto-accept edits → AUTO_EDIT
  2. Yes, and manually approve edits → DEFAULT
  3. No, keep planning (esc) → PLAN

If the user entered plan mode from YOLO mode, none of the current options restore YOLO. Selecting "Yes, and auto-accept edits" switches to AUTO_EDIT (which still requires manual approval for shell commands), and "Yes, and manually approve edits" switches to DEFAULT. The user is forced to manually switch back to YOLO via Shift+Tab or /approval-mode yolo after every plan approval.

Proposal

Add a 4th option "Yes, restore previous mode" (as the default selection) that restores the approval mode that was active before entering plan mode, using the existing config.getPrePlanMode() mechanism.

The updated option list would be:

# Label Behavior
1 Yes, restore previous mode (default) config.getPrePlanMode()
2 Yes, and auto-accept edits ApprovalMode.AUTO_EDIT
3 Yes, and manually approve edits ApprovalMode.DEFAULT
4 No, keep planning (esc) ApprovalMode.PLAN

Why this matters

  • YOLO users expect to return to YOLO after approving a plan — the current flow silently downgrades their permission level
  • AUTO_EDIT users similarly expect to return to AUTO_EDIT, not DEFAULT
  • The prePlanMode tracking infrastructure already exists in config.ts (getPrePlanMode() / setApprovalMode()), so the backend is ready — only the UI option and a new ToolConfirmationOutcome (or reuse of an existing one) need to be wired up

Implementation hints

  1. Add option in ToolConfirmationMessage.tsx with a new outcome mapped to getPrePlanMode()
  2. Handle the new outcome in exitPlanMode.ts onConfirm() callback
  3. Consider dynamically labeling it (e.g., "Yes, restore previous mode (yolo)") so the user knows which mode they're returning to

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions