From 32526523bbacb649d25d5c275d5378fe0827c0d5 Mon Sep 17 00:00:00 2001 From: Dmitry Lyalin Date: Thu, 12 Feb 2026 23:51:17 -0500 Subject: [PATCH] fix(cli): keep plan-exit mode choice user-controlled --- .../ui/components/ExitPlanModeDialog.test.tsx | 6 +- .../src/ui/components/ExitPlanModeDialog.tsx | 69 +++++++++---------- .../ExitPlanModeDialog.test.tsx.snap | 16 ++--- 3 files changed, 45 insertions(+), 46 deletions(-) diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx index c68cbd3cc5..dc0e22dc1c 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx @@ -214,7 +214,7 @@ Implement a comprehensive authentication system with multiple providers. }); }); - it('calls onApprove with DEEP_WORK when deep work is recommended and selected first', async () => { + it('calls onApprove with DEEP_WORK when deep work is recommended and selected', async () => { const { stdin, lastFrame } = renderDialog({ useAlternateBuffer, deepWorkEnabled: true, @@ -228,8 +228,12 @@ Implement a comprehensive authentication system with multiple providers. await waitFor(() => { expect(lastFrame()).toContain('Add user authentication'); expect(lastFrame()).toContain('Deep Work'); + expect(lastFrame()).toContain( + 'Yes, start Deep Work execution (Recommended)', + ); }); + writeKey(stdin, '\x1b[B'); // Down arrow to Deep Work writeKey(stdin, '\r'); await waitFor(() => { diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx index 81dcc57267..d64dfcfd7d 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx @@ -243,49 +243,44 @@ export const ExitPlanModeDialog: React.FC = ({ ? ApprovalMode.AUTO_EDIT : computedRecommendation; + const autoOptionLabel = + effectiveRecommendation === ApprovalMode.AUTO_EDIT + ? `${ApprovalOption.Auto} (Recommended)` + : ApprovalOption.Auto; + const deepWorkOptionLabel = + effectiveRecommendation === ApprovalMode.DEEP_WORK + ? `${ApprovalOption.DeepWork} (Recommended)` + : ApprovalOption.DeepWork; + const manualOptionLabel = + effectiveRecommendation === ApprovalMode.DEFAULT + ? `${ApprovalOption.Manual} (Recommended)` + : ApprovalOption.Manual; + const approvalOptions = deepWorkEnabled - ? effectiveRecommendation === ApprovalMode.DEEP_WORK - ? [ - { - label: `${ApprovalOption.DeepWork} (Recommended)`, - description: - 'Approves plan and uses iterative Deep Work execution with readiness checks.', - }, - { - label: ApprovalOption.Auto, - description: - 'Approves plan and runs regular implementation with automatic edits.', - }, - { - label: ApprovalOption.Manual, - description: - 'Approves plan but requires confirmation before each tool call.', - }, - ] - : [ - { - label: `${ApprovalOption.Auto} (Recommended)`, - description: - 'Approves plan and runs regular implementation with automatic edits.', - }, - { - label: ApprovalOption.DeepWork, - description: - 'Approves plan and uses iterative Deep Work execution with readiness checks.', - }, - { - label: ApprovalOption.Manual, - description: - 'Approves plan but requires confirmation before each tool call.', - }, - ] + ? [ + { + label: autoOptionLabel, + description: + 'Approves plan and runs regular implementation with automatic edits.', + }, + { + label: deepWorkOptionLabel, + description: + 'Approves plan and uses iterative Deep Work execution with readiness checks.', + }, + { + label: manualOptionLabel, + description: + 'Approves plan but requires confirmation before each tool call.', + }, + ] : [ { - label: ApprovalOption.Auto, + label: autoOptionLabel, description: 'Approves plan and allows tools to run automatically.', }, { - label: ApprovalOption.Manual, + label: manualOptionLabel, description: 'Approves plan but requires confirmation for each tool.', }, ]; diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 6cbf8590ac..34ae2100c2 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -17,7 +17,7 @@ Implementation Steps Files to Modify ... last 3 lines hidden ... - 1. Yes, automatically accept edits + 1. Yes, automatically accept edits (Recommended) Approves plan and allows tools to run automatically. 2. Yes, manually accept edits Approves plan but requires confirmation for each tool. @@ -43,7 +43,7 @@ Implementation Steps Files to Modify ... last 3 lines hidden ... - 1. Yes, automatically accept edits + 1. Yes, automatically accept edits (Recommended) Approves plan and allows tools to run automatically. 2. Yes, manually accept edits Approves plan but requires confirmation for each tool. @@ -71,7 +71,7 @@ Implementation Steps 6. Add LDAP provider support in src/auth/providers/LDAPProvider.ts ... last 24 lines hidden ... -● 1. Yes, automatically accept edits +● 1. Yes, automatically accept edits (Recommended) Approves plan and allows tools to run automatically. 2. Yes, manually accept edits Approves plan but requires confirmation for each tool. @@ -97,7 +97,7 @@ Implementation Steps Files to Modify ... last 3 lines hidden ... -● 1. Yes, automatically accept edits +● 1. Yes, automatically accept edits (Recommended) Approves plan and allows tools to run automatically. 2. Yes, manually accept edits Approves plan but requires confirmation for each tool. @@ -125,7 +125,7 @@ Files to Modify - src/index.ts - Add auth middleware - src/config.ts - Add auth configuration options - 1. Yes, automatically accept edits + 1. Yes, automatically accept edits (Recommended) Approves plan and allows tools to run automatically. 2. Yes, manually accept edits Approves plan but requires confirmation for each tool. @@ -153,7 +153,7 @@ Files to Modify - src/index.ts - Add auth middleware - src/config.ts - Add auth configuration options - 1. Yes, automatically accept edits + 1. Yes, automatically accept edits (Recommended) Approves plan and allows tools to run automatically. 2. Yes, manually accept edits Approves plan but requires confirmation for each tool. @@ -204,7 +204,7 @@ Testing Strategy - Security penetration testing - Load testing for session management -● 1. Yes, automatically accept edits +● 1. Yes, automatically accept edits (Recommended) Approves plan and allows tools to run automatically. 2. Yes, manually accept edits Approves plan but requires confirmation for each tool. @@ -232,7 +232,7 @@ Files to Modify - src/index.ts - Add auth middleware - src/config.ts - Add auth configuration options -● 1. Yes, automatically accept edits +● 1. Yes, automatically accept edits (Recommended) Approves plan and allows tools to run automatically. 2. Yes, manually accept edits Approves plan but requires confirmation for each tool.