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
style: apply rustfmt formatting across subagent tooling
Steven Enamakeladf45e036154
diff --git a/crates/openhuman-core/src/agent/orchestration/tools.rs b/crates/openhuman-core/src/agent/orchestration/tools.rsindex afd0db6919..589bc3dba0 100644--- a/crates/openhuman-core/src/agent/orchestration/tools.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools.rs@@ -34,10 +34,10 @@ mod spawn_async_subagent;mod spawn_parallel_agents;#[path = "tools/spawn_subagent.rs"]mod spawn_subagent;-#[path = "tools/subagent_control_surfaces.rs"]-mod subagent_control_surfaces;#[path = "tools/subagent_abort_report.rs"]mod subagent_abort_report;+#[path = "tools/subagent_control_surfaces.rs"]+mod subagent_control_surfaces;#[cfg(test)]#[path = "tools/tools_e2e_tests.rs"]mod tools_e2e_tests;diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rsindex 92deec1d80..838ab5fb44 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs@@ -30,7 +30,9 @@ enum DelegationDispatchKind {Collapsed {targets: Result<Vec<super::collapsed_delegation::DelegateTarget>, String>,},- Archetype { agent_id: String },+ Archetype {+ agent_id: String,+ },}impl DelegationDispatch {diff --git a/crates/openhuman-core/src/agent/orchestration/tools/subagent_control_surfaces.rs b/crates/openhuman-core/src/agent/orchestration/tools/subagent_control_surfaces.rsindex 264ee4271c..8c286ce6d9 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/subagent_control_surfaces.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/subagent_control_surfaces.rs@@ -11,10 +11,10 @@ use serde_json::{json, Value};use tinyagents_orchestration::subagent::SubagentResumeRef;use tinytools::{PermissionLevel, Tool, ToolResult, ToolTimeout};+use crate::agent::orchestration::subagent_sessions;use crate::agent::orchestration::subagent_sessions::{DurableSubagentSessionSummary, DurableSubagentStatus,};-use crate::agent::orchestration::subagent_sessions;use tinyagents_tasks::{OrchestrationTaskRecord, OrchestrationTaskStatus};pub struct ListSubagentsTool;@@ -125,7 +125,11 @@ impl Tool for WaitSubagentTool {}async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {- let task_id = args.get("task_id").and_then(Value::as_str).unwrap_or("").trim();+ let task_id = args+ .get("task_id")+ .and_then(Value::as_str)+ .unwrap_or("")+ .trim();let session_id = args.get("subagent_session_id").and_then(Value::as_str)@@ -173,13 +177,21 @@ impl Tool for SteerSubagentTool {}async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {- let task_id = args.get("task_id").and_then(Value::as_str).unwrap_or("").trim();+ let task_id = args+ .get("task_id")+ .and_then(Value::as_str)+ .unwrap_or("")+ .trim();let session_id = args.get("subagent_session_id").and_then(Value::as_str).unwrap_or("").trim();- let message = args.get("message").and_then(Value::as_str).unwrap_or("").trim();+ let message = args+ .get("message")+ .and_then(Value::as_str)+ .unwrap_or("")+ .trim();if task_id.is_empty() && session_id.is_empty() {return Ok(ToolResult::error("steer_subagent: `subagent_session_id` or `task_id` is required",@@ -263,22 +275,23 @@ pub(crate) fn overlay_task_store_status(let Some(task_id) = summary.current_task_id.clone() else {return;};- let record = match crate::agent::orchestration::running_subagents::task_record_for_task_in_workspace(- workspace_dir,- &task_id,- parent_session,- ) {- Ok(record) => record,- Err(tinyagents_orchestration::subagent::WaitError::Unknown) => return,- Err(tinyagents_orchestration::subagent::WaitError::RegistryPoisoned) => {- log::warn!("[subagent_reuse] task store overlay skipped task_id={} reason=registry_poisoned", task_id);- return;- }- Err(tinyagents_orchestration::subagent::WaitError::NotOwned) => {- log::warn!("[subagent_reuse] task store overlay rejected task_id={} subagent_session_id={} reason=not_owned", task_id, summary.subagent_session_id);- return;- }- };+ let record =+ match crate::agent::orchestration::running_subagents::task_record_for_task_in_workspace(+ workspace_dir,+ &task_id,+ parent_session,+ ) {+ Ok(record) => record,+ Err(tinyagents_orchestration::subagent::WaitError::Unknown) => return,+ Err(tinyagents_orchestration::subagent::WaitError::RegistryPoisoned) => {+ log::warn!("[subagent_reuse] task store overlay skipped task_id={} reason=registry_poisoned", task_id);+ return;+ }+ Err(tinyagents_orchestration::subagent::WaitError::NotOwned) => {+ log::warn!("[subagent_reuse] task store overlay rejected task_id={} subagent_session_id={} reason=not_owned", task_id, summary.subagent_session_id);+ return;+ }+ };let previous = summary.status;apply_task_record_overlay(summary, record);if summary.status != previous {@@ -313,7 +326,10 @@ fn apply_task_record_overlay(summary.status = DurableSubagentStatus::Failed;summary.reusable = false;summary.latest_error = Some(record.error.unwrap_or_else(|| {- format!("sub-agent reached durable task status `{}`", durable_status_label(record.status))+ format!(+ "sub-agent reached durable task status `{}`",+ durable_status_label(record.status)+ )}));}}@@ -383,18 +399,18 @@ pub(crate) fn wait_status_payload(})}+#[cfg(test)]+#[path = "close_subagent_tests.rs"]+mod close_tests;#[cfg(test)]#[path = "list_subagents_tests.rs"]mod list_tests;#[cfg(test)]-#[path = "wait_subagent_tests.rs"]-mod wait_tests;+#[path = "steer_subagent_schema_tests.rs"]+mod steer_schema_tests;#[cfg(test)]#[path = "steer_subagent_tests.rs"]mod steer_tests;#[cfg(test)]-#[path = "steer_subagent_schema_tests.rs"]-mod steer_schema_tests;-#[cfg(test)]-#[path = "close_subagent_tests.rs"]-mod close_tests;+#[path = "wait_subagent_tests.rs"]+mod wait_tests;diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rsindex eca9dcbe1d..7fe453c62f 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs@@ -73,10 +73,10 @@ async fn force_fresh_cancels_old_driver_before_creating_a_new_session() {use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};use crate::tools::toolpacks::ToolGroups;use tinyagents_harness::context::RunContext;+ use tinyagents_harness::tool::ToolDispatch;use tinyagents_orchestration::subagent::{SubAgentJobRegistry, SubAgentJobStatus, SubAgentJobsTool,};- use tinyagents_harness::tool::ToolDispatch;struct GatedModel {calls: std::sync::atomic::AtomicUsize,@@ -143,8 +143,7 @@ async fn force_fresh_cancels_old_driver_before_creating_a_new_session() {config.workspace_dir = workspace.clone();config.components.juice = false;let core = CoreContext::for_test_with_config(DomainSet::full(), config.clone()).derive_with(- ContextOverlay::new(config, DomainSet::full(), ToolGroups::none())- .definitions(definitions),+ ContextOverlay::new(config, DomainSet::full(), ToolGroups::none()).definitions(definitions),);let mut host_context = OpenHumanRunContext::new().with_core(Some(Arc::clone(&core)))@@ -264,8 +263,8 @@ async fn force_fresh_cancels_old_driver_before_creating_a_new_session() {release_first.notify_one();release_second.notify_one();- let session_port = crate::agent::orchestration::subagent_sessions::- OpenHumanTinySubagentSessionStore::new(+ let session_port =+ crate::agent::orchestration::subagent_sessions::OpenHumanTinySubagentSessionStore::new(workspace.clone(),"force-fresh-parent-session",Some("force-fresh-parent-thread".into()),@@ -302,7 +301,9 @@ async fn force_fresh_cancels_old_driver_before_creating_a_new_session() {serde_json::from_str(&settled.output()).expect("wait returns job JSON");assert_eq!(old_terminal["status"], "cancelled");assert_eq!(- jobs.get(&old_job.id.to_string()).expect("old child remains registered").status,+ jobs.get(&old_job.id.to_string())+ .expect("old child remains registered")+ .status,SubAgentJobStatus::Cancelled);let new_settled = tokio::time::timeout(@@ -326,13 +327,13 @@ async fn force_fresh_cancels_old_driver_before_creating_a_new_session() {assert_eq!(new_terminal["extensions"]["task_id"], fresh_task_id);let new_job_id = new_terminal["id"].as_str().expect("generic job ID");assert_eq!(- jobs.get(new_job_id).expect("replacement remains registered").status,+ jobs.get(new_job_id)+ .expect("replacement remains registered")+ .status,SubAgentJobStatus::Completed);assert_eq!(provider.calls.load(std::sync::atomic::Ordering::SeqCst), 2);- let after_rows = store- .load()- .expect("final durable state");+ let after_rows = store.load().expect("final durable state");let old_after = after_rows.iter().find(|session| session.subagent_session_id == before.subagent_session_id)@@ -344,7 +345,10 @@ async fn force_fresh_cancels_old_driver_before_creating_a_new_session() {.find(|session| session.subagent_session_id == replacement.subagent_session_id).expect("replacement durable row remains present");assert_eq!(new_after.status, DurableSubagentStatus::Idle);- assert_eq!(new_after.current_task_id.as_deref(), Some(fresh_ref["task_id"].as_str().unwrap()));+ assert_eq!(+ new_after.current_task_id.as_deref(),+ Some(fresh_ref["task_id"].as_str().unwrap())+ );}#[tokio::test]@@ -369,8 +373,7 @@ async fn stopped_async_spawn_is_refused_before_progress_or_session_effects() {config.workspace_dir = workspace.clone();config.components.juice = false;let core = CoreContext::for_test_with_config(DomainSet::full(), config.clone()).derive_with(- ContextOverlay::new(config, DomainSet::full(), ToolGroups::none())- .definitions(definitions),+ ContextOverlay::new(config, DomainSet::full(), ToolGroups::none()).definitions(definitions),);let thread_id = "stopped-async-parent-thread";let mut host_context = OpenHumanRunContext::new()@@ -378,14 +381,12 @@ async fn stopped_async_spawn_is_refused_before_progress_or_session_effects() {.with_parent(parent);host_context.thread_id = Some(thread_id.into());let live = RunContext::<OpenHumanRunContext>::new(- tinyagents_harness::context::RunConfig::new("stopped-async-parent")- .with_thread(thread_id),+ tinyagents_harness::context::RunConfig::new("stopped-async-parent").with_thread(thread_id),host_context,);let dispatch = live.data.dispatch_ctx();crate::agent::orchestration::background_completions::discard_pending_for_thread(- &dispatch,- thread_id,+ &dispatch, thread_id,);let detached_data = live.data.detached_child();let detached = live@@ -410,14 +411,30 @@ async fn stopped_async_spawn_is_refused_before_progress_or_session_effects() {.await.expect("tool execution");- assert!(result.is_error, "a stopped thread must reject new child work");- assert!(result.output().contains("stopped or deleted"), "{}", result.output());- assert!(provider.seen.lock().is_empty(), "refusal must not dispatch the model");- assert!(progress_rx.try_recv().is_err(), "refusal must not publish spawn progress");+ assert!(+ result.is_error,+ "a stopped thread must reject new child work"+ );+ assert!(+ result.output().contains("stopped or deleted"),+ "{}",+ result.output()+ );+ assert!(+ provider.seen.lock().is_empty(),+ "refusal must not dispatch the model"+ );+ assert!(+ progress_rx.try_recv().is_err(),+ "refusal must not publish spawn progress"+ );let jobs = crate::core::runtime::slot_for::<tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&dispatch);- assert!(jobs.list().is_empty(), "refusal must not register a shared job");+ assert!(+ jobs.list().is_empty(),+ "refusal must not register a shared job"+ );assert!(crate::agent::orchestration::subagent_sessions::SubagentSessionStore::new(workspace.clone()@@ -428,8 +445,7 @@ async fn stopped_async_spawn_is_refused_before_progress_or_session_effects() {"refusal must not persist an accepted session");crate::agent::orchestration::background_completions::resume_stopped_thread(- &dispatch,- thread_id,+ &dispatch, thread_id,);}@@ -458,8 +474,7 @@ async fn detached_registration_failure_finishes_the_announced_product_card() {config.workspace_dir = workspace.clone();config.components.juice = false;let core = CoreContext::for_test_with_config(DomainSet::full(), config.clone()).derive_with(- ContextOverlay::new(config, DomainSet::full(), ToolGroups::none())- .definitions(definitions),+ ContextOverlay::new(config, DomainSet::full(), ToolGroups::none()).definitions(definitions),);let thread_id = "registration-failure-parent-thread";let mut host_context = OpenHumanRunContext::new()@@ -499,21 +514,30 @@ async fn detached_registration_failure_finishes_the_announced_product_card() {assert!(result.is_error, "depth rejection is a failed registration");let events = std::iter::from_fn(|| progress_rx.try_recv().ok()).collect::<Vec<_>>();assert!(- matches!(events.as_slice(), [- crate::progress::AgentProgress::SubagentSpawned { .. },- crate::progress::AgentProgress::SubagentFailed { .. }- ]),+ matches!(+ events.as_slice(),+ [+ crate::progress::AgentProgress::SubagentSpawned { .. },+ crate::progress::AgentProgress::SubagentFailed { .. }+ ]+ ),"the announced product card must end in failure: {events:?}");let store = SubagentSessionStore::new(workspace.clone());let rows = store.load().expect("session row is durable");assert_eq!(rows.len(), 1);assert_eq!(rows[0].status, DurableSubagentStatus::Failed);- assert!(provider.seen.lock().is_empty(), "registration error must not dispatch the model");+ assert!(+ provider.seen.lock().is_empty(),+ "registration error must not dispatch the model"+ );let jobs = crate::core::runtime::slot_for::<tinyagents_orchestration::subagent::SubAgentJobRegistry,>(&live.data.dispatch_ctx());- assert!(jobs.list().is_empty(), "failed request construction must not register a job");+ assert!(+ jobs.list().is_empty(),+ "failed request construction must not register a job"+ );}/// A child the harness stops early (failure breaker / iteration cap) is not adiff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rsindex ed034dbc4e..2c6948d968 100644--- a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs+++ b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs@@ -182,7 +182,8 @@ impl ToolDispatch<(), OpenHumanRunContext> for UseSkillDispatch {.await;};- if let Some(dispatch) = typed_dispatch_for(&name, inner_adapter.clone(), delegation_target) {+ if let Some(dispatch) = typed_dispatch_for(&name, inner_adapter.clone(), delegation_target)+ {return dispatch.execute(&(), call_id, inner_args, options, parent).await;diff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rsindex 4caf4f3ccf..01ca95a46d 100644--- a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs@@ -258,15 +258,12 @@ async fn packed_delegate_uses_scoped_target_and_registers_shared_job() {let mut target = crate::agent::harness::test_support::test_inherit_echo_def();target.id = "scoped_only_packed_worker".into();target.delegate_name = Some("create_image".into());- let definitions = Arc::new(- AgentDefinitionRegistry::default().with_definitions([target]),- );+ let definitions = Arc::new(AgentDefinitionRegistry::default().with_definitions([target]));let mut config = crate::config::Config::default();config.workspace_dir = workspace.path().to_path_buf();config.components.juice = false;let core = CoreContext::for_test_with_config(DomainSet::full(), config.clone()).derive_with(- ContextOverlay::new(config, DomainSet::full(), ToolGroups::none())- .definitions(definitions),+ ContextOverlay::new(config, DomainSet::full(), ToolGroups::none()).definitions(definitions),);let mut parent_context = parent_execution_context(workspace.path());parent_context.allowed_subagent_ids = ["scoped_only_packed_worker".to_string()]@@ -296,11 +293,14 @@ async fn packed_delegate_uses_scoped_target_and_registers_shared_job() {assert!(!result.is_error, "{}", result.output());assert_eq!(result.text(), "a generated image description");let jobs = crate::core::runtime::slot_for::<SubAgentJobRegistry>(&parent.data.dispatch_ctx());- assert!(jobs.list().iter().any(|job| {- job.agent == "scoped_only_packed_worker"- && job.status == SubAgentJobStatus::Completed- && job.output.as_deref() == Some("a generated image description")- }), "the packed target executes through the shared driver job registry");+ assert!(+ jobs.list().iter().any(|job| {+ job.agent == "scoped_only_packed_worker"+ && job.status == SubAgentJobStatus::Completed+ && job.output.as_deref() == Some("a generated image description")+ }),+ "the packed target executes through the shared driver job registry"+ );}/// The disclosure half (no `tool` named) needs no live parent at all, and