From 232e021f0e96ff692e3ea364290cc7f44c833eb5 Mon Sep 17 00:00:00 2001 From: xiami762 Date: Tue, 11 Aug 2026 11:36:41 +0800 Subject: [PATCH] fix(webui): deduplicate bash tool errors --- .../src/components/common/SessionChat.test.ts | 23 +++++++++++++++++++ webui/src/components/common/SessionChat.tsx | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/webui/src/components/common/SessionChat.test.ts b/webui/src/components/common/SessionChat.test.ts index 698138064..29978f308 100644 --- a/webui/src/components/common/SessionChat.test.ts +++ b/webui/src/components/common/SessionChat.test.ts @@ -3818,6 +3818,29 @@ describe('ChatToolPart bash rendering', () => { expect(screen.getByText('$').closest('pre')).toHaveClass('max-h-64'); expect(screen.getByText('tests passed').closest('pre')).toHaveClass('max-h-64'); }); + + it.each([ + 'Tool execution was interrupted', + 'Command failed with exit code 1', + ])('renders the bash error once: %s', (error) => { + render( + React.createElement(ChatToolPart, { + part: { + id: 'bash-error-part', + type: 'tool', + tool: 'bash', + callID: 'call-bash-error', + state: { + status: 'error', + input: { command: 'exit 1' }, + error, + }, + } as any, + }), + ); + + expect(screen.getAllByText(error)).toHaveLength(1); + }); }); describe('ChatToolPart question result rendering', () => { diff --git a/webui/src/components/common/SessionChat.tsx b/webui/src/components/common/SessionChat.tsx index 0be01168a..cf3d3cdcd 100644 --- a/webui/src/components/common/SessionChat.tsx +++ b/webui/src/components/common/SessionChat.tsx @@ -6275,7 +6275,7 @@ export function ChatToolPart({ part, pendingQuestion, onAnswer, onReject, proces )} - {status === 'error' && state.error && ( + {!isBashTool && status === 'error' && state.error && (
{state.error}