diff --git a/apps/desktop/src/app/contrib/hooks/live-status-reap.test.ts b/apps/desktop/src/app/contrib/hooks/live-status-reap.test.ts index cca8adf154..74d9b47d18 100644 --- a/apps/desktop/src/app/contrib/hooks/live-status-reap.test.ts +++ b/apps/desktop/src/app/contrib/hooks/live-status-reap.test.ts @@ -1,5 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { buildToolView } from '@/components/assistant-ui/tool/fallback-model' import { createClientSessionState } from '@/lib/chat-runtime' import { $activeSessionId, $selectedStoredSessionId, $unreadFinishedSessionIds } from '@/store/session' import { @@ -111,10 +112,20 @@ describe('rehydrateLiveSessionStatuses — reaping vanished runtimes', () => { rehydrateLiveSessionStatuses({ sessions: [] }) const state = $sessionStates.get()['runtime-tools'] + const part = state.messages[0].parts[0] expect(state.busy).toBe(false) expect(state.awaitingResponse).toBe(false) - expect((state.messages[0].parts[0] as { result?: unknown }).result).toBeDefined() + expect(part.type).toBe('tool-call') + + if (part.type !== 'tool-call') { + throw new Error('Missing tool call') + } + + // Reaping ends liveness without inventing evidence of a successful result. + expect(part.completedAt).toBeDefined() + expect(part.result).toBeUndefined() + expect(buildToolView(part, '').status).toBe('warning') }) it('clears a session stuck awaiting a response without the busy flag', () => { diff --git a/apps/desktop/src/components/assistant-ui/thread/changed-files.ts b/apps/desktop/src/components/assistant-ui/thread/changed-files.ts index 67d23b7f3f..5742fb0c4f 100644 --- a/apps/desktop/src/components/assistant-ui/thread/changed-files.ts +++ b/apps/desktop/src/components/assistant-ui/thread/changed-files.ts @@ -9,8 +9,7 @@ import { isFileEditTool, parseMaybeObject } from '@/components/assistant-ui/tool/fallback-model' - -import { toolResultRecord, type ToolResultMetadata } from '@/lib/tool-result-metadata' +import { type ToolResultMetadata, toolResultRecord } from '@/lib/tool-result-metadata' export interface ChangedFile { added: number diff --git a/apps/desktop/src/lib/chat-messages/competing-contracts.test.ts b/apps/desktop/src/lib/chat-messages/competing-contracts.test.ts index b5184d3dcf..e7eb7d2c2e 100644 --- a/apps/desktop/src/lib/chat-messages/competing-contracts.test.ts +++ b/apps/desktop/src/lib/chat-messages/competing-contracts.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest' -import { upsertToolPart } from '@/lib/chat-messages' + import { summarizeToolRun } from '@/components/assistant-ui/tool/run-summary' +import { upsertToolPart } from '@/lib/chat-messages' describe('D1 competing implementation contracts', () => { it('retains JSON object text as the canonical received value', () => { diff --git a/apps/desktop/src/lib/chat-messages/d1-consumers.test.ts b/apps/desktop/src/lib/chat-messages/d1-consumers.test.ts index c1aa292e11..3135ab534b 100644 --- a/apps/desktop/src/lib/chat-messages/d1-consumers.test.ts +++ b/apps/desktop/src/lib/chat-messages/d1-consumers.test.ts @@ -1,9 +1,10 @@ import { fromThreadMessageLike, getAutoStatus } from '@assistant-ui/core/internal' import { describe, expect, it } from 'vitest' -import { buildToolView } from '@/components/assistant-ui/tool/fallback-model' + import { deriveChangedFiles } from '@/components/assistant-ui/thread/changed-files' -import { toRuntimeMessage } from '@/lib/chat-runtime' +import { buildToolView } from '@/components/assistant-ui/tool/fallback-model' import { sealOpenToolParts, upsertToolPart } from '@/lib/chat-messages' +import { toRuntimeMessage } from '@/lib/chat-runtime' import { todosFromMessageContent } from '@/lib/todos' const normalize = (parts: ReturnType) => fromThreadMessageLike(toRuntimeMessage({ id: 'd1', role: 'assistant', parts }), 'd1', getAutoStatus(false, false, false, false, undefined)).content