Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(chat): keep a cancelled tool off the success icon, and type the new tests

M3gA-Mindda5c45de376b
diff --git a/app/src/features/conversations/components/AssistantUiToolCall.tsx b/app/src/features/conversations/components/AssistantUiToolCall.tsx
index dd0dfb19bd..4cf79e6bde 100644
--- a/app/src/features/conversations/components/AssistantUiToolCall.tsx
+++ b/app/src/features/conversations/components/AssistantUiToolCall.tsx
@@ -143,6 +143,11 @@ export function AssistantUiToolCallCard({
? 'running'
: 'done';
const failed = status === 'error';
+ // `failed` gates the failure-explanation block, which only an `error` carries.
+ // The icon is a wider question: a cancelled call did not succeed either, and
+ // before the adapter forwarded a status this branch was unreachable, so the
+ // check icon sat next to the word "cancelled".
+ const terminalNonSuccess = failed || status === 'cancelled';
return (
<Collapsible
@@ -164,7 +169,7 @@ export function AssistantUiToolCallCard({
<span className="flex shrink-0 items-center gap-1 text-[11px]">
{running ? (
<Loader2Icon className="size-3 animate-spin [animation-duration:0.6s]" />
- ) : failed ? (
+ ) : terminalNonSuccess ? (
<CircleXIcon className="size-3.5" />
) : (
<CheckIcon className="size-3.5" />
diff --git a/app/src/features/conversations/components/ChatToolParts.test.tsx b/app/src/features/conversations/components/ChatToolParts.test.tsx
index 9fba803e40..1aa5c2dd93 100644
--- a/app/src/features/conversations/components/ChatToolParts.test.tsx
+++ b/app/src/features/conversations/components/ChatToolParts.test.tsx
@@ -113,6 +113,33 @@ describe('ChatToolParts', () => {
expect(screen.getByText('running')).toBeInTheDocument();
});
+ it('does not show a success icon beside a cancelled tool', () => {
+ // The adapter forwards `cancelled` now, and the card gated its non-success
+ // icon on `error` alone — so the check icon sat next to the word
+ // "cancelled". `failed` still gates the failure-explanation block, which
+ // only an `error` carries.
+ const { container } = render(
+ <ChatToolFallback
+ type="tool-call"
+ toolName="web_search"
+ toolCallId="call-1"
+ args={{} as never}
+ argsText="{}"
+ result={{ status: 'cancelled' } as never}
+ status={{ type: 'complete' }}
+ addResult={() => {}}
+ resume={() => {}}
+ respondToApproval={() => {}}
+ />
+ );
+
+ expect(screen.getByText('cancelled')).toBeInTheDocument();
+ const card = screen.getByTestId('assistant-ui-tool-call');
+ expect(card.querySelector('.lucide-circle-x')).not.toBeNull();
+ expect(card.querySelector('.lucide-check')).toBeNull();
+ expect(container).toBeTruthy();
+ });
+
it('opens a group containing in-flight work on mount', () => {
render(
<ChatToolGroup group={{ type: 'group-tool-call', status: { type: 'running' }, indices: [0] }}>
diff --git a/app/src/providers/__tests__/assistantUiMessages.test.ts b/app/src/providers/__tests__/assistantUiMessages.test.ts
index 0d0974b1ec..0f6252986a 100644
--- a/app/src/providers/__tests__/assistantUiMessages.test.ts
+++ b/app/src/providers/__tests__/assistantUiMessages.test.ts
@@ -368,12 +368,12 @@ describe('recovered tool names', () => {
extraMetadata: { assistantUiToolNames: ['web_search', 'web_fetch'] },
}),
[
- tool({ id: 'c1', name: 'read_file', seq: 0, status: 'ok' }),
- tool({ id: 'c2', name: 'tool', seq: 1, status: 'ok' }),
- tool({ id: 'c3', name: 'tool', seq: 2, status: 'ok' }),
+ tool({ id: 'c1', name: 'read_file', seq: 0, status: 'success' }),
+ tool({ id: 'c2', name: 'tool', seq: 1, status: 'success' }),
+ tool({ id: 'c3', name: 'tool', seq: 2, status: 'success' }),
]
);
- const names = (converted.content as { type: string; toolName?: string }[])
+ const names = (converted.content as unknown as { type: string; toolName?: string }[])
.filter(part => part.type === 'tool-call')
.map(part => part.toolName);
expect(names).toEqual(['read_file', 'web_search', 'web_fetch']);
@@ -387,7 +387,7 @@ describe('terminal tool status', () => {
const converted = toThreadMessageLike(msg({ id: 'a', sender: 'agent', content: 'done' }), [
tool({ id: 'c1', name: 'web_search', seq: 0, status: 'error', result: 'boom' }),
]);
- const part = (converted.content as { type: string; result?: unknown }[]).find(
+ const part = (converted.content as unknown as { type: string; result?: unknown }[]).find(
candidate => candidate.type === 'tool-call'
);
expect(part?.result).toMatchObject({ status: 'error', value: 'boom' });
@@ -395,9 +395,9 @@ describe('terminal tool status', () => {
it('leaves a successful tool result untouched', () => {
const converted = toThreadMessageLike(msg({ id: 'a', sender: 'agent', content: 'done' }), [
- tool({ id: 'c1', name: 'web_search', seq: 0, status: 'ok', result: 'the answer' }),
+ tool({ id: 'c1', name: 'web_search', seq: 0, status: 'success', result: 'the answer' }),
]);
- const part = (converted.content as { type: string; result?: unknown }[]).find(
+ const part = (converted.content as unknown as { type: string; result?: unknown }[]).find(
candidate => candidate.type === 'tool-call'
);
expect(part?.result).toBe('the answer');
@@ -415,7 +415,7 @@ describe('narration merged into the final answer', () => {
[],
[{ kind: 'narration', round: 1, seq: 0, text: 'I will check the sources.' }]
);
- const texts = (converted.content as { type: string; text?: string }[])
+ const texts = (converted.content as unknown as { type: string; text?: string }[])
.filter(part => part.type === 'text')
.map(part => part.text);
expect(texts).toEqual([finalText]);