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
fix(agent): type root task board dispatch
Steven Enamakel1bce73c3af75
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rsindex 778fdd38b7..fde3e59a12 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs@@ -20,7 +20,9 @@ use crate::agent::orchestration::tools::{use crate::agent::tinyagents::host::OpenHumanRunContext;use crate::agent::tinyagents::tools::{CanonicalSharedToolAdapter, EarlyExitHook};use crate::agent::tinyagents::turn_policy::is_subagent_spawn_or_delegate_tool;-use crate::agent::tools::{DelegateToPersonalityDispatch, DelegateToolDispatch};+use crate::agent::tools::{+ DelegateToPersonalityDispatch, DelegateToolDispatch, TodoToolDispatch, UpdateTaskDispatch,+};/// Register every admitted tool from `tool_sets` onto `harness` (and its/// `capability_registry` projection), project the visible agent set as@@ -133,6 +135,10 @@ pub(super) fn register_turn_tools_and_agents(harness.register_tool_dispatch(Arc::new(DelegateGraphDispatch::new(adapter)));} else if name == "delegate" {harness.register_tool_dispatch(Arc::new(DelegateToolDispatch::new(adapter)));+ } else if name == "todo" {+ harness.register_tool_dispatch(Arc::new(TodoToolDispatch::new(adapter)));+ } else if name == "update_task" {+ harness.register_tool_dispatch(Arc::new(UpdateTaskDispatch::new(adapter)));} else if let Some(dispatch) = DelegationDispatch::for_tool(adapter.clone()) {harness.register_tool_dispatch(Arc::new(dispatch));} else {diff --git a/crates/openhuman-core/src/agent/tools.rs b/crates/openhuman-core/src/agent/tools.rsindex e7b7ff8c47..3008b6cf6e 100644--- a/crates/openhuman-core/src/agent/tools.rs+++ b/crates/openhuman-core/src/agent/tools.rs@@ -55,4 +55,6 @@ pub use run_workflow::{};pub use save_preference::SavePreferenceTool;pub use todo::TodoTool;+pub(crate) use todo::TodoToolDispatch;+pub(crate) use update_task::UpdateTaskDispatch;pub use update_task::UpdateTaskTool;diff --git a/crates/openhuman-core/src/agent/tools/todo.rs b/crates/openhuman-core/src/agent/tools/todo.rsindex cb145bc648..28b8fd3f76 100644--- a/crates/openhuman-core/src/agent/tools/todo.rs+++ b/crates/openhuman-core/src/agent/tools/todo.rs@@ -7,14 +7,45 @@//! tool falls back to a process-global scratch list. Returns a markdown//! rendering so transcripts read cleanly.+use crate::agent::harness::fork_context::ParentExecutionContext;use crate::agent::todos::ops::{self, BoardLocation, CardPatch};use crate::agent::todos::types::{TaskApprovalMode, TaskBoardCard, TaskCardStatus};use async_trait::async_trait;use serde_json::json;+use std::sync::Arc;+use tinyagents_harness::context::RunContext;+use tinyagents_harness::tool::{ToolDispatch, ToolExecutionContext};use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult, ToolRunContext};pub struct TodoTool;+pub(crate) struct TodoToolDispatch {+ tool: Arc<dyn Tool>,+}+impl TodoToolDispatch {+ pub(crate) fn new(tool: Arc<dyn Tool>) -> Self {+ Self { tool }+ }+}+#[async_trait]+impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for TodoToolDispatch {+ fn tool(&self) -> Arc<dyn Tool> {+ self.tool.clone()+ }+ async fn execute(+ &self,+ _state: &(),+ arguments: serde_json::Value,+ _options: ToolCallOptions,+ parent: &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,+ ) -> anyhow::Result<ToolResult> {+ let context = ToolExecutionContext::from_run_context(parent);+ TodoTool::new()+ .execute_with_parent_context(arguments, parent.data.parent.clone(), Some(&context))+ .await+ }+}+impl TodoTool {pub fn new() -> Self {Self@@ -107,6 +138,18 @@ impl Tool for TodoTool {args: serde_json::Value,_options: ToolCallOptions,tool_context: Option<&dyn ToolRunContext>,+ ) -> anyhow::Result<ToolResult> {+ self.execute_with_parent_context(args, None, tool_context)+ .await+ }+}++impl TodoTool {+ async fn execute_with_parent_context(+ &self,+ args: serde_json::Value,+ parent: Option<ParentExecutionContext>,+ tool_context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {let op = args.get("op")@@ -115,7 +158,7 @@ impl Tool for TodoTool {.trim().to_string();- let location = current_location(tool_context);+ let location = current_location(parent.as_ref(), tool_context);tracing::debug!(op = %op, thread_id = ?location.thread_id(), "[tool][todo] dispatch");let result = match op.as_str() {@@ -206,8 +249,11 @@ async fn default_task_approval_mode() -> Option<TaskApprovalMode> {}}-fn current_location(tool_context: Option<&dyn ToolRunContext>) -> BoardLocation {- let Some(parent) = crate::agent::harness::fork_context::current_parent() else {+fn current_location(+ parent: Option<&ParentExecutionContext>,+ tool_context: Option<&dyn ToolRunContext>,+) -> BoardLocation {+ let Some(parent) = parent else {return BoardLocation::Scratch;};// The orchestrator owns ONE global task board rather than a per-thread one:diff --git a/crates/openhuman-core/src/agent/tools/update_task.rs b/crates/openhuman-core/src/agent/tools/update_task.rsindex 0a39e95181..83ea843e93 100644--- a/crates/openhuman-core/src/agent/tools/update_task.rs+++ b/crates/openhuman-core/src/agent/tools/update_task.rs@@ -10,15 +10,45 @@//! applies the status move + field updates atomically and enforces the//! single-`in_progress` invariant.+use crate::agent::harness::fork_context::ParentExecutionContext;use crate::agent::todos::ops::{self, BoardLocation, CardPatch};use crate::integrations::task_sources::TASK_SOURCES_THREAD_ID;use async_trait::async_trait;use serde_json::json;use std::path::PathBuf;-use tinytools::{PermissionLevel, Tool, ToolResult};+use std::sync::Arc;+use tinyagents_harness::context::RunContext;+use tinyagents_harness::tool::ToolDispatch;+use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult};pub struct UpdateTaskTool;+pub(crate) struct UpdateTaskDispatch {+ tool: Arc<dyn Tool>,+}+impl UpdateTaskDispatch {+ pub(crate) fn new(tool: Arc<dyn Tool>) -> Self {+ Self { tool }+ }+}+#[async_trait]+impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for UpdateTaskDispatch {+ fn tool(&self) -> Arc<dyn Tool> {+ self.tool.clone()+ }+ async fn execute(+ &self,+ _state: &(),+ arguments: serde_json::Value,+ _options: ToolCallOptions,+ parent: &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,+ ) -> anyhow::Result<ToolResult> {+ UpdateTaskTool::new()+ .execute_with_parent_context(arguments, parent.data.parent.clone())+ .await+ }+}+impl UpdateTaskTool {pub fn new() -> Self {Self@@ -83,6 +113,16 @@ impl Tool for UpdateTaskTool {}async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {+ self.execute_with_parent_context(args, None).await+ }+}++impl UpdateTaskTool {+ async fn execute_with_parent_context(+ &self,+ args: serde_json::Value,+ parent: Option<ParentExecutionContext>,+ ) -> anyhow::Result<ToolResult> {let Some(id) = optional_string(&args, "id") else {return Ok(ToolResult::error("missing required field `id`".to_string()));};@@ -99,7 +139,7 @@ impl Tool for UpdateTaskTool {));}- let location = match resolve_location(&args).await {+ let location = match resolve_location(&args, parent.as_ref()).await {Ok(location) => location,Err(err) => return Ok(ToolResult::error(err)),};@@ -132,19 +172,22 @@ async fn apply(location: &BoardLocation, id: &str, patch: CardPatch) -> ToolResu}/// Resolve the board to act on: the explicit `threadId` arg, else the proactive-/// `task-sources` board. The workspace root comes from the running agent's fork-/// context when present, otherwise from the loaded config.-async fn resolve_location(args: &serde_json::Value) -> Result<BoardLocation, String> {+/// `task-sources` board. The workspace root comes from the explicit parent+/// carrier when present, otherwise from the loaded config.+async fn resolve_location(+ args: &serde_json::Value,+ parent: Option<&ParentExecutionContext>,+) -> Result<BoardLocation, String> {let thread_id =optional_string(args, "threadId").unwrap_or_else(|| TASK_SOURCES_THREAD_ID.to_string());Ok(BoardLocation::Thread {- workspace_dir: workspace_dir().await?,+ workspace_dir: workspace_dir(parent).await?,thread_id,})}-async fn workspace_dir() -> Result<PathBuf, String> {- if let Some(parent) = crate::agent::harness::fork_context::current_parent() {+async fn workspace_dir(parent: Option<&ParentExecutionContext>) -> Result<PathBuf, String> {+ if let Some(parent) = parent {return Ok(parent.workspace_dir.clone());}crate::config::ops::load_config_with_timeout()diff --git a/docs/plans/migrate-agent-runtime-to-tinyagents.md b/docs/plans/migrate-agent-runtime-to-tinyagents.mdindex abf0ba4a37..28eb70bd65 100644--- a/docs/plans/migrate-agent-runtime-to-tinyagents.md+++ b/docs/plans/migrate-agent-runtime-to-tinyagents.md@@ -225,6 +225,12 @@ observer. Replace reads of:- `fork_context`, `sandbox_context`, `spawn_depth_context`,`task_recency_context`; attachment, dispatch, and usage state now live on`OpenHumanRunContext`;++ Remaining `current_parent` reads are intentionally outside registered tool+ dispatch: the legacy orchestration root builders/entrypoints establish their+ own explicit parent before a direct run, while session construction uses its+ own descriptor as the root fallback. Registered root tools receive+ `OpenHumanRunContext` through typed dispatch and do not consult it.- `progress_sink`, `resolved_route`,`thread_context`, `turn_origin`, and `turn_workspace` task-local scopes.diff --git a/scripts/ci/agent-runtime-boundary-baseline.json b/scripts/ci/agent-runtime-boundary-baseline.jsonindex 2692b63fd9..c4afed4f53 100644--- a/scripts/ci/agent-runtime-boundary-baseline.json+++ b/scripts/ci/agent-runtime-boundary-baseline.json@@ -615,20 +615,6 @@"text": ".with_thread_id(tool_context.and_then(ToolRunContext::thread_id));","occurrence": 1},- {- "rule": "openhuman-task-local",- "path": "crates/openhuman-core/src/agent/tools/todo.rs",- "line": 210,- "text": "let Some(parent) = crate::agent::harness::fork_context::current_parent() else {",- "occurrence": 1- },- {- "rule": "openhuman-task-local",- "path": "crates/openhuman-core/src/agent/tools/update_task.rs",- "line": 147,- "text": "if let Some(parent) = crate::agent::harness::fork_context::current_parent() {",- "occurrence": 1- },{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/turn_origin.rs",@@ -891,14 +877,14 @@{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs",- "line": 572,+ "line": 575,"text": ".invoke(state, with_thread_id(request, self.thread_id.as_deref()))","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs",- "line": 599,+ "line": 602,"text": ".stream(state, with_thread_id(request, self.thread_id.as_deref()))","occurrence": 1},