Skip to content

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

feat(assistant-ui): replace error boundary with interactive error state

Steven Enamakel7f76b407ae06
diff --git a/app/src/components/assistant-ui/thread.tsx b/app/src/components/assistant-ui/thread.tsx
index d44c83c94f..915e3beeed 100644
--- a/app/src/components/assistant-ui/thread.tsx
+++ b/app/src/components/assistant-ui/thread.tsx
@@ -1221,12 +1221,32 @@ const ComposerAction: FC<{
);
};
+/**
+ * The runtime's own error boundary for a message (`message.status.type ===
+ * 'error'` — a throw from `onNew`/`onEdit`/`onReload`, not a `chat_error`
+ * socket event, which instead lands as its own assistant reply — see
+ * `ChatRuntimeProvider`'s `onError` handler).
+ *
+ * `useMessageError`/`useActionBarReload` come straight from
+ * `@assistant-ui/core/react` rather than through a primitive: there is no
+ * primitive that hands back the raw error VALUE (only
+ * `ErrorPrimitive.Message`, which renders it directly), and Retry needs the
+ * same reload callback `ActionBarPrimitive.Reload` uses internally.
+ */
const MessageError: FC = () => {
+ const error = useMessageError();
+ const reload = useActionBarReload();
+ if (error === undefined) return null;
+ const detail = typeof error === 'string' ? error : JSON.stringify(error);
return (
<MessagePrimitive.Error>
- <ErrorPrimitive.Root className="aui-message-error-root border-destructive bg-destructive/10 text-destructive dark:bg-destructive/5 mt-2 rounded-md border p-3 text-sm dark:text-red-200">
- <ErrorPrimitive.Message className="aui-message-error-message line-clamp-2" />
- </ErrorPrimitive.Root>
+ <ErrorState
+ className="aui-message-error-root mt-2"
+ title="Something went wrong"
+ detail={detail}
+ retrying={false}
+ onRetry={() => reload?.()}
+ />
</MessagePrimitive.Error>
);
};
diff --git a/app/src/providers/assistantUiMessages.ts b/app/src/providers/assistantUiMessages.ts
index 5bd80c010b..a365993517 100644
--- a/app/src/providers/assistantUiMessages.ts
+++ b/app/src/providers/assistantUiMessages.ts
@@ -3,6 +3,7 @@ import type {
ThreadMessageLike,
ThreadUserMessagePart,
ToolApprovalOption,
+ ToolCallMessagePart,
} from '@assistant-ui/react';
import { parseMessageImages } from '../lib/attachments';