Skip to content

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

fix(assistant-ui): handle missing tool call source in chat sources

Steven Enamakel6b7b4e3e124e
diff --git a/app/src/components/assistant-ui/thread.tsx b/app/src/components/assistant-ui/thread.tsx
index 30e711ec7b..5c9c0d0ec7 100644
--- a/app/src/components/assistant-ui/thread.tsx
+++ b/app/src/components/assistant-ui/thread.tsx
@@ -1212,9 +1212,9 @@ const selectMessageParts = (state: AssistantState) => state.message.parts;
* a count, then the rows), so it needs the parts themselves, not one child per
* part.
*/
-const SourceGroupSlot: FC<{
- Component: ComponentType<{ sources: readonly SourceUrlPart[] }>;
-}> = ({ Component }) => {
+const SourceGroupSlot: FC<{ Component: ComponentType<{ sources: readonly SourceUrlPart[] }> }> = ({
+ Component,
+}) => {
const parts = useAuiState(selectMessageParts);
const sources = useMemo(
() =>
diff --git a/app/src/features/conversations/components/AssistantUiToolCall.tsx b/app/src/features/conversations/components/AssistantUiToolCall.tsx
index d281f250ed..de1c3f9477 100644
--- a/app/src/features/conversations/components/AssistantUiToolCall.tsx
+++ b/app/src/features/conversations/components/AssistantUiToolCall.tsx
@@ -8,11 +8,11 @@ import {
CollapsibleContent,
CollapsibleTrigger,
} from '../../../components/assistant-ui/ui/collapsible';
+import type { ToolLabelArtifact } from '../../../providers/assistantUiMessages';
import type {
ToolFailureExplanation,
ToolTimelineEntryStatus,
} from '../../../store/chatRuntimeSlice';
-import type { ToolLabelArtifact } from '../../../providers/assistantUiMessages';
import { toolCallLabel } from '../../../utils/toolTimelineFormatting';
import { BubbleMarkdown } from './AgentMessageBubble';
import { ToolFailureLines } from './ToolFailureLines';
diff --git a/app/src/features/conversations/components/aui/ChatSources.test.tsx b/app/src/features/conversations/components/aui/ChatSources.test.tsx
index 8fda731759..37fa1a83b4 100644
--- a/app/src/features/conversations/components/aui/ChatSources.test.tsx
+++ b/app/src/features/conversations/components/aui/ChatSources.test.tsx
@@ -171,10 +171,10 @@ describe('inline turn sources', () => {
it('draws the turn once, with no process footer under the answer', async () => {
vi.spyOn(threadApi, 'getDerivedTranscript').mockResolvedValue(
- page(
- toolCall('c1', 'https://example.com/a'),
- { kind: 'reasoning', text: 'Looking it up.' } as DerivedDisplayItem
- ) as never
+ page(toolCall('c1', 'https://example.com/a'), {
+ kind: 'reasoning',
+ text: 'Looking it up.',
+ } as DerivedDisplayItem) as never
);
renderChat();
diff --git a/app/src/features/conversations/components/aui/ChatSources.tsx b/app/src/features/conversations/components/aui/ChatSources.tsx
index d94d1d86cc..3a6e190f76 100644
--- a/app/src/features/conversations/components/aui/ChatSources.tsx
+++ b/app/src/features/conversations/components/aui/ChatSources.tsx
@@ -9,8 +9,8 @@
*
* Collapsed by default: the answer stays the top of the turn.
*/
-import type { SourceUrlPart } from '../../../../components/assistant-ui/thread';
import { Sources, SourcesContent, SourcesTrigger } from '../../../../components/ai-elements';
+import type { SourceUrlPart } from '../../../../components/assistant-ui/thread';
import { useT } from '../../../../lib/i18n/I18nContext';
import { AgentSourceRow } from '../AgentSourceRow';
diff --git a/app/src/providers/assistantUiMessages.ts b/app/src/providers/assistantUiMessages.ts
index 89226e90bd..9ca3a4f44f 100644
--- a/app/src/providers/assistantUiMessages.ts
+++ b/app/src/providers/assistantUiMessages.ts
@@ -144,10 +144,7 @@ function toolLabelArtifact(entry: ToolTimelineEntry): ToolLabelArtifact {
const formatted = entry.displayName ? undefined : formatTimelineEntry(entry);
const displayName = entry.displayName ?? formatted?.title;
const detail = entry.detail ?? formatted?.detail;
- return {
- ...(displayName ? { displayName } : {}),
- ...(detail ? { detail } : {}),
- };
+ return { ...(displayName ? { displayName } : {}), ...(detail ? { detail } : {}) };
}
function toolPart(entry: ToolTimelineEntry): ThreadAssistantMessagePart {
@@ -579,10 +576,7 @@ export function toThreadMessageLike(
// survive the next turn, a thread switch and a reload. Without this the
// control silently un-presses, which is worse than having no control.
...(feedback ? { submittedFeedback: { type: feedback } } : {}),
- custom: {
- extraMetadata: msg.extraMetadata ?? {},
- sourceType: msg.type,
- },
+ custom: { extraMetadata: msg.extraMetadata ?? {}, sourceType: msg.type },
},
};