From 14b2f356777b678999536e2c811b6870894ec834 Mon Sep 17 00:00:00 2001 From: Jarrod Whelan <150866123+jwhelangoog@users.noreply.github.com> Date: Wed, 8 Apr 2026 15:19:25 -0700 Subject: [PATCH] fix(cli): restore file path display in edit and write tool confirmations (#24974) --- ...-the-frame-of-the-entire-terminal.snap.svg | 3 +- .../ToolConfirmationFullFrame.test.tsx.snap | 2 +- .../components/ToolConfirmationQueue.test.tsx | 38 +++++++++++++++++++ .../ui/components/ToolConfirmationQueue.tsx | 4 +- ...-and-content-for-large-edit-diffs.snap.svg | 3 +- .../ToolConfirmationQueue.test.tsx.snap | 6 +-- .../messages/DenseToolMessage.test.tsx | 22 +++++++++++ 7 files changed, 70 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame-Full-Terminal-Tool-Confirmation-Snapshot-renders-tool-confirmation-box-in-the-frame-of-the-entire-terminal.snap.svg b/packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame-Full-Terminal-Tool-Confirmation-Snapshot-renders-tool-confirmation-box-in-the-frame-of-the-entire-terminal.snap.svg index 7565185d93..42e28aac6a 100644 --- a/packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame-Full-Terminal-Tool-Confirmation-Snapshot-renders-tool-confirmation-box-in-the-frame-of-the-entire-terminal.snap.svg +++ b/packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame-Full-Terminal-Tool-Confirmation-Snapshot-renders-tool-confirmation-box-in-the-frame-of-the-entire-terminal.snap.svg @@ -14,7 +14,8 @@ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ - ? Edit + ? Edit + packages/.../InputPrompt.tsx: return kittyProtocolSupporte... => return kittyProto… ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ diff --git a/packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame.test.tsx.snap b/packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame.test.tsx.snap index d9cc9f7ce3..caebc9ae49 100644 --- a/packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame.test.tsx.snap +++ b/packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame.test.tsx.snap @@ -5,7 +5,7 @@ exports[`Full Terminal Tool Confirmation Snapshot > renders tool confirmation bo ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ -│ ? Edit │ +│ ? Edit packages/.../InputPrompt.tsx: return kittyProtocolSupporte... => return kittyProto… │ │ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ │ ... first 42 lines hidden (Ctrl+O to show) ... │ │ │ │ 43 const line43 = true; │ │ diff --git a/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx b/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx index 58a78d3c24..e48c244bdf 100644 --- a/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx +++ b/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx @@ -66,6 +66,44 @@ describe('ToolConfirmationQueue', () => { vi.clearAllMocks(); }); + it('explicitly renders the tool description (containing filename) for edit confirmations', async () => { + const confirmingTool = { + tool: { + callId: 'call-1', + name: 'Edit', + description: 'Editing src/main.ts', + status: CoreToolCallStatus.AwaitingApproval, + confirmationDetails: { + type: 'edit' as const, + title: 'Confirm edit', + fileName: 'main.ts', + filePath: '/src/main.ts', + fileDiff: '--- a/main.ts\n+++ b/main.ts\n@@ -1 +1 @@\n-old\n+new', + originalContent: 'old', + newContent: 'new', + }, + }, + index: 1, + total: 1, + }; + + const { lastFrame, unmount } = await renderWithProviders( + , + { + config: mockConfig, + uiState: { + terminalWidth: 80, + }, + }, + ); + + const output = lastFrame(); + expect(output).toContain('Editing src/main.ts'); + unmount(); + }); + it('renders the confirming tool with progress indicator', async () => { const confirmingTool = { tool: { diff --git a/packages/cli/src/ui/components/ToolConfirmationQueue.tsx b/packages/cli/src/ui/components/ToolConfirmationQueue.tsx index 1a836662b7..fd9c51ae1a 100644 --- a/packages/cli/src/ui/components/ToolConfirmationQueue.tsx +++ b/packages/cli/src/ui/components/ToolConfirmationQueue.tsx @@ -98,9 +98,9 @@ export const ToolConfirmationQueue: React.FC = ({ ? {toolLabel} - {!isEdit && !!tool.description && ' '} + {!!tool.description && ' '} - {!isEdit && !!tool.description && ( + {!!tool.description && ( {tool.description} diff --git a/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue-ToolConfirmationQueue-height-allocation-and-layout-should-render-the-full-queue-wrapper-with-borders-and-content-for-large-edit-diffs.snap.svg b/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue-ToolConfirmationQueue-height-allocation-and-layout-should-render-the-full-queue-wrapper-with-borders-and-content-for-large-edit-diffs.snap.svg index bbfedfab59..a257a1253c 100644 --- a/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue-ToolConfirmationQueue-height-allocation-and-layout-should-render-the-full-queue-wrapper-with-borders-and-content-for-large-edit-diffs.snap.svg +++ b/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue-ToolConfirmationQueue-height-allocation-and-layout-should-render-the-full-queue-wrapper-with-borders-and-content-for-large-edit-diffs.snap.svg @@ -6,7 +6,8 @@ ╭──────────────────────────────────────────────────────────────────────────────╮ - ? replace + ? replace + Replaces content in a file ╭──────────────────────────────────────────────────────────────────────────╮ diff --git a/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue.test.tsx.snap index 9214e58713..238efefba4 100644 --- a/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue.test.tsx.snap @@ -2,7 +2,7 @@ exports[`ToolConfirmationQueue > calculates availableContentHeight based on availableTerminalHeight from UI state 1`] = ` "╭──────────────────────────────────────────────────────────────────────────────╮ -│ ? replace │ +│ ? replace edit file │ │ ╭──────────────────────────────────────────────────────────────────────────╮ │ │ ╰─... 48 hidden (Ctrl+O) ...───────────────────────────────────────────────╯ │ │ Apply this change? │ @@ -17,7 +17,7 @@ exports[`ToolConfirmationQueue > calculates availableContentHeight based on avai exports[`ToolConfirmationQueue > does not render expansion hint when constrainHeight is false 1`] = ` "╭──────────────────────────────────────────────────────────────────────────────╮ -│ ? replace │ +│ ? replace edit file │ │ ╭──────────────────────────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ No changes detected. │ │ @@ -63,7 +63,7 @@ exports[`ToolConfirmationQueue > height allocation and layout > should handle se exports[`ToolConfirmationQueue > height allocation and layout > should render the full queue wrapper with borders and content for large edit diffs 1`] = ` "╭──────────────────────────────────────────────────────────────────────────────╮ -│ ? replace │ +│ ? replace Replaces content in a file │ │ ╭──────────────────────────────────────────────────────────────────────────╮ │ │ │ ... 13 hidden (Ctrl+O) ... │ │ │ │ 7 + const newLine7 = true; │ │ diff --git a/packages/cli/src/ui/components/messages/DenseToolMessage.test.tsx b/packages/cli/src/ui/components/messages/DenseToolMessage.test.tsx index e187c3343b..30879b13b3 100644 --- a/packages/cli/src/ui/components/messages/DenseToolMessage.test.tsx +++ b/packages/cli/src/ui/components/messages/DenseToolMessage.test.tsx @@ -34,6 +34,28 @@ describe('DenseToolMessage', () => { terminalWidth: 80, }; + it('explicitly renders the filename in the header for FileDiff results', async () => { + const fileDiff: FileDiff = { + fileName: 'test-file.ts', + filePath: '/test-file.ts', + fileDiff: + '--- a/test-file.ts\n+++ b/test-file.ts\n@@ -1 +1 @@\n-old\n+new', + originalContent: 'old', + newContent: 'new', + }; + + const { lastFrame, waitUntilReady } = await renderWithProviders( + , + ); + await waitUntilReady(); + const output = lastFrame(); + expect(output).toContain('test-file.ts'); + }); + it('renders correctly for a successful string result', async () => { const { lastFrame, waitUntilReady } = await renderWithProviders( ,