Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(agents): show running and stopped tool calls with their own label (#8747)
gbirman067bfb5c14b5
diff --git a/apps/web/src/features/block-agent/component/parts/CodeExecutionToolCall.tsx b/apps/web/src/features/block-agent/component/parts/CodeExecutionToolCall.tsxindex 4e6ec2658c..d32362b297 100644--- a/apps/web/src/features/block-agent/component/parts/CodeExecutionToolCall.tsx+++ b/apps/web/src/features/block-agent/component/parts/CodeExecutionToolCall.tsx@@ -148,6 +148,7 @@ function RecordedCall(props: {label: props.call.name,status: status(),muted: props.call.status !== 'completed',+ stopped: false,trailing: props.call.outputOmitted? 'Result omitted': props.call.status === 'unknown' || props.call.status === 'running'diff --git a/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.test.tsx b/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.test.tsxindex 8ca2ba9475..8942d641cd 100644--- a/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.test.tsx+++ b/apps/web/src/features/block-agent/component/parts/DisplayResultsToolCall.test.tsx@@ -55,6 +55,7 @@ function common(label: 'DisplayResults',status,muted: status === 'failed',+ stopped: false,trailing: status === 'failed' ? 'Failed' : undefined,};}diff --git a/apps/web/src/features/block-agent/component/parts/ElicitationPart.tsx b/apps/web/src/features/block-agent/component/parts/ElicitationPart.tsxindex b78943b22f..29a105f6d9 100644--- a/apps/web/src/features/block-agent/component/parts/ElicitationPart.tsx+++ b/apps/web/src/features/block-agent/component/parts/ElicitationPart.tsx@@ -192,6 +192,7 @@ function ResolvedElicitation(props: { part: ElicitationPartData }) {status:reviewed().toolOutcome.kind === 'failed' ? 'failed' : 'completed',muted: reviewed().toolOutcome.kind === 'failed',+ stopped: false,trailing: undefined,}}// The tool has reported back, so nothing is still going out.diff --git a/apps/web/src/features/block-agent/component/parts/MacroToolCall.test.tsx b/apps/web/src/features/block-agent/component/parts/MacroToolCall.test.tsxindex ae0d9f816d..dd754bb161 100644--- a/apps/web/src/features/block-agent/component/parts/MacroToolCall.test.tsx+++ b/apps/web/src/features/block-agent/component/parts/MacroToolCall.test.tsx@@ -3,6 +3,7 @@*/import { fireEvent, render, screen } from '@solidjs/testing-library';+import { createSignal } from 'solid-js';import { describe, expect, it, vi } from 'vitest';import { MacroToolCall } from './MacroToolCall';import type { ToolCallContext } from './shared';@@ -36,6 +37,7 @@ describe('MacroToolCall failures', () => {label: 'ReadCalendarEvent',status: 'failed',muted: true,+ stopped: false,trailing: 'Failed',}}context={context}@@ -51,3 +53,103 @@ describe('MacroToolCall failures', () => {expect(screen.getByText(reason)).toBeTruthy();});});++describe('MacroToolCall unfinished calls', () => {+ const readEvent = {+ kind: 'macro' as const,+ input: { eventId: '01a16cb6-0000-7000-8000-000000000001' },+ output: null,+ error: null,+ };++ it('shows a running call by its own label while it runs', () => {+ render(() => (+ <MacroToolCall+ detail={readEvent}+ common={{+ id: 'call-1',+ label: 'ReadCalendarEvent',+ status: 'running',+ muted: false,+ stopped: false,+ trailing: undefined,+ }}+ context={{ ...context, inFlight: true }}+ />+ ));++ expect(screen.getByText('Read calendar event')).toBeTruthy();+ expect(screen.queryByText('ReadCalendarEvent')).toBeNull();+ expect(screen.queryByText('Failed')).toBeNull();+ });++ it('says a call cut off by its turn was stopped, by its own label', () => {+ render(() => (+ <MacroToolCall+ detail={readEvent}+ common={{+ id: 'call-1',+ label: 'ReadCalendarEvent',+ status: 'completed',+ muted: false,+ stopped: true,+ trailing: 'Stopped',+ }}+ context={context}+ />+ ));++ expect(screen.getByText('Read calendar event')).toBeTruthy();+ expect(screen.getByText('Stopped')).toBeTruthy();+ expect(screen.queryByText('Failed')).toBeNull();+ });++ it("shows a running call's latest arguments when the harness replaces them", () => {+ const [query, setQuery] = createSignal('first draft');+ render(() => (+ <MacroToolCall+ detail={{+ kind: 'macro',+ input: { input: query() },+ output: null,+ error: null,+ }}+ common={{+ id: 'call-1',+ label: 'WebSearch',+ status: 'running',+ muted: false,+ stopped: false,+ trailing: undefined,+ }}+ context={{ ...context, inFlight: true }}+ />+ ));+ expect(screen.getByText('first draft')).toBeTruthy();++ setQuery('launch checklist');++ expect(screen.getByText('launch checklist')).toBeTruthy();+ expect(screen.queryByText('first draft')).toBeNull();+ });++ it('keeps a running call whose arguments are still arriving on the summary row', () => {+ render(() => (+ <MacroToolCall+ detail={{ ...readEvent, input: {} }}+ common={{+ id: 'call-1',+ label: 'ReadCalendarEvent',+ status: 'running',+ muted: false,+ stopped: false,+ trailing: undefined,+ }}+ context={{ ...context, inFlight: true }}+ />+ ));++ expect(screen.getAllByText('ReadCalendarEvent').length).toBeGreaterThan(0);+ expect(screen.queryByText('Read calendar event')).toBeNull();+ });+});diff --git a/apps/web/src/features/block-agent/component/parts/MacroToolCall.tsx b/apps/web/src/features/block-agent/component/parts/MacroToolCall.tsxindex 24ca8025e0..b84ce85280 100644--- a/apps/web/src/features/block-agent/component/parts/MacroToolCall.tsx+++ b/apps/web/src/features/block-agent/component/parts/MacroToolCall.tsx@@ -3,9 +3,11 @@* server, or called natively by Macro's own agent.** Successful calls reuse their registered result renderer and its disclosure.- * Failed calls reuse the same renderer, so they keep the tool's own label and- * icon, with the tool's reason in place of a result.- * Running, stopped, and unsupported calls keep a summary-only row.+ * Running, failed, and stopped calls reuse the same renderer without a result,+ * so they keep the tool's own label and icon: a running row shimmers, a failed+ * one offers the tool's reason, and a stopped one says so.+ * Calls whose arguments do not fit the tool, or that have no renderer, keep a+ * summary-only row.* Only registered result renderers supply disclosures; raw payloads stay hidden.*/@@ -29,7 +31,7 @@ import {} from '@service-cognition/generated/tools/tool';import { createMemo, ErrorBoundary, type JSX, Show, Suspense } from 'solid-js';import { match } from 'ts-pattern';-import { ToolCard } from '../../ui';+import { isToolActive, ToolCard } from '../../ui';import type { ToolCallCommon, ToolCallContext } from './shared';type MacroDetail = Extract<ToolDetail, { kind: 'macro' }>;@@ -58,6 +60,10 @@ export function MacroToolCall(props: {json: props.detail.input,}).unwrapOr(undefined));+ // The renderer parses its arguments once; a running call's can still be+ // replaced (a harness may send `{}` before the real input), so it remounts+ // when their content changes.+ const inputKey = createMemo(() => JSON.stringify(props.detail.input));const subtitle = () => {const input = call()?.data;if (input && 'query' in input && typeof input.query === 'string') {@@ -115,42 +121,50 @@ export function MacroToolCall(props: {const canRenderFailure = () =>(props.common.status === 'completed' || props.common.status === 'failed') &&failure();+ const running = () => isToolActive(props.common.status);+ const showsResult = () => !running() && !props.common.stopped && !failure();return (<Showwhen={- (canRenderResults() || canRenderFailure()) &&+ (canRenderResults() ||+ canRenderFailure() ||+ running() ||+ props.common.stopped) &&call() !== undefined &&hasToolRenderer(props.common.label)}fallback={fallback()}>- <ErrorBoundary fallback={fallback()}>- <Suspense fallback={fallback()}>- <RenderTool- tool_id={props.common.id}- name={props.common.label}- json={props.detail.input}- response={- failure()- ? undefined- : { json: props.detail.output, name: props.common.label }- }- error={failure() ? error() : undefined}- chat_id={props.context.sessionId}- message_id={props.context.messageId}- part_index={props.context.partIndex}- isComplete={true}- renderContext={{- renderContext: {- isStreaming: false,- grouped: props.grouped ?? true,- followedBy: props.context.followedBy,- },- }}- />- </Suspense>- </ErrorBoundary>+ <Show when={inputKey()} keyed>+ <ErrorBoundary fallback={fallback()}>+ <Suspense fallback={fallback()}>+ <RenderTool+ tool_id={props.common.id}+ name={props.common.label}+ json={props.detail.input}+ response={+ showsResult()+ ? { json: props.detail.output, name: props.common.label }+ : undefined+ }+ error={failure() ? error() : undefined}+ stopped={props.common.stopped}+ chat_id={props.context.sessionId}+ message_id={props.context.messageId}+ part_index={props.context.partIndex}+ isComplete={!running()}+ renderContext={{+ renderContext: {+ isStreaming: running(),+ grouped: props.grouped ?? true,+ followedBy: props.context.followedBy,+ },+ }}+ />+ </Suspense>+ </ErrorBoundary>+ </Show></Show>);}diff --git a/apps/web/src/features/block-agent/component/parts/ToolCallPart.test.tsx b/apps/web/src/features/block-agent/component/parts/ToolCallPart.test.tsxindex 6a019aefb0..39bea8164d 100644--- a/apps/web/src/features/block-agent/component/parts/ToolCallPart.test.tsx+++ b/apps/web/src/features/block-agent/component/parts/ToolCallPart.test.tsx@@ -50,6 +50,7 @@ vi.mock('@core/component/AI/component/tool/handler', () => ({json: unknown;response?: { json: unknown };error?: string;+ stopped?: boolean;isComplete: boolean;renderContext: {renderContext: { grouped?: boolean; isStreaming: boolean };@@ -59,6 +60,8 @@ vi.mock('@core/component/AI/component/tool/handler', () => ({data-testid="macro-tool"data-response={JSON.stringify(props.response?.json)}data-error={props.error}+ data-stopped={String(props.stopped ?? false)}+ data-complete={String(props.isComplete)}data-grouped={String(props.renderContext.renderContext.grouped)}data-streaming={String(props.renderContext.renderContext.isStreaming)}>@@ -414,25 +417,31 @@ describe('ToolCallPart Macro tools', () => {{ name: 'ReadContent', status: 'running', ...overrides });- it('keeps a running Macro tool on the compact active row', () => {+ it('renders a running Macro tool through its renderer while it runs', () => {const rendered = render(() => (<ToolCallPart part={readContent()} context={context(true)} />));- expect(rendered.getByTestId('title').textContent).toBe('ReadContent');- expect(rendered.getAllByTestId('tool-card')).toHaveLength(1);- expect(rendered.getByTestId('tool-card').dataset.expandable).toBe('false');+ const richTool = rendered.getByTestId('macro-tool');+ expect(richTool.dataset.complete).toBe('false');+ expect(richTool.dataset.streaming).toBe('true');+ expect(richTool.dataset.stopped).toBe('false');+ expect(richTool.dataset.response).toBeUndefined();+ expect(rendered.queryByTestId('tool-card')).toBeNull();});it('marks a Macro call cut off by the turn as stopped', () => {// The turn ended with this call still `running` in the log; it settles- // and, with no response to show, keeps the labelled card.+ // and renders through its renderer as stopped, with no response.const rendered = render(() => (<ToolCallPart part={readContent()} context={context(false)} />));- expect(rendered.getByTestId('tool-card').dataset.status).toBe('completed');+ const richTool = rendered.getByTestId('macro-tool');+ expect(richTool.dataset.stopped).toBe('true');+ expect(richTool.dataset.complete).toBe('true');+ expect(richTool.dataset.streaming).toBe('false');});- it('keeps a stopped call labelled even when it already has renderable output', () => {+ it('withholds the output of a stopped call even when it would render', () => {const rendered = render(() => (<ToolCallPartpart={readContent({@@ -446,8 +455,9 @@ describe('ToolCallPart Macro tools', () => {context={context(false)}/>));- expect(rendered.getByTestId('trailing').textContent).toBe('Stopped');- expect(rendered.queryByTestId('macro-tool')).toBeNull();+ const richTool = rendered.getByTestId('macro-tool');+ expect(richTool.dataset.stopped).toBe('true');+ expect(richTool.dataset.response).toBeUndefined();});it('reuses the registered result renderer without an outer tool disclosure', () => {diff --git a/apps/web/src/features/block-agent/component/parts/ToolCallPart.tsx b/apps/web/src/features/block-agent/component/parts/ToolCallPart.tsxindex 0248b23ce6..d3c0a75b34 100644--- a/apps/web/src/features/block-agent/component/parts/ToolCallPart.tsx+++ b/apps/web/src/features/block-agent/component/parts/ToolCallPart.tsx@@ -48,17 +48,16 @@ export function ToolCallPart(props: {settledToolStatus(props.part.status, props.context.inFlight);// The chat block's failed-tool treatment: the same row, faded, with a quiet// trailing label — not a separate error card.+ const stopped = () =>+ (props.part.status === 'pending' || props.part.status === 'running') &&+ status() === 'completed';const common = (): ToolCallCommon => ({id: props.part.id,label: toolLabel(props.part.name),status: status(),muted: failed(),- trailing: failed()- ? 'Failed'- : (props.part.status === 'pending' || props.part.status === 'running') &&- status() === 'completed'- ? 'Stopped'- : undefined,+ stopped: stopped(),+ trailing: failed() ? 'Failed' : stopped() ? 'Stopped' : undefined,});// Non-keyed matches preserve the disclosure when a streamed update replacesdiff --git a/apps/web/src/features/block-agent/component/parts/shared.ts b/apps/web/src/features/block-agent/component/parts/shared.tsindex eacd69753c..a43b7a9051 100644--- a/apps/web/src/features/block-agent/component/parts/shared.ts+++ b/apps/web/src/features/block-agent/component/parts/shared.ts@@ -43,6 +43,8 @@ export type ToolCallCommon = {status: ToolStatus;/** The chat block's failed treatment: faded row, quiet trailing label. */muted: boolean;+ /** The turn ended while the call was still running (see `settledToolStatus`). */+ stopped: boolean;trailing: JSX.Element | undefined;};diff --git a/apps/web/src/lib/core/component/AI/component/tool/AgentSessionActions.test.tsx b/apps/web/src/lib/core/component/AI/component/tool/AgentSessionActions.test.tsxindex cf0d106fc0..8975bf113d 100644--- a/apps/web/src/lib/core/component/AI/component/tool/AgentSessionActions.test.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/AgentSessionActions.test.tsx@@ -44,7 +44,9 @@ it('links the created session instead of showing its raw response', () => {it('does not present an uncertain prompt as completed work', () => {const view = render(() => (- <ToolErrorContext.Provider value={() => ({ reason: 'delivery unknown' })}>+ <ToolErrorContext.Provider+ value={() => ({ kind: 'failed', reason: 'delivery unknown' })}+ ><manageAgentSessionHandler.render{...context}tool={{diff --git a/apps/web/src/lib/core/component/AI/component/tool/BaseTool.tsx b/apps/web/src/lib/core/component/AI/component/tool/BaseTool.tsxindex 7f18f04c25..66e2dd46a6 100644--- a/apps/web/src/lib/core/component/AI/component/tool/BaseTool.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/BaseTool.tsx@@ -1,5 +1,6 @@import type { Component, JSX } from 'solid-js';import { createSignal, Show } from 'solid-js';+import { match } from 'ts-pattern';import { Tool } from './Tool';import { type RenderContext, useToolError } from './ToolRenderer';@@ -18,27 +19,39 @@ type ToolResponseProps = {};function BaseToolCall(props: ToolCallProps) {- const failure = () => useToolError();- const reason = () => failure()?.reason?.trim() || undefined;+ const ending = () => useToolError();+ const reason = () => {+ const current = ending();+ return current?.kind === 'failed'+ ? current.reason?.trim() || undefined+ : undefined;+ };const [showReason, setShowReason] = createSignal(false);const grouped = () => props.renderContext.grouped === true;+ const trailing = () => {+ const current = ending();+ if (!current) return undefined;+ return match(current)+ .with({ kind: 'failed' }, () => (+ <Tool.ResultToggle+ expanded={showReason()}+ onToggle={() => setShowReason((shown) => !shown)}+ showToggle={reason() !== undefined}+ status={<span class="text-ink">Failed</span>}+ />+ ))+ .with({ kind: 'stopped' }, () => <span class="text-xs">Stopped</span>)+ .exhaustive();+ };return (- <Tool.Root grouped={grouped()} muted={!!failure()}>+ <Tool.Root grouped={grouped()} muted={ending()?.kind === 'failed'}><Tool.Row+ active={props.renderContext.running}align={props.align}grouped={grouped()}icon={props.icon}- trailing={- failure() ? (- <Tool.ResultToggle- expanded={showReason()}- onToggle={() => setShowReason((shown) => !shown)}- showToggle={reason() !== undefined}- status={<span class="text-ink">Failed</span>}- />- ) : undefined- }+ trailing={trailing()}>{props.children}</Tool.Row>diff --git a/apps/web/src/lib/core/component/AI/component/tool/BookingLinks.test.tsx b/apps/web/src/lib/core/component/AI/component/tool/BookingLinks.test.tsxindex 2ef0e0c3cc..14f4bb5b12 100644--- a/apps/web/src/lib/core/component/AI/component/tool/BookingLinks.test.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/BookingLinks.test.tsx@@ -36,7 +36,9 @@ const context = {};it('never opens an editable review when saving fails', () => {const view = render(() => (- <ToolErrorContext.Provider value={() => ({ reason: 'failed' })}>+ <ToolErrorContext.Provider+ value={() => ({ kind: 'failed', reason: 'failed' })}+ ><createBookingLinkHandler.render {...context} /></ToolErrorContext.Provider>));diff --git a/apps/web/src/lib/core/component/AI/component/tool/CalendarTools.test.tsx b/apps/web/src/lib/core/component/AI/component/tool/CalendarTools.test.tsxindex c31060cd62..832ab5a331 100644--- a/apps/web/src/lib/core/component/AI/component/tool/CalendarTools.test.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/CalendarTools.test.tsx@@ -8,7 +8,7 @@ import {createConfirmedCalendarEventHandler,readCalendarEventHandler,} from './CalendarTools';-import { ToolErrorContext, type ToolFailure } from './ToolRenderer';+import { type ToolEnding, ToolErrorContext } from './ToolRenderer';const openToolCalendarEvent = vi.hoisted(() => vi.fn());vi.mock('./calendar/open-tool-event', () => ({@@ -96,7 +96,7 @@ function tool(name: keyof typeof handlers, data: unknown, response?: unknown) {function failedTool(name: keyof typeof handlers,data: unknown,- failure: ToolFailure+ failure: ToolEnding) {return render(() => (<ToolErrorContext.Provider value={() => failure}>@@ -151,7 +151,7 @@ it('keeps a failed call on its own card and reveals the reason on request', () =failedTool('AddSharedCalendarEvent',{ eventId: '01992d2f-8444-7000-8000-000000000001' },- { reason }+ { kind: 'failed', reason });expect(screen.getByText('Add to calendar')).toBeTruthy();expect(screen.queryByText(reason)).toBeNull();@@ -167,9 +167,21 @@ it('offers nothing to open on a failed call without a reason', () => {failedTool('ReadCalendarEvent',{ eventId: '01992d2f-8444-7000-8000-000000000001' },- {}+ { kind: 'failed' });expect(screen.getByText('Read calendar event')).toBeTruthy();expect(screen.getByText('Failed')).toBeTruthy();expect(screen.queryByRole('button')).toBeNull();});++it('says a call its turn stopped was stopped, not failed', () => {+ failedTool(+ 'ReadCalendarEvent',+ { eventId: '01992d2f-8444-7000-8000-000000000001' },+ { kind: 'stopped' }+ );+ expect(screen.getByText('Read calendar event')).toBeTruthy();+ expect(screen.getByText('Stopped')).toBeTruthy();+ expect(screen.queryByText('Failed')).toBeNull();+ expect(screen.queryByRole('button')).toBeNull();+});diff --git a/apps/web/src/lib/core/component/AI/component/tool/CodingAgents.test.tsx b/apps/web/src/lib/core/component/AI/component/tool/CodingAgents.test.tsxindex bb812bd044..cd5b1afb7f 100644--- a/apps/web/src/lib/core/component/AI/component/tool/CodingAgents.test.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/CodingAgents.test.tsx@@ -7,7 +7,7 @@ import {dispatchCodingAgentHandler,listCodingAgentsHandler,} from './CodingAgents';-import { ToolErrorContext, type ToolFailure } from './ToolRenderer';+import { type ToolEnding, ToolErrorContext } from './ToolRenderer';vi.mock('../../../LexicalMarkdown/component/decorator/MagicChip', () => ({MagicChip: (props: MagicChipData) => (@@ -69,7 +69,7 @@ describe('coding agent dispatch', () => {});it('shows a dispatch error without leaving a starting indicator or session card', () => {- const [error, setError] = createSignal<ToolFailure>();+ const [error, setError] = createSignal<ToolEnding>();const view = render(() => (<ToolErrorContext.Provider value={error}><dispatchCodingAgentHandler.render@@ -89,7 +89,7 @@ describe('coding agent dispatch', () => {/></ToolErrorContext.Provider>));- setError({ reason: 'failed' });+ setError({ kind: 'failed', reason: 'failed' });expect(view.getByRole('status').textContent).toContain('Could not confirm coding agent dispatch');@@ -102,7 +102,7 @@ describe('available coding agents', () => {it.each([false, true])('updates an already mounted row when listing fails (grouped: %s)',(grouped) => {- const [error, setError] = createSignal<ToolFailure>();+ const [error, setError] = createSignal<ToolEnding>();const view = render(() => (<ToolErrorContext.Provider value={error}><listCodingAgentsHandler.render@@ -123,7 +123,7 @@ describe('available coding agents', () => {expect(view.queryByText('Failed')).toBeNull();expect(label.closest('.opacity-50')).toBeNull();- setError({ reason: 'failed' });+ setError({ kind: 'failed', reason: 'failed' });expect(view.getByText('Failed')).toBeTruthy();expect(label.closest('.opacity-50')).toBeTruthy();expect(view.getByText('Available coding agents')).toBe(label);diff --git a/apps/web/src/lib/core/component/AI/component/tool/GenerateImage.test.tsx b/apps/web/src/lib/core/component/AI/component/tool/GenerateImage.test.tsxindex a1ce876471..b1f08e89ae 100644--- a/apps/web/src/lib/core/component/AI/component/tool/GenerateImage.test.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/GenerateImage.test.tsx@@ -22,7 +22,9 @@ function imageTool() {const failure = () => {const reason = typeof error === 'function' ? error() : error;- return reason === undefined ? undefined : { reason };+ return reason === undefined+ ? undefined+ : { kind: 'failed' as const, reason };};return render(() => (<ToolErrorContext.Provider value={failure}>diff --git a/apps/web/src/lib/core/component/AI/component/tool/GenerateImage.tsx b/apps/web/src/lib/core/component/AI/component/tool/GenerateImage.tsxindex 2d7728777f..241c8d083c 100644--- a/apps/web/src/lib/core/component/AI/component/tool/GenerateImage.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/GenerateImage.tsx@@ -67,7 +67,14 @@ export const generateImageHandler = createToolRenderer({class="flex items-center gap-2 py-4 text-sm text-ink-muted"role="status">- <Show when={!error()} fallback="Image generation failed">+ <Show+ when={!error()}+ fallback={+ error()?.kind === 'stopped'+ ? 'Image generation stopped'+ : 'Image generation failed'+ }+ ><LoadingSpinner class="size-4 animate-spin" /><span>Generating image</span></Show>diff --git a/apps/web/src/lib/core/component/AI/component/tool/Spreadsheet.test.tsx b/apps/web/src/lib/core/component/AI/component/tool/Spreadsheet.test.tsxindex 0c29ed9daa..7650335c29 100644--- a/apps/web/src/lib/core/component/AI/component/tool/Spreadsheet.test.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/Spreadsheet.test.tsx@@ -36,7 +36,9 @@ function renderTool() {return render(() => (<ToolErrorContext.Provider- value={() => (error === undefined ? undefined : { reason: error })}+ value={() =>+ error === undefined ? undefined : { kind: 'failed', reason: error }+ }><Dynamiccomponent={handler.render as Component<Record<string, unknown>>}diff --git a/apps/web/src/lib/core/component/AI/component/tool/Tool.tsx b/apps/web/src/lib/core/component/AI/component/tool/Tool.tsxindex 941b51069e..d8598b2d55 100644--- a/apps/web/src/lib/core/component/AI/component/tool/Tool.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/Tool.tsx@@ -4,6 +4,8 @@ import type { Component, JSX } from 'solid-js';import { Show } from 'solid-js';type ToolRowProps = {+ /** The call is still running: its text shimmers, as an active agent row does. */+ active?: boolean;align?: 'center' | 'start';grouped?: boolean;children: JSX.Element;@@ -78,7 +80,12 @@ function Row(props: ToolRowProps) {class="size-4 shrink-0 text-ink-extra-muted"classList={{ 'mt-0.5': alignStart() }}/>- <div class="min-w-0 flex-1 overflow-hidden">{props.children}</div>+ <div+ class="min-w-0 flex-1 overflow-hidden"+ classList={{ 'magic-chip-shimmer': props.active }}+ >+ {props.children}+ </div><Show when={props.trailing}><div class="shrink-0 whitespace-nowrap">{props.trailing}</div></Show>diff --git a/apps/web/src/lib/core/component/AI/component/tool/ToolRenderer.tsx b/apps/web/src/lib/core/component/AI/component/tool/ToolRenderer.tsxindex 0709a5eeac..86d882b69e 100644--- a/apps/web/src/lib/core/component/AI/component/tool/ToolRenderer.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/ToolRenderer.tsx@@ -4,11 +4,16 @@ import type {} from '@service-cognition/generated/tools/tool';import { type Component, createContext, useContext } from 'solid-js';-/** A finished call that failed, with the tool's own reason when it gave one. */-export type ToolFailure = { reason?: string };+/**+ * A call that ended without a result: it failed, with the tool's own reason+ * when it gave one, or its turn stopped it first.+ */+export type ToolEnding =+ | { kind: 'failed'; reason?: string }+ | { kind: 'stopped' };export const ToolErrorContext = createContext<- (() => ToolFailure | undefined) | undefined+ (() => ToolEnding | undefined) | undefined>();export const useToolError = () => {const accessor = useContext(ToolErrorContext);@@ -19,6 +24,8 @@ export type RenderContext = {renderContext: {isStreaming: boolean;grouped?: boolean;+ /** This call is still running, so its row reads as active. */+ running?: boolean;/** Whether a later part of the same assistant turn calls this tool. */followedBy: (name: ToolName) => boolean;};diff --git a/apps/web/src/lib/core/component/AI/component/tool/handler.tsx b/apps/web/src/lib/core/component/AI/component/tool/handler.tsxindex 6e4b49189b..40bca80c5f 100644--- a/apps/web/src/lib/core/component/AI/component/tool/handler.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/handler.tsx@@ -191,6 +191,7 @@ import { getTeamAvailabilityHandler } from './TeamAvailability';import { textEditorCodeExecutionHandler } from './TextEditorCodeExecution';import {type RenderContext,+ type ToolEnding,ToolErrorContext,type ToolHandler,type ToolHandlerMap,@@ -364,6 +365,8 @@ type ToolProps = {};/** The tool's reason for a call that failed. */error?: string;+ /** The turn ended before the call returned. */+ stopped?: boolean;part_index: number;chat_id: string;message_id: string;@@ -455,13 +458,14 @@ export function RenderTool(props: ToolProps) {}><ToolErrorContext.Provider- value={() =>- props.error !== undefined- ? { reason: props.error }- : props.isComplete && !response()- ? {}- : undefined- }+ value={(): ToolEnding | undefined => {+ if (props.error !== undefined) {+ return { kind: 'failed', reason: props.error };+ }+ if (props.stopped) return { kind: 'stopped' };+ if (props.isComplete && !response()) return { kind: 'failed' };+ return undefined;+ }}><Showwhen={isToolShown(tool.name, databasesEnabled().enabled)}@@ -474,6 +478,9 @@ export function RenderTool(props: ToolProps) {renderContext={{isStreaming: props.renderContext.renderContext.isStreaming,grouped: props.renderContext.renderContext.grouped,+ running:+ !props.isComplete &&+ props.renderContext.renderContext.isStreaming,followedBy: props.renderContext.renderContext.followedBy,}}/>diff --git a/docs/agent-guide/ai-chat.md b/docs/agent-guide/ai-chat.mdindex 0c2d4af179..806f15e180 100644--- a/docs/agent-guide/ai-chat.md+++ b/docs/agent-guide/ai-chat.md@@ -1377,12 +1377,15 @@ it points right when collapsed and down when expanded. Individual results startcollapsed. Existing rich result views retain their own content and controls;when a result view provides its own disclosure, use that control rather thanadding a second nested disclosure. Counts come from structured responses,-edits show additions/deletions, and other tools show their outcome. A call cut-off when its turn ends reads **Stopped**. A failed Macro tool call keeps the-same label and icon as its successful row, faded, with **Failed** on the right-(for example **Add to calendar · Failed**, never the tool's code name); when the-tool gave a reason, **Failed** carries a caret that opens it. Labels stay in-the present tense (**Fetch**, **Load tools**) until a result arrives.+edits show additions/deletions, and other tools show their outcome. A Macro+tool call keeps the same label and icon as its successful row in every state,+never the tool's code name: while it runs its text shimmers; a call cut off when+its turn ends reads **Stopped**; a failed call is faded with **Failed** on the+right (for example **Add to calendar · Failed**), and when the tool gave a+reason, **Failed** carries a caret that opens it. Only a call whose arguments do+not fit the tool (still arriving, or malformed) keeps the summary row with the+tool's name. Labels stay in the present tense (**Fetch**, **Load tools**) until+a result arrives.Only tools with a supported result view can expand. Unknown tools, unsupporteddrafts, and payloads that do not fit their renderer stay as summary rows with