Skip to content

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

feat(conversations): show failed todo steps in pinned plan card

Steven Enamakel4e680635d333
diff --git a/app/src/components/assistant-ui/elements/agent-plan.tsx b/app/src/components/assistant-ui/elements/agent-plan.tsx
index 7dd78b23a1..602e1d864f 100644
--- a/app/src/components/assistant-ui/elements/agent-plan.tsx
+++ b/app/src/components/assistant-ui/elements/agent-plan.tsx
@@ -14,7 +14,7 @@
* string via `useT()`.
*/
import { cn } from '@/components/assistant-ui/lib/utils';
-import { CheckIcon, Loader2Icon } from 'lucide-react';
+import { CheckIcon, Loader2Icon, XIcon } from 'lucide-react';
import type { ComponentProps } from 'react';
import { pct, progressOf } from '../utils/range';
@@ -25,43 +25,58 @@ export function AgentPlan({
activeIndex,
title = 'Plan',
className,
+ statuses,
+ compact = false,
+ showHeader = true,
+ countLabel,
+ stepTestId,
...props
}: Omit<ComponentProps<'div'>, 'children' | 'steps' | 'activeIndex' | 'title'> & {
steps: readonly string[];
activeIndex: number;
title?: string;
+ /** Exact harness states when progress is not strictly sequential. */
+ statuses?: readonly ('pending' | 'active' | 'done' | 'failed')[];
+ compact?: boolean;
+ showHeader?: boolean;
+ countLabel?: string;
+ stepTestId?: string;
}) {
const total = steps.length;
- const completed = progressOf(activeIndex, total);
+ const completed = statuses ? statuses.filter(status => status === 'done').length : progressOf(activeIndex, total);
const allDone = completed >= total;
const progress = pct(completed, total);
return (
<div
data-slot="agent-plan"
- className={cn('flex w-full max-w-sm flex-col gap-3', className)}
+ className={cn('flex w-full max-w-sm flex-col', compact ? 'gap-1.5' : 'gap-3', className)}
{...props}>
- <div className="flex items-center justify-between">
+ {showHeader && <div className="flex items-center justify-between">
<span className="text-[13.5px] font-medium">{title}</span>
<span className={cn(mono, 'text-foreground/35 tabular-nums')}>
- {completed} of {total}
+ {countLabel ?? `${completed} of ${total}`}
</span>
- </div>
+ </div>}
<div className="bg-foreground/[0.06] h-[3px] w-full overflow-hidden rounded-full">
<span
className="bg-foreground/80 block h-full rounded-full transition-[width] duration-500"
style={{ width: `${progress}%` }}
/>
</div>
- <ul className="flex flex-col gap-2.5">
+ <ul className={cn('flex flex-col', compact ? 'gap-1' : 'gap-2.5')}>
{steps.map((step, i) => {
- const done = allDone || i < completed;
- const active = !allDone && i === completed;
+ const status = statuses?.[i] ?? (allDone || i < completed ? 'done' : i === completed ? 'active' : 'pending');
+ const done = status === 'done';
+ const active = status === 'active';
+ const failed = status === 'failed';
return (
- <li key={step} className="flex items-center gap-2.5 text-[13.5px]">
+ <li key={`${i}:${step}`} data-testid={stepTestId} data-status={status} className={cn('flex items-start gap-2.5', compact ? 'text-xs leading-4' : 'text-[13.5px]')}>
<span className="flex size-4 shrink-0 items-center justify-center">
{done ? (
<CheckIcon className="text-foreground/35 size-3.5" />
+ ) : failed ? (
+ <XIcon aria-hidden className="text-destructive size-3.5" />
) : active ? (
<Loader2Icon className="text-foreground/90 size-3.5 animate-spin motion-reduce:animate-none" />
) : (
@@ -72,7 +87,8 @@ export function AgentPlan({
className={cn(
done && 'text-foreground/40',
active && 'text-foreground/90',
- !done && !active && 'text-foreground/35'
+ failed && 'text-destructive',
+ !done && !active && !failed && 'text-foreground/35'
)}>
{step}
</span>
diff --git a/app/src/features/conversations/aui/PinnedTodoCard.tsx b/app/src/features/conversations/aui/PinnedTodoCard.tsx
index 4d116cffc9..2bd2ffc518 100644
--- a/app/src/features/conversations/aui/PinnedTodoCard.tsx
+++ b/app/src/features/conversations/aui/PinnedTodoCard.tsx
@@ -1,6 +1,6 @@
/**
- * The thread's live todo list pinned above the composer, as OpenClaw's
- * collapsible session progress card (`TodoProgressCard`).
+ * The thread's live steps pinned above the composer using assistant-ui's
+ * AgentPlan, in a disclosure that remembers the user's choice.
*
* Open by default while a step is in progress and collapsed otherwise, until
* the user opens or closes it by hand: that choice is remembered per thread in
@@ -12,8 +12,12 @@ import { useCallback, useEffect, useState } from 'react';
import {
type TodoItem,
todoProgress,
- TodoProgressCard,
} from '../../../components/assistant-ui/elements/todo-list';
+import { AgentPlan } from '../../../components/assistant-ui/elements/agent-plan';
+import { Button } from '../../../components/assistant-ui/ui/button';
+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../../../components/assistant-ui/ui/collapsible';
+import { ChevronRightIcon, ListChecksIcon } from 'lucide-react';
+import { cn } from '../../../components/assistant-ui/lib/utils';
import { useT } from '../../../lib/i18n/I18nContext';
import { userScopedStorage } from '../../../store/userScopedStorage';
@@ -91,19 +95,33 @@ export function PinnedTodoCard({
const { t } = useT();
const progress = todoProgress(items);
const [open, setOpen] = useTodoCardOpen(threadId, progress.anyActive);
+ const countLabel = t('chat.todos.ofTotal').replace('{done}', String(progress.done)).replace('{total}', String(progress.total));
return (
- <TodoProgressCard
- data-testid="todo-checklist"
- items={items}
- open={open}
- onOpenChange={setOpen}
- title={t('conversations.todos.title')}
- completedLabel={t('chat.todos.completed')}
- countLabel={t('chat.todos.ofTotal')
- .replace('{done}', String(progress.done))
- .replace('{total}', String(progress.total))}
- className={className}
- />
+ <Collapsible open={open} onOpenChange={setOpen} asChild>
+ <div data-testid="todo-checklist" data-open={open ? 'true' : 'false'} data-todo-completed={progress.done} data-todo-total={progress.total} className={cn('bg-background flex w-full flex-col gap-1 rounded-lg px-2 py-1', className)}>
+ <CollapsibleTrigger asChild>
+ <Button variant="ghost" size="sm" aria-label={t('conversations.runMode.plan')} className="h-auto w-full justify-start gap-2 px-0 py-1 text-xs">
+ <ListChecksIcon aria-hidden className="text-muted-foreground size-3.5" />
+ <span className="flex-1 text-start">{t('conversations.runMode.plan')}</span>
+ <span className="text-muted-foreground font-mono text-[11px]">{progress.allDone ? t('chat.todos.completed') : countLabel}</span>
+ <ChevronRightIcon aria-hidden className={cn('size-3 transition-transform', open && 'rotate-90')} />
+ </Button>
+ </CollapsibleTrigger>
+ <CollapsibleContent forceMount asChild>
+ <div hidden={!open} className="max-h-[min(160px,24dvh)] overflow-y-auto pb-1">
+ <AgentPlan
+ steps={items.map(item => item.reason && item.status === 'failed' ? `${item.text} — ${item.reason}` : item.text)}
+ statuses={items.map(item => item.status)}
+ activeIndex={progress.done}
+ compact
+ showHeader={false}
+ stepTestId="todo-item"
+ className="max-w-none"
+ />
+ </div>
+ </CollapsibleContent>
+ </div>
+ </Collapsible>
);
}