The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(agent): tick plan steps off one at a time, in order
M3gA-Mindcf997e2e7b1c
diff --git a/app/src/components/assistant-ui/elements/agent-plan.tsx b/app/src/components/assistant-ui/elements/agent-plan.tsxindex 1bf1bb88d2..e78cc6cac0 100644--- a/app/src/components/assistant-ui/elements/agent-plan.tsx+++ b/app/src/components/assistant-ui/elements/agent-plan.tsx@@ -2,7 +2,7 @@import { cn } from '@/components/assistant-ui/lib/utils';import { useT } from '@/lib/i18n/I18nContext';-import { CheckIcon, Loader2Icon, XIcon } from 'lucide-react';+import { CheckIcon, Loader2Icon, MinusIcon, XIcon } from 'lucide-react';import type { ComponentProps } from 'react';import { announced, pct, progressOf } from '../utils/range';@@ -27,13 +27,13 @@ export function AgentPlan({activeIndex: number;title?: string | undefined;/** Core progress can complete steps out of order or stop on a failed step. */- statuses?: readonly ('pending' | 'active' | 'done' | 'failed')[];+ statuses?: readonly ('pending' | 'active' | 'done' | 'failed' | 'skipped')[];stepTestId?: string;}) {const { t } = useT();const total = steps.length;const completed = statuses- ? statuses.filter(status => status === 'done').length+ ? statuses.filter(status => status === 'done' || status === 'skipped').length: progressOf(activeIndex, total);const countLabel = t('chat.todos.ofTotal').replace('{done}', String(completed))@@ -70,14 +70,17 @@ export function AgentPlan({const done = status === 'done';const active = status === 'active';const failed = status === 'failed';+ const skipped = status === 'skipped';const statusText = t(status === 'done'? 'conversations.taskCard.state.done'- : status === 'failed'- ? 'conversations.taskCard.state.failed'- : status === 'active'- ? 'conversations.backgroundTasks.statusRunning'- : 'orchestration.runStatus.pending'+ : skipped+ ? 'conversations.taskCard.state.cancelled'+ : status === 'failed'+ ? 'conversations.taskCard.state.failed'+ : status === 'active'+ ? 'conversations.backgroundTasks.statusRunning'+ : 'orchestration.runStatus.pending');return (<li@@ -91,6 +94,8 @@ export function AgentPlan({<span className="flex size-4 shrink-0 items-center justify-center">{done ? (<CheckIcon aria-hidden className="text-muted-foreground size-3.5" />+ ) : skipped ? (+ <MinusIcon aria-hidden className="text-muted-foreground size-3.5" />) : failed ? (<XIcon aria-hidden className="text-destructive size-3.5" />) : active ? (@@ -111,6 +116,7 @@ export function AgentPlan({done && 'text-muted-foreground',active && 'text-foreground/90',failed && 'text-destructive',+ skipped && 'line-through decoration-[1.5px]',!done && !active && !failed && 'text-muted-foreground')}>{item.label}diff --git a/app/src/components/assistant-ui/elements/todo-list.test.tsx b/app/src/components/assistant-ui/elements/todo-list.test.tsxindex 99aaccc7e3..6cb34de005 100644--- a/app/src/components/assistant-ui/elements/todo-list.test.tsx+++ b/app/src/components/assistant-ui/elements/todo-list.test.tsx@@ -30,6 +30,15 @@ describe('todoProgress', () => {expect(finished.current?.text).toBe('B');});+ it('counts a skipped step as closed, never as the current one', () => {+ const progress = todoProgress([+ { id: '1', text: 'A', status: 'done' },+ { id: '2', text: 'B', status: 'skipped', reason: 'not needed' },+ ]);+ expect(progress).toMatchObject({ done: 2, total: 2, allDone: true });+ expect(progress.current?.text).toBe('A');+ });+it('handles an empty list', () => {expect(todoProgress([])).toMatchObject({ total: 0, position: 0, allDone: false });});diff --git a/app/src/components/assistant-ui/elements/todo-list.tsx b/app/src/components/assistant-ui/elements/todo-list.tsxindex 795660aaf2..4f55e341b4 100644--- a/app/src/components/assistant-ui/elements/todo-list.tsx+++ b/app/src/components/assistant-ui/elements/todo-list.tsx@@ -18,12 +18,22 @@* leaves in the transcript. Every string they show is a prop.*/import { cn } from '@/components/assistant-ui/lib/utils';-import { CheckIcon, ChevronRightIcon, ListChecksIcon, Loader2Icon, XIcon } from 'lucide-react';+import {+ CheckIcon,+ ChevronRightIcon,+ ListChecksIcon,+ Loader2Icon,+ MinusIcon,+ XIcon,+} from 'lucide-react';import type { ComponentProps, ReactNode } from 'react';import { mono } from './surfaces';-export type TodoStatus = 'pending' | 'active' | 'done' | 'failed';+export type TodoStatus = 'pending' | 'active' | 'done' | 'failed' | 'skipped';++/** A step that needs no more work: done, or skipped (cancelled with a reason). */+export const isClosedTodo = (status: TodoStatus) => status === 'done' || status === 'skipped';export interface TodoItem {id: string;@@ -43,7 +53,7 @@ export function TodoList({revision?: number;title?: string;}) {- const done = items.filter(item => item.status === 'done').length;+ const done = items.filter(item => isClosedTodo(item.status)).length;return (<div data-slot="todo-list" className={cn('flex w-full flex-col gap-3', className)} {...props}>@@ -89,6 +99,10 @@ export function TodoItems({<span className="border-foreground/20 bg-foreground/[0.06] flex size-3.5 items-center justify-center rounded-[5px] border"><CheckIcon className="text-muted-foreground size-2.5" /></span>+ ) : item.status === 'skipped' ? (+ <span className="border-foreground/15 flex size-3.5 items-center justify-center rounded-[5px] border">+ <MinusIcon className="text-muted-foreground size-2.5" />+ </span>) : item.status === 'failed' ? (<span className="flex size-3.5 items-center justify-center rounded-[5px] border border-red-600/25 bg-red-600/[0.08] dark:border-red-400/25 dark:bg-red-400/[0.08]"><XIcon className="size-2.5 text-red-600 dark:text-red-400" />@@ -110,11 +124,13 @@ export function TodoItems({),item.status === 'active' && 'text-foreground/90',item.status === 'pending' && 'text-muted-foreground',+ item.status === 'skipped' &&+ 'text-muted-foreground line-through decoration-[1.5px]',item.status === 'failed' && 'text-red-600 dark:text-red-400')}>{item.text}</span>- {item.status === 'failed' && item.reason ? (+ {(item.status === 'failed' || item.status === 'skipped') && item.reason ? (<p className="text-muted-foreground text-xs leading-4 break-words">{item.reason}</p>) : null}</div>@@ -137,7 +153,7 @@ export interface TodoProgress {/** Counts and the "current step" a collapsed progress line shows. */export function todoProgress(items: readonly TodoItem[]): TodoProgress {- const done = items.filter(item => item.status === 'done').length;+ const done = items.filter(item => isClosedTodo(item.status)).length;let index = items.findIndex(item => item.status === 'active');if (index < 0) index = items.findIndex(item => item.status === 'pending');if (index < 0) {diff --git a/app/src/features/conversations/aui/PinnedTodoCard.tsx b/app/src/features/conversations/aui/PinnedTodoCard.tsxindex bad80a14b9..0aca67b793 100644--- a/app/src/features/conversations/aui/PinnedTodoCard.tsx+++ b/app/src/features/conversations/aui/PinnedTodoCard.tsx@@ -24,7 +24,9 @@ export function PinnedTodoCard({steps={items.map(item => ({id: item.id,label:- item.reason && item.status === 'failed' ? `${item.text} — ${item.reason}` : item.text,+ item.reason && (item.status === 'failed' || item.status === 'skipped')+ ? `${item.text} — ${item.reason}`+ : item.text,}))}statuses={items.map(item => item.status)}activeIndex={progress.done}diff --git a/app/src/features/conversations/aui/TodoListPart.test.tsx b/app/src/features/conversations/aui/TodoListPart.test.tsxindex e05025c9bb..87d25ce0ae 100644--- a/app/src/features/conversations/aui/TodoListPart.test.tsx+++ b/app/src/features/conversations/aui/TodoListPart.test.tsx@@ -13,6 +13,9 @@ describe('mapCoreTodoStatus', () => {it('maps pending to pending', () => {expect(mapCoreTodoStatus('pending')).toBe('pending');});+ it('maps cancelled to skipped, never pending', () => {+ expect(mapCoreTodoStatus('cancelled')).toBe('skipped');+ });it('maps an unknown status to pending', () => {expect(mapCoreTodoStatus('bogus')).toBe('pending');expect(mapCoreTodoStatus(undefined)).toBe('pending');@@ -31,6 +34,12 @@ describe('toAuiTodoItems', () => {]);});+ it('carries a cancelled step as skipped with its reason', () => {+ expect(+ toAuiTodoItems([{ content: 'Deploy', status: 'cancelled', reason: 'not asked for' }])+ ).toEqual([{ id: '0-Deploy', text: 'Deploy', status: 'skipped', reason: 'not asked for' }]);+ });+it('drops items with no non-empty content', () => {expect(toAuiTodoItems([{ content: '', status: 'pending' }, { status: 'pending' }])).toEqual([]);});diff --git a/app/src/features/conversations/aui/TodoListPart.tsx b/app/src/features/conversations/aui/TodoListPart.tsxindex 7c6d157f43..c87a6227c9 100644--- a/app/src/features/conversations/aui/TodoListPart.tsx+++ b/app/src/features/conversations/aui/TodoListPart.tsx@@ -11,12 +11,12 @@ import { useT } from '../../../lib/i18n/I18nContext';import type { CoreTodoStatus } from '../../../store/threadTodosSlice';/**- * Adapts the core wire shape of a `todo` tool call — `{content, status}` with- * `status: 'pending'|'in_progress'|'completed'` — onto the vendored- * `TodoList` element's `TodoItem` shape (`{id, text, status}` with- * `status: 'pending'|'active'|'done'|'failed'`). The core never sends- * `'failed'` today, so that status never maps — kept here anyway so the- * mapping stays honest if the core ever adds it.+ * Adapts the core wire shape of a `todo` tool call — `{content, status,+ * reason?}` with `status: 'pending'|'in_progress'|'completed'|'cancelled'` —+ * onto the vendored `TodoList` element's `TodoItem` shape (`{id, text, status,+ * reason?}` with `status: 'pending'|'active'|'done'|'failed'|'skipped'`). A+ * cancelled step shows as skipped, never as pending. The core never sends+ * `'failed'`, so that status never maps.*/export function mapCoreTodoStatus(status: unknown): TodoStatus {switch (status) {@@ -24,6 +24,8 @@ export function mapCoreTodoStatus(status: unknown): TodoStatus {return 'active';case 'completed':return 'done';+ case 'cancelled':+ return 'skipped';case 'pending':return 'pending';default:@@ -34,6 +36,7 @@ export function mapCoreTodoStatus(status: unknown): TodoStatus {interface CoreTodoItem {content?: unknown;status?: unknown;+ reason?: unknown;}function isCoreTodoItem(value: unknown): value is CoreTodoItem {@@ -52,6 +55,9 @@ export function toAuiTodoItems(raw: unknown): TodoItem[] {id: `${index}-${content}`,text: content,status: mapCoreTodoStatus(candidate.status),+ ...(typeof candidate.reason === 'string' && candidate.reason+ ? { reason: candidate.reason }+ : {}),});});return items;diff --git a/app/src/features/conversations/aui/taskCardHistory.ts b/app/src/features/conversations/aui/taskCardHistory.tsindex a9121bce24..c302e1c863 100644--- a/app/src/features/conversations/aui/taskCardHistory.ts+++ b/app/src/features/conversations/aui/taskCardHistory.ts@@ -9,7 +9,7 @@ export interface TurnTask {export const taskFinished = (task: TurnTask) =>Boolean(task.goal || task.todos.length) &&(!task.goal || task.goal.status === 'complete') &&- task.todos.every(item => item.status === 'completed');+ task.todos.every(item => item.status === 'completed' || item.status === 'cancelled');export const taskState = (task: TurnTask, running = true): 'done' | 'working' | 'waiting' =>taskFinished(task)diff --git a/app/src/services/chatService.ts b/app/src/services/chatService.tsindex 9b0ee3b4b2..9d923cb559 100644--- a/app/src/services/chatService.ts+++ b/app/src/services/chatService.ts@@ -434,7 +434,9 @@ export interface ChatPlanReviewRequestEvent {*/export interface ChatThreadTodoItem {content: string;- status: 'pending' | 'in_progress' | 'completed';+ status: 'pending' | 'in_progress' | 'completed' | 'cancelled';+ /** Why the step was cancelled; only on a `cancelled` item. */+ reason?: string;}/**diff --git a/app/src/store/threadTodosSlice.ts b/app/src/store/threadTodosSlice.tsindex f964a79399..283b49573f 100644--- a/app/src/store/threadTodosSlice.ts+++ b/app/src/store/threadTodosSlice.ts@@ -12,12 +12,14 @@import { createSlice, type PayloadAction } from '@reduxjs/toolkit';/** Core wire status for one todo item (`DomainEvent::ThreadTodosChanged`). */-export type CoreTodoStatus = 'pending' | 'in_progress' | 'completed';+export type CoreTodoStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled';/** One todo item as the core sends it — wire shape, not the element's shape. */export interface ThreadTodoItemView {content: string;status: CoreTodoStatus;+ /** Why the step was cancelled; only on a `cancelled` item. */+ reason?: string;}export interface ThreadTodosState {diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.md b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.mdindex adaeb24ccc..6406fcffdb 100644--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.md+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.md@@ -22,7 +22,7 @@ First match wins:## Grounding and tool use- Make a tool call in the message that announces it; keep going until done; batch independent calls.-- 3+ steps: `todo`, then execute. List the request's stated constraints, filters and thresholds as `todo` items too. Ask only if the ambiguity changes the tool.+- 3+ steps: `todo`, then execute. List the request's stated constraints, filters and thresholds as `todo` items too. One step at a time, in order: tick each with `todo {"complete": N}` as soon as it's done, before starting the next. Ask only if the ambiguity changes the tool.- Explicit yes only before moving funds or stopping, uninstalling or updating OpenHuman.- Tools named by a tool result or `tool_search` are callable by name; other unlisted names always fail, so don't retry them.- Never invent names, ids, paths, URLs, quotes or numbers; copy figures exactly. Worker summaries are claims: check them against their evidence. Truncated output is incomplete.diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rsindex 8fb4c9d96d..aef1458827 100644--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs@@ -505,6 +505,7 @@ fn build_never_mandates_plan_review_and_allows_a_lead_in() {assert!(!body.contains("request_plan_review"), "{body}");assert!(!body.contains("before doing any of the work"));assert!(body.contains("3+ steps: `todo`, then execute."));+ assert!(body.contains("tick each with `todo {\"complete\": N}` as soon as it's done"));assert!(body.contains("Make a tool call in the message that announces it"));}diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rsindex 890ebd6a43..32c8d03d74 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs@@ -519,6 +519,11 @@ async fn drive_turn(failure_map: failure_map.clone(),provider_usage_carry: provider_usage_carry.clone(),tool_outcome_sink: tool_outcome_sink.clone(),+ // The store the `todo` tool resolves from the same parent context.+ todo_store: run_context+ .parent+ .as_ref()+ .map(|parent| crate::agent::todos::ops::store(&parent.workspace_dir)),},);if let Some(scope) = run_context.response_shape.clone() {diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rsindex 064db8d386..9809c1e90f 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs@@ -89,6 +89,9 @@ pub(super) struct TurnMiddlewareInputs {pub(super) provider_usage_carry: ProviderUsageCarry,/// Per-call tool success/content capture for honest `ToolCallRecord`s.pub(super) tool_outcome_sink: ToolOutcomeSink,+ /// The store the `todo` tool writes this turn's plan to; `Some` lets the+ /// plan-order middleware read it. `None` for a turn with no workspace.+ pub(super) todo_store: Option<Arc<dyn tinyagents_harness::store::Store>>,}/// The handles the run loop reads after the drive returns.@@ -137,6 +140,7 @@ pub(super) fn install_turn_middleware(failure_map,provider_usage_carry,tool_outcome_sink,+ todo_store,} = inputs;let super::host::HarnessHostPolicy {stop_hooks,@@ -430,6 +434,22 @@ pub(super) fn install_turn_middleware("[unmet_deliverable] not installed for this turn");}+ // Plan steps run in order: no work while no step is in progress, a final+ // answer is held once while steps are open, a step stuck in progress gets+ // one reminder. Same scope as the requirements check, and registered after+ // it so its `after_model` runs first and the plan check comes first.+ match todo_store {+ Some(store) if verify_before_finish::applies(is_subagent, agent_id) => {+ harness.push_middleware(Arc::new(+ tinyagents_graph::todos::TodoSequenceMiddleware::new(store),+ ));+ }+ _ => tracing::debug!(+ is_subagent,+ agent = agent_id.unwrap_or("<none>"),+ "[todo_sequence] not installed for this turn"+ ),+ }// Direct web lookup is bounded. Once enough search/fetch results have// returned, the web tools leave the request so the run works with what itdiff --git a/crates/openhuman-core/src/agent/tools/todo.rs b/crates/openhuman-core/src/agent/tools/todo.rsindex fb4ae0fbcf..0f67a04e98 100644--- a/crates/openhuman-core/src/agent/tools/todo.rs+++ b/crates/openhuman-core/src/agent/tools/todo.rs@@ -65,14 +65,17 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for T.map(|c| c.workspace_dir).map_err(|e| anyhow::anyhow!("[tool][todo] load config: {e}"))?,};- let is_write = arguments.get("todos").is_some();+ let is_write = ["todos", "complete", "cancel"]+ .iter()+ .any(|key| arguments.get(*key).is_some());let scope = current_scope(parent.data.parent.as_ref(), Some(&context));let result = TodoTool::new(workspace_dir).execute_with_parent_context(arguments, parent.data.parent.clone(), Some(&context)).await?;- // Only a whole-list write changes anything the frontend's todo drawer- // needs to hear about; a bare read (`{}`) re-reports the same list and- // would just be a redundant socket event.+ // Only a write (the whole list, a `complete` or a `cancel`) changes+ // anything the frontend's todo drawer needs to hear about; a bare read+ // (`{}`) re-reports the same list and would just be a redundant socket+ // event.if is_write && !result.is_error {if let Some(id) = scope.session_id() {match serde_json::from_str::<serde_json::Value>(&result.output())diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rsindex 08b83b4048..19cd45576b 100644--- a/tests/agent_harness_e2e.rs+++ b/tests/agent_harness_e2e.rs@@ -4611,10 +4611,12 @@ async fn todo_list_ticks_off_five_items_across_turns_inner() {// Turn 1 writes the plan (item 1 in progress). Turns 2-6 each complete// one more item; the final write has every item completed. Every todo write// also triggers verify-before-finish, so reserve a separate scripted answer- // for its extra model request on each turn.+ // for its extra model request on each turn. A turn that ends with steps+ // still open is held once more first, by the plan-order check.let mut script = vec![todo_write(&FIVE_STEPS, 0),text_completion("Plan written; starting on the first step."),+ text_completion("The remaining steps continue in the next turns."),// A todo write triggers the orchestrator's verify-before-finish// middleware, which makes one more model request before the turn ends.// Keep that completion separate so each following turn advances one@@ -4624,6 +4626,11 @@ async fn todo_list_ticks_off_five_items_across_turns_inner() {for completed in 1..=FIVE_STEPS.len() {script.push(todo_write(&FIVE_STEPS, completed));script.push(text_completion(&format!("Step {completed} done.")));+ if completed < FIVE_STEPS.len() {+ script.push(text_completion(+ "The remaining steps continue in the next turns.",+ ));+ }script.push(text_completion("The completed work matches the requested step.",));@@ -4789,18 +4796,18 @@ async fn todo_list_ticks_off_five_items_across_turns_inner() {stack.shutdown();}-/// Two `in_progress` items break the single-focus invariant: the store-/// refuses the write, the agent gets a tool error it can correct, and the-/// list it wrote before is untouched.+/// Two `in_progress` items break the single-focus invariant: the store keeps+/// the first, sets the other back to pending and says so in the result, so+/// the agent sees the list it now has instead of an error.#[test]-fn todo_list_rejects_two_items_in_progress() {+fn todo_list_keeps_one_item_in_progress() {run_on_agent_stack(- "todo_list_rejects_two_items_in_progress",- todo_list_rejects_two_items_in_progress_inner,+ "todo_list_keeps_one_item_in_progress",+ todo_list_keeps_one_item_in_progress_inner,);}-async fn todo_list_rejects_two_items_in_progress_inner() {+async fn todo_list_keeps_one_item_in_progress_inner() {let _lock = env_lock();reset_script(vec![todo_write(&["Only step", "Next step"], 0),@@ -4811,7 +4818,7 @@ async fn todo_list_rejects_two_items_in_progress_inner() {{ "content": "Next step", "status": "in_progress" }] }),),- // A read (no `todos`) shows the earlier write survived the rejection.+ // A read (no `todos`) shows the list the fix left.tool_call_completion("todo", json!({})),text_completion("Kept one thing in progress."),]);@@ -4850,28 +4857,28 @@ async fn todo_list_rejects_two_items_in_progress_inner() {assert_eq!(todo_frames.len(),3,- "write, rejected write, read: {results:?}"+ "write, fixed write, read: {results:?}");assert_eq!(todo_frames[0]["success"], json!(true), "{}", todo_frames[0]);assert_eq!(todo_frames[1]["success"],- json!(false),- "two in_progress must be rejected: {}",+ json!(true),+ "two in_progress are fixed, not rejected: {}",todo_frames[1]);assert!(todo_frames[1]["output"].as_str().unwrap_or("")- .contains("in_progress"),- "the error names the invariant: {}",+ .contains("Only one step may be in progress"),+ "the result says what was fixed: {}",todo_frames[1]);let read: Value = serde_json::from_str(todo_frames[2]["output"].as_str().unwrap()).unwrap();assert_eq!(todo_statuses(&read),vec!["in_progress", "pending"],- "the rejected write left the list untouched: {read}"+ "the second in_progress went back to pending: {read}");stack.shutdown();