Skip to content

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

fix(ui): handle undefined error in tool fallback and expose plan review event

Steven Enamakel1e95f65d564c
diff --git a/app/src/components/assistant-ui/elements/guardrail-notice.tsx b/app/src/components/assistant-ui/elements/guardrail-notice.tsx
new file mode 100644
index 0000000000..99a5bdab6c
--- /dev/null
+++ b/app/src/components/assistant-ui/elements/guardrail-notice.tsx
@@ -0,0 +1,76 @@
+'use client';
+
+/**
+ * Vendored from the assistant-ui `elements-guardrail-notice` registry item
+ * (https://r.assistant-ui.com/styles/base-nova/elements-guardrail-notice.json).
+ * Changes from upstream:
+ * - `cn` import path (`@/components/assistant-ui/lib/utils`).
+ * - "try instead" is an `alternativesLabel` prop with an English default,
+ * for `useT()`.
+ */
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { ShieldIcon } from 'lucide-react';
+import type { ComponentProps } from 'react';
+
+import { mono, paper } from './surfaces';
+
+export function GuardrailNotice({
+ title,
+ explanation,
+ policy,
+ alternatives,
+ onPick,
+ alternativesLabel = 'try instead',
+ className,
+ ...props
+}: Omit<
+ ComponentProps<'div'>,
+ 'children' | 'title' | 'explanation' | 'policy' | 'alternatives' | 'onPick'
+> & {
+ title: string;
+ explanation: string;
+ policy: string;
+ alternatives: readonly string[];
+ onPick?: (alternative: string) => void;
+ alternativesLabel?: string;
+}) {
+ return (
+ <div
+ data-slot="guardrail-notice"
+ className={cn(paper, 'flex w-full max-w-sm flex-col gap-3 rounded-[20px] p-4', className)}
+ {...props}>
+ <div className="flex items-center gap-2.5">
+ <span className="flex size-7 shrink-0 items-center justify-center rounded-lg bg-amber-500/12 text-amber-600 dark:text-amber-400">
+ <ShieldIcon className="size-3.5" />
+ </span>
+ <span className="min-w-0 flex-1 truncate text-[13.5px] font-medium">{title}</span>
+ <span className={cn(mono, 'text-foreground/30 shrink-0')}>{policy}</span>
+ </div>
+
+ <p className="text-foreground/60 text-xs leading-relaxed">{explanation}</p>
+
+ {alternatives.length > 0 && (
+ <div className="flex flex-col gap-1.5">
+ <span className={cn(mono, 'text-foreground/30')}>{alternativesLabel}</span>
+ {alternatives.map((alternative) =>
+ onPick ? (
+ <button
+ key={alternative}
+ type="button"
+ onClick={() => onPick(alternative)}
+ className="hover:bg-foreground/[0.04] text-foreground/70 hover:text-foreground/95 -mx-1.5 rounded-lg px-1.5 py-1 text-start text-[13px] transition-colors">
+ {alternative}
+ </button>
+ ) : (
+ <span
+ key={alternative}
+ className="text-foreground/70 -mx-1.5 rounded-lg px-1.5 py-1 text-start text-[13px]">
+ {alternative}
+ </span>
+ )
+ )}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/app/src/components/assistant-ui/elements/tool-fallback.tsx b/app/src/components/assistant-ui/elements/tool-fallback.tsx
index c3aad105fb..6c58e57f63 100644
--- a/app/src/components/assistant-ui/elements/tool-fallback.tsx
+++ b/app/src/components/assistant-ui/elements/tool-fallback.tsx
@@ -292,7 +292,7 @@ function ToolFallbackError({
if (status?.type !== 'incomplete') return null;
const error = status.error;
- const errorText = error ? (typeof error === 'string' ? error : JSON.stringify(error)) : null;
+ const errorText = error === undefined || error === null ? null : formatUnknownValue(error);
if (!errorText) return null;
diff --git a/crates/openhuman-core/src/web_chat/mod.rs b/crates/openhuman-core/src/web_chat/mod.rs
index f92e0c2883..b421310b2a 100644
--- a/crates/openhuman-core/src/web_chat/mod.rs
+++ b/crates/openhuman-core/src/web_chat/mod.rs
@@ -51,9 +51,10 @@ pub(crate) use web_errors::{
// Public API — event bus
pub use event_bus::{
- approval_request_event, publish_web_channel_event, register_agent_surface_subscriber,
- register_approval_surface_subscriber, register_artifact_surface_subscriber,
- register_egress_surface_subscriber, subscribe_web_channel_events,
+ approval_request_event, plan_review_request_event, publish_web_channel_event,
+ register_agent_surface_subscriber, register_approval_surface_subscriber,
+ register_artifact_surface_subscriber, register_egress_surface_subscriber,
+ subscribe_web_channel_events,
};
// Test-only: OnceLock-bypassing approval bridge for per-runtime integration tests.