feat(plan): add "Yes, restore previous mode" option when exiting plan mode#3008
Conversation
… mode When exiting plan mode, users previously had no way to restore their original approval mode (e.g. YOLO). Add a new default option that restores the pre-plan approval mode, with a dynamic label showing which mode will be restored. Closes #3002
📋 Review SummaryThis PR implements a "Restore Previous Mode" option when exiting plan mode, allowing users to return to their pre-plan approval mode (e.g., YOLO, AUTO_EDIT). The implementation is well-structured with comprehensive test coverage and proper i18n support across 6 locales. 🔍 General Feedback
🎯 Specific Feedback🟡 High
🟢 Medium
🔵 Low
✅ Highlights
|
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
What this PR doesWhen exiting plan mode, the approval dialog previously offered 3 options — none of which could restore the user's original mode (e.g., YOLO → plan → ???). This PR adds a 4th option "Yes, restore previous mode (xxx)" as the default selection, using the existing The 4 options are now:
Key changes:
Manual testingTested locally by building and running qwen-code in YOLO mode:
Unit test resultsAll 22 tests pass, including 4 new tests for TypeScript compiles clean, build succeeds. |
There was a problem hiding this comment.
Pull request overview
Adds a new default confirmation option when exiting plan mode to restore the approval mode that was active before entering plan mode (e.g., yolo / auto-edit / default), addressing the inability for YOLO users to easily return to YOLO after approving a plan.
Changes:
- Adds
ToolConfirmationOutcome.RestorePreviousand passesprePlanModethrough plan confirmation details. - Implements
RestorePrevioushandling inexit_plan_modeand updates CLI + ACP/WebUI option lists to include it as the first/default choice. - Adds i18n strings for the new option and expands exit-plan-mode test coverage.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/tools/tools.ts | Extends plan confirmation details with prePlanMode and introduces RestorePrevious outcome. |
| packages/core/src/tools/exitPlanMode.ts | Implements restore-previous behavior when confirming plan exit. |
| packages/core/src/tools/exitPlanMode.test.ts | Adds tests for restoring pre-plan mode and for including prePlanMode in details. |
| packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx | Adds the new “restore previous mode” option as the first/default CLI selection. |
| packages/cli/src/acp-integration/session/permissionUtils.ts | Adds the new option to ACP permission options for plan confirmations. |
| packages/cli/src/acp-integration/session/Session.ts | Updates outcome exhaustiveness handling to include RestorePrevious. |
| packages/cli/src/i18n/locales/{en,de,ja,pt,ru,zh}.js | Adds translations for the new option label. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add RestorePrevious to telemetry decision mapping as ACCEPT - Fix sendCurrentModeUpdateNotification to read actual mode for RestorePrevious instead of defaulting to 'default'
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tanzhenxin
left a comment
There was a problem hiding this comment.
Review — feat(plan): add "Yes, restore previous mode" option when exiting plan mode
Files changed: 14 (+142 / -0)
Core mechanism is correctly implemented — closure-based capture of prePlanMode avoids race conditions, good test coverage for the core logic, and clean integration with the existing ToolConfirmationOutcome enum. LGTM!
… mode (QwenLM#3008) * feat(plan): add "Yes, restore previous mode" option when exiting plan mode When exiting plan mode, users previously had no way to restore their original approval mode (e.g. YOLO). Add a new default option that restores the pre-plan approval mode, with a dynamic label showing which mode will be restored. Closes QwenLM#3002 * test: add fallback test for RestorePrevious when no prePlanMode recorded * fix: handle RestorePrevious in telemetry and ACP mode notification - Add RestorePrevious to telemetry decision mapping as ACCEPT - Fix sendCurrentModeUpdateNotification to read actual mode for RestorePrevious instead of defaulting to 'default' * test: add plan confirmation tests for RestorePrevious in permissionUtils




Summary
yolo,auto-edit,default)Changes
tools.ts: AddRestorePrevioustoToolConfirmationOutcomeenum; addprePlanModefield toToolPlanConfirmationDetailsexitPlanMode.ts: HandleRestorePreviousoutcome; passprePlanModeto confirmation detailsToolConfirmationMessage.tsx: Add new option as first (default) selectionpermissionUtils.ts: Add new option for ACP/WebUISession.ts: HandleRestorePreviousin exhaustive switchTest plan
RestorePreviousrestores YOLO when entered from YOLORestorePreviousrestores AUTO_EDIT when entered from AUTO_EDITprePlanModeis included in confirmation detailsProceedOncestill sets DEFAULT (unchanged)ProceedAlwaysstill sets AUTO_EDIT (unchanged)Closes #3002