Skip to content

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

fix(agent): handle empty todo list in tinyagents

Steven Enamakelc5241964eac7
diff --git a/crates/openhuman-core/src/agent/tinyagents/todos.rs b/crates/openhuman-core/src/agent/tinyagents/todos.rs
index 8512de1fce..9fb62a0358 100644
--- a/crates/openhuman-core/src/agent/tinyagents/todos.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/todos.rs
@@ -1,18 +1,26 @@
-//! The in-process store behind the session todo list.
+//! The persisted store behind the session todo list.
//!
//! 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, and the frontend
-//! renders the latest one from the turn's `todo` tool call.
+//! per conversation thread. Persisted under
+//! `{workspace}/tinyagents_store/kv/` — the same `FileStore` tree
+//! `open_session_stores` opens for thread goals (`agent::goals::store`) — so a
+//! list survives a core restart instead of resetting with the old
+//! process-global `InMemoryStore`. The 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};
+use std::path::Path;
+use std::sync::Arc;
-use tinyagents_harness::store::{InMemoryStore, Store};
+use tinyagents_harness::store::Store;
-/// The process-wide store every session's list lives in, keyed by session id.
-pub fn session_todos_store() -> Arc<dyn Store> {
- static STORE: OnceLock<Arc<dyn Store>> = OnceLock::new();
- STORE.get_or_init(|| Arc::new(InMemoryStore::new())).clone()
+use crate::agent::session_import::ops::open_session_stores;
+
+/// The `workspace`-scoped store every session's list lives in, keyed by
+/// session/thread id. Opened fresh per call (cheap — `FileStore` just holds a
+/// root path) so it always reflects the caller's current workspace.
+pub fn session_todos_store(workspace_dir: &Path) -> Arc<dyn Store> {
+ Arc::new(open_session_stores(workspace_dir).kv)
}
/// Synthetic key for a tool call that has no session at all (a bare