Skip to content

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

refactor(todo): replace task-board types with simpler todo types

Steven Enamakel0d1cd4206e9f
diff --git a/crates/openhuman-core/src/agent/tinyagents/todos.rs b/crates/openhuman-core/src/agent/tinyagents/todos.rs
index 191c5ce5ca..8512de1fce 100644
--- a/crates/openhuman-core/src/agent/tinyagents/todos.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/todos.rs
@@ -2,10 +2,8 @@
//!
//! Todos are session state, the way Claude Code and Codex keep them: one list
//! per agent session, alive for the life of the process, gone on restart. The
-//! transcript still records every list the model wrote. There used to be a
-//! durable per-thread "task board" here (a KV table keyed by conversation
-//! thread plus an `agent_task_boards` file-store migration at boot); nothing
-//! rendered it and it was removed with the board tools.
+//! transcript still records every list the model wrote, and the frontend
+//! renders the latest one from the turn's `todo` tool call.
use std::sync::{Arc, OnceLock};
diff --git a/crates/openhuman-core/src/agent/tools/todo.rs b/crates/openhuman-core/src/agent/tools/todo.rs
index aef5846d35..ea569d20c8 100644
--- a/crates/openhuman-core/src/agent/tools/todo.rs
+++ b/crates/openhuman-core/src/agent/tools/todo.rs
@@ -1,8 +1,8 @@
//! `todo` — the session's todo list, the way Claude Code and Codex have it.
//!
//! One call writes the whole list: `{"todos": [{"content", "status"}]}`.
-//! There is no per-card CRUD, no approval gate, no evidence, no plan; the
-//! list is a progress checklist the model rewrites as it works. It is scoped
+//! There is no per-item CRUD; the list is a progress checklist the model
+//! rewrites as it works. It is scoped
//! to the agent session the turn runs in (in memory, for the life of the
//! process) via [`crate::agent::todos::ops`]; without a session (a bare
//! `execute` in a test) it falls back to a scratch list. Calling with no
@@ -10,7 +10,7 @@
use crate::agent::harness::fork_context::ParentExecutionContext;
use crate::agent::todos::ops::{self, TodoScope};
-use crate::agent::todos::types::{TaskBoardCard, TaskCardStatus};
+use crate::agent::todos::types::{TodoItem, TodoStatus};
use async_trait::async_trait;
use serde::Deserialize;
use serde_json::json;
@@ -142,38 +142,27 @@ impl TodoTool {
Some(raw) => {
let items: Vec<TodoItem> = serde_json::from_value(raw.clone())
.map_err(|e| anyhow::anyhow!("invalid `todos`: {e}"))?;
- let mut cards = Vec::with_capacity(items.len());
+ let mut todos = Vec::with_capacity(items.len());
for item in items {
let content = item.content.trim();
if content.is_empty() {
anyhow::bail!("every todo needs non-empty `content`");
}
- let mut card = TaskBoardCard::new(content);
- card.status = match item.status.as_deref() {
- None => TaskCardStatus::Todo,
+ let status = match item.status.as_deref() {
+ None => TodoStatus::Pending,
Some(raw) => ops::parse_status(raw).map_err(anyhow::Error::msg)?,
};
- cards.push(card);
+ todos.push(TodoItem::with_status(content, status));
}
- ops::replace(&scope, cards).await
+ ops::replace(&scope, todos).await
}
};
match result {
Ok(snap) => {
- let todos: Vec<serde_json::Value> = snap
- .cards
- .iter()
- .map(|card| {
- json!({
- "content": card.title,
- "status": wire_status(card.status),
- })
- })
- .collect();
let payload = json!({
"sessionId": snap.session_id,
- "todos": todos,
+ "todos": snap.items,
"markdown": snap.markdown,
});
Ok(ToolResult::success(payload.to_string()))
@@ -183,20 +172,6 @@ impl TodoTool {
}
}
-/// The three states the model is told about. Store states the list can no
-/// longer produce (`ready`, `awaiting_approval`, `rejected`, `blocked`) fold
-/// into the nearest one so an old thread still reads sensibly.
-fn wire_status(status: TaskCardStatus) -> &'static str {
- match status {
- TaskCardStatus::InProgress => "in_progress",
- TaskCardStatus::Done | TaskCardStatus::Rejected => "completed",
- TaskCardStatus::Todo
- | TaskCardStatus::Ready
- | TaskCardStatus::AwaitingApproval
- | TaskCardStatus::Blocked => "pending",
- }
-}
-
/// The list belongs to the agent session the tool runs in: the orchestrator's
/// session for a chat thread, a sub-agent's own session for its run. The
/// orchestrator used to be routed to one app-wide `orchestrator-tasks` board
diff --git a/crates/openhuman-core/src/agent/tools/todo_tests.rs b/crates/openhuman-core/src/agent/tools/todo_tests.rs
index 7c926b9ae2..dda4a9233d 100644
--- a/crates/openhuman-core/src/agent/tools/todo_tests.rs
+++ b/crates/openhuman-core/src/agent/tools/todo_tests.rs
@@ -173,12 +173,11 @@ async fn sessions_do_not_see_each_other_and_a_list_survives_across_turns() {
crate::agent::todos::ops::clear(&a).await.unwrap();
crate::agent::todos::ops::clear(&b).await.unwrap();
- let mut card = TaskBoardCard::new("only in a");
- card.status = TaskCardStatus::InProgress;
- crate::agent::todos::ops::replace(&a, vec![card]).await.unwrap();
+ let item = TodoItem::with_status("only in a", TodoStatus::InProgress);
+ crate::agent::todos::ops::replace(&a, vec![item]).await.unwrap();
let a_again = crate::agent::todos::ops::list(&a).await.unwrap();
- assert_eq!(a_again.cards.len(), 1, "a later turn of the same session reads it back");
+ assert_eq!(a_again.items.len(), 1, "a later turn of the same session reads it back");
assert_eq!(a_again.session_id.as_deref(), Some("sess-a"));
- assert!(crate::agent::todos::ops::list(&b).await.unwrap().cards.is_empty());
+ assert!(crate::agent::todos::ops::list(&b).await.unwrap().items.is_empty());
}