Skip to content

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

fix(conversations): handle missing subagent call data in assistant UI

Steven Enamakel9548ddae441c
diff --git a/app/src/features/conversations/components/AssistantUiSubagentCall.tsx b/app/src/features/conversations/components/AssistantUiSubagentCall.tsx
index e978071fad..7803f57abc 100644
--- a/app/src/features/conversations/components/AssistantUiSubagentCall.tsx
+++ b/app/src/features/conversations/components/AssistantUiSubagentCall.tsx
@@ -8,6 +8,7 @@ import {
} from 'lucide-react';
import { useState } from 'react';
+import { useDisclosure } from '../../../components/assistant-ui/lib/useDisclosure';
import { cn } from '../../../components/assistant-ui/lib/utils';
import {
Collapsible,
@@ -298,6 +299,7 @@ export function AssistantUiSubagentCall({
onView,
onAnswer,
defaultOpen = false,
+ disclosureKey,
}: {
activity: SubagentActivity;
running?: boolean;
@@ -310,6 +312,8 @@ export function AssistantUiSubagentCall({
*/
onAnswer?: (text: string) => void;
defaultOpen?: boolean;
+ /** Stable identity (the part's tool-call id) that remembers the user's toggle. */
+ disclosureKey?: string;
}) {
const { t } = useT();
const name = activity.displayName ?? activity.agentId ?? 'subagent';
@@ -323,7 +327,10 @@ export function AssistantUiSubagentCall({
// delegation too, so a caller-supplied `running` cannot distinguish the two.
const awaiting = isAwaitingUserSubagentStatus(activity.status);
const failed = !active && isFailedSubagentStatus(activity.status);
- const [open, setOpen] = useState(defaultOpen);
+ const [open, setOpen] = useDisclosure(
+ disclosureKey ? `subagent:${disclosureKey}` : undefined,
+ defaultOpen
+ );
// A question the user cannot see is a question they cannot answer, and the
// row is normally already mounted (and collapsed) as `running` by the time
// the pause arrives, so `defaultOpen` is too late. Derived rather than an
diff --git a/app/src/features/conversations/components/ChatToolParts.tsx b/app/src/features/conversations/components/ChatToolParts.tsx
index 279d4bccb6..8467a29aae 100644
--- a/app/src/features/conversations/components/ChatToolParts.tsx
+++ b/app/src/features/conversations/components/ChatToolParts.tsx
@@ -50,7 +50,7 @@ function readSubagentState(
}
/** Adapt an assistant-ui `task` part onto the shared delegation card. */
-export const SubagentCall: ToolCallMessagePartComponent = ({ args, result }) => {
+export const SubagentCall: ToolCallMessagePartComponent = ({ args, result, toolCallId }) => {
const aui = useAui();
const { activity, running } = readSubagentState(args, result);
const description = (args as { description?: string } | undefined)?.description;
@@ -96,6 +96,7 @@ export const SubagentCall: ToolCallMessagePartComponent = ({ args, result }) =>
description={description}
onAnswer={answer}
onView={drawerHost?.canOpen(taskId) ? view : undefined}
+ disclosureKey={toolCallId}
/>
);
};