diff --git a/src/renderer/src/components/native-chat/NativeChatToolRun.test.tsx b/src/renderer/src/components/native-chat/NativeChatToolRun.test.tsx index 37958297ae0..cdec3271533 100644 --- a/src/renderer/src/components/native-chat/NativeChatToolRun.test.tsx +++ b/src/renderer/src/components/native-chat/NativeChatToolRun.test.tsx @@ -456,6 +456,29 @@ describe('NativeChatToolRun', () => { ).toEqual(['lucide-chevron-right']) }) + it('heads a projected diff run with the file-change glyph, not the generic one', () => { + const projected = projectStructuredItemToNativeChat({ + itemId: 'file-change', + revision: 1, + sequence: 1, + observedAt: 1, + body: { + kind: 'diff', + path: 'src/a.ts', + patch: { head: '@@ -1 +1 @@\n-was\n+now', truncated: false, byteLength: 24 } + } + }) + + const { container } = render( + + ) + + // The run renders an edited-file card, so a wrench above it reads as a tool + // this vocabulary does not model. + expect(container.querySelector('.lucide-pencil')).toBeInTheDocument() + expect(container.querySelector('.lucide-wrench')).toBeNull() + }) + it('labels a bare list row by the command it ran rather than an invented path', () => { const blocks: NativeChatBlock[] = [ { diff --git a/src/shared/native-chat-tool-icon.test.ts b/src/shared/native-chat-tool-icon.test.ts index d7adf2ca466..56464b0f347 100644 --- a/src/shared/native-chat-tool-icon.test.ts +++ b/src/shared/native-chat-tool-icon.test.ts @@ -67,6 +67,13 @@ describe('native chat tool icons', () => { } }) + it('reads the projected `Diff` row as a file change, which is what it renders', () => { + // Every Codex fileChange item projects to a call named `Diff`, so a wrench + // here headed a run whose body is an edited-file card. + expect(nativeChatToolCategory('Diff')).toBe('fileChange') + expect(nativeChatToolIconName('Diff')).toBe('pencil') + }) + it('reads an MCP tool by its prefix, since the row is named after the tool', () => { expect(nativeChatToolCategory('mcp__linear__create_issue')).toBe('mcpToolCall') expect(nativeChatToolIconName('mcp__playwright__browser_click')).toBe('plug') diff --git a/src/shared/native-chat-tool-icon.ts b/src/shared/native-chat-tool-icon.ts index 99619ef363f..7b334bacd1d 100644 --- a/src/shared/native-chat-tool-icon.ts +++ b/src/shared/native-chat-tool-icon.ts @@ -65,6 +65,9 @@ const CATEGORY_BY_ROW_WORD = new Map([ ['read', 'read'], ['search', 'search'], ['list', 'listFiles'], + // Every Codex file change projects as a `Diff` call, and the edit set below + // names the tools that carry the edit in their input, not that projection. + ['diff', 'fileChange'], // Claude's tool names, which its lane renders verbatim. ['grep', 'search'], ['glob', 'search'],