Skip to content

The agent that grows with you

fix(desktop): route sealed tool parts without a result to the generic row

yoniebansa74953f0f6e8
diff --git a/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx b/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx
index 9c4702ceba8..03fc1e5d370 100644
--- a/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx
@@ -32,6 +32,11 @@ import { $reasoningCollapsedByDefault } from '@/store/reasoning-disclosure'
type TimelineToolCallProps = ToolCallMessagePartProps & { completedAt?: number; timestamp?: number }
+// A call sealed without a result (turn stopped, completion event lost) is
+// neither pending nor successful; only the generic row can say so.
+const settledWithoutResult = ({ completedAt, result }: TimelineToolCallProps): boolean =>
+ result === undefined && completedAt !== undefined
+
const ImageGenerateTool: FC<TimelineToolCallProps> = props => {
const { args, completedAt, result, timestamp } = props
const aspectRatio = typeof args?.aspect_ratio === 'string' ? args.aspect_ratio : undefined
@@ -39,7 +44,7 @@ const ImageGenerateTool: FC<TimelineToolCallProps> = props => {
// The image card owns successful generations. Failed or malformed results
// still need the normal tool row: it extracts the error text and gives the
// user an honest, expandable failure rather than silently dropping the call.
- if (result !== undefined && !generatedImageFromResult(result)) {
+ if (settledWithoutResult(props) || (result !== undefined && !generatedImageFromResult(result))) {
return <ToolFallback {...props} />
}
@@ -54,7 +59,7 @@ const ImageGenerateTool: FC<TimelineToolCallProps> = props => {
const DelegateToolPart: FC<TimelineToolCallProps> = props => {
// A call that failed outright dispatched nothing — there are no children to
// list, only an error. The generic row extracts and expands it properly.
- if (props.isError) {
+ if (props.isError || settledWithoutResult(props)) {
return <ToolFallback {...props} />
}
@@ -76,7 +81,7 @@ const ChainToolFallback: FC<TimelineToolCallProps> = props => {
// compact "Messaged X" / "Message from X" notices, not a transcript row
// (Grok-bots parity; the receiving side already renders notices via
// AGENT_MESSAGE_RE). Non-delivery terminal calls fall through unchanged.
- if (props.toolName === 'terminal' && !props.isError) {
+ if (props.toolName === 'terminal' && !props.isError && !settledWithoutResult(props)) {
const command = typeof props.args?.command === 'string' ? props.args.command : ''
if (deliveryTargetFromCommand(command)) {
diff --git a/apps/desktop/src/components/assistant-ui/thread/sealed-tool-parts.test.tsx b/apps/desktop/src/components/assistant-ui/thread/sealed-tool-parts.test.tsx
new file mode 100644
index 00000000000..82206dd9400
--- /dev/null
+++ b/apps/desktop/src/components/assistant-ui/thread/sealed-tool-parts.test.tsx
@@ -0,0 +1,81 @@
+import { type ThreadMessage } from '@assistant-ui/react'
+import { cleanup, render, screen } from '@testing-library/react'
+import { afterEach, describe, expect, it } from 'vitest'
+
+import { $activeSessionId } from '@/store/session'
+
+import { stubThreadEnvironment, stubThreadViewportSize, ThreadRuntime } from '../test-utils'
+import { Thread } from '../thread'
+
+// The image card, delegate list and delivery notice decide pending-ness from
+// `result === undefined`; a call sealed without a result must not stay live.
+
+stubThreadEnvironment()
+stubThreadViewportSize()
+
+const createdAt = new Date('2026-09-11T12:00:00Z')
+const sealedAt = createdAt.getTime() / 1000 + 5
+
+function sealedMessage(toolName: string, args: Record<string, unknown>): ThreadMessage {
+ return {
+ id: `assistant-sealed-${toolName}`,
+ role: 'assistant',
+ content: [
+ {
+ type: 'tool-call',
+ toolCallId: `${toolName}-1`,
+ toolName,
+ args,
+ argsText: JSON.stringify(args),
+ completedAt: sealedAt
+ }
+ ],
+ status: { type: 'complete', reason: 'stop' },
+ createdAt,
+ metadata: {
+ unstable_state: null,
+ unstable_annotations: [],
+ unstable_data: [],
+ steps: [],
+ custom: {}
+ }
+ } as unknown as ThreadMessage
+}
+
+const Harness = ({ message }: { message: ThreadMessage }) => (
+ <ThreadRuntime messages={[message]}>
+ <Thread />
+ </ThreadRuntime>
+)
+
+afterEach(() => {
+ cleanup()
+ $activeSessionId.set(null)
+})
+
+describe('tool parts sealed without a result', () => {
+ it('renders a sealed delegate_task as the generic row, not a running task list', async () => {
+ $activeSessionId.set('sess-1')
+ const { container } = render(<Harness message={sealedMessage('delegate_task', { tasks: [{ goal: 'inspect' }] })} />)
+
+ expect(await screen.findByText('Result unavailable')).toBeTruthy()
+ expect(container.querySelector('[data-delegate-card]')).toBeNull()
+ expect(screen.queryByLabelText('Running')).toBeNull()
+ })
+
+ it('renders a sealed image_generate as the generic row, not a rendering placeholder', async () => {
+ const { container } = render(<Harness message={sealedMessage('image_generate', { prompt: 'a cat' })} />)
+
+ expect(await screen.findByText('Result unavailable')).toBeTruthy()
+ expect(container.querySelector('[data-slot="aui_generated-image"]')).toBeNull()
+ expect(screen.queryByRole('status')).toBeNull()
+ })
+
+ it('renders a sealed delivery terminal call as the generic row, not a pending notice', async () => {
+ const command = 'hermes -p turqoise chat --in ~ -c "Bot Chat" -Q -q "Message from 🤖 Hermes (@hermes): hi"'
+ const { container } = render(<Harness message={sealedMessage('terminal', { command })} />)
+
+ expect(await screen.findByText('Result unavailable')).toBeTruthy()
+ expect(container.querySelector('[data-slot="aui_agent-delivery-notice"]')).toBeNull()
+ })
+})