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 to subagent orchestration code
Steven Enamakel2a782efee638
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rsindex 6145407fe1..4052436f41 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs@@ -316,12 +316,8 @@ async fn snapshot_and_block_scope_to_parent_and_reflect_live_status() {assert_eq!(snap[1].agent_id, "researcher");assert_eq!(snap[1].status, "running");- let block = active_subagents_context_block(- &cx(),- "fleet-parent",- &test_workspace(),- )- .expect("block present");+ let block = active_subagents_context_block(&cx(), "fleet-parent", &test_workspace())+ .expect("block present");assert!(block.contains("[active_subagents]"));assert!(block.contains("reuse its task_key with spawn_subagent"));assert!(block.contains("You have 2 sub-agent worker(s)"));@@ -330,19 +326,13 @@ async fn snapshot_and_block_scope_to_parent_and_reflect_live_status() {assert!(block.ends_with("[/active_subagents]\n\n"));// A parent with no registered workers gets no block (no perturbation).- assert!(active_subagents_context_block(- &cx(),- "nobody-here",- &test_workspace(),- )- .is_none());+ assert!(active_subagents_context_block(&cx(), "nobody-here", &test_workspace(),).is_none());// The shipped orchestrator has no wait/steer/close tools (#5701): the// guidance must not name them and must say results arrive on their own.{- let block =- active_subagents_context_block(&cx(), "fleet-parent", &test_workspace())- .expect("block present");+ let block = active_subagents_context_block(&cx(), "fleet-parent", &test_workspace())+ .expect("block present");for name in ["wait_subagent","steer_subagent",@@ -401,22 +391,15 @@ async fn snapshot_and_block_scope_to_parent_and_reflect_live_status() {).expect("mark idle");- let block = active_subagents_context_block(- &cx(),- "cold-parent",- durable_ws.path(),- )- .expect("durable-only roster present");+ let block = active_subagents_context_block(&cx(), "cold-parent", durable_ws.path())+ .expect("durable-only roster present");assert!(block.contains(&format!("session={}", session.subagent_session_id)));assert!(block.contains("status=idle"));assert!(block.contains("about: Daily X trending email workflow"));// Other parents' durable sessions must not leak in.- assert!(active_subagents_context_block(- &cx(),- "unrelated-parent",- durable_ws.path(),- )- .is_none());+ assert!(+ active_subagents_context_block(&cx(), "unrelated-parent", durable_ws.path(),).is_none()+ );}let _ = tx_a.send(DetachedSubagentStatus::Completed {diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rsindex 0ffb5b4dcb..664a1a9e45 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs@@ -26,7 +26,10 @@ fn parameters_schema_advertises_fire_and_forget_fields() {assert!(props.contains_key(key), "missing {key}");}for retired in ["blocking", "dedicated_thread", "archetype"] {- assert!(!props.contains_key(retired), "legacy {retired} was advertised");+ assert!(+ !props.contains_key(retired),+ "legacy {retired} was advertised"+ );}assert!(!props.contains_key("toolkit"),@@ -72,14 +75,25 @@ fn async_reference_payload_routes_follow_up_through_the_same_task_key() {assert_eq!(payload["agent_id"], "task_manager_agent");assert_eq!(payload["task_key"], "research-work");- assert_eq!(payload["instructions"]["answer_or_resume"]["tool"], "spawn_subagent");+ assert_eq!(+ payload["instructions"]["answer_or_resume"]["tool"],+ "spawn_subagent"+ );assert_eq!(payload["instructions"]["answer_or_resume"]["arguments"]["task_key"],"research-work");let serialized = serde_json::to_string(&payload).unwrap();- for retired in ["continue_subagent", "wait_subagent", "steer_subagent", "close_subagent"] {- assert!(!serialized.contains(retired), "{retired} leaked into the envelope");+ for retired in [+ "continue_subagent",+ "wait_subagent",+ "steer_subagent",+ "close_subagent",+ ] {+ assert!(+ !serialized.contains(retired),+ "{retired} leaked into the envelope"+ );}}diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rsindex 5d7793ad82..9f1f249e85 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs@@ -382,10 +382,7 @@ fn finish_spawn_registration(/// The wording follows what the parent can actually do: a parent without/// `wait_subagent` (the orchestrator, #5701) is told the result arrives on its/// own and not to poll, instead of being invited to "wait for completion".-fn format_async_subagent_accepted(- agent_id: &str,- payload_json: &str,-) -> String {+fn format_async_subagent_accepted(agent_id: &str, payload_json: &str) -> String {format!("Accepted async sub-agent `{agent_id}`. Its result is delivered automatically. To continue or answer a clarification, call `spawn_subagent` again with the same task_key.diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tests.rsindex 7b8523cf66..89da793ddf 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tests.rs@@ -5,11 +5,14 @@ fn parameters_schema_hides_legacy_mode_flags_and_keeps_required_agent_id() {let schema = tool.parameters_schema();let props = schema.get("properties").expect("schema has properties");for legacy in ["blocking", "dedicated_thread", "archetype", "toolkit"] {- assert!(props.get(legacy).is_none(), "legacy `{legacy}` is not advertised");+ assert!(+ props.get(legacy).is_none(),+ "legacy `{legacy}` is not advertised"+ );}- assert!(schema["required"].as_array().is_some_and(|required| {- required.iter().any(|key| key.as_str() == Some("agent_id"))- }));+ assert!(schema["required"]+ .as_array()+ .is_some_and(|required| { required.iter().any(|key| key.as_str() == Some("agent_id")) }));}#[test]@@ -102,7 +105,10 @@ fn frozen_legacy_mode_arguments_are_accepted_but_ignored() {"prompt": "inspect the frozen-session compatibility route",}));assert_eq!(decoded.agent_id, "task_manager_agent");- assert_eq!(decoded.prompt, "inspect the frozen-session compatibility route");+ assert_eq!(+ decoded.prompt,+ "inspect the frozen-session compatibility route"+ );assert_eq!(decoded.task_key, plain.task_key);assert!(!decoded.force_fresh);}diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rsindex b8510ca014..cdd7470127 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs@@ -2,10 +2,10 @@ use super::*;#[tokio::test]async fn spawn_subagent_with_same_task_key_resumes_paused_job_through_shared_driver() {- use crate::agent::orchestration::tools::SpawnSubagentTool;use crate::agent::orchestration::subagent_sessions::{DurableSubagentStatus, SubagentSessionStore,};+ use crate::agent::orchestration::tools::SpawnSubagentTool;use tinyagents_harness_tools::subagents::SubAgentJobRegistry;use tinyagents_orchestration::subagent::SubAgentJobStatus;@@ -54,7 +54,12 @@ async fn spawn_subagent_with_same_task_key_resumes_paused_job_through_shared_dri.nth(1).and_then(|value| value.split("\n[/async_subagent_ref]").next()).and_then(|value| serde_json::from_str::<serde_json::Value>(value).ok())- .unwrap_or_else(|| panic!("accepted envelope carries task reference: {}", paused.output()));+ .unwrap_or_else(|| {+ panic!(+ "accepted envelope carries task reference: {}",+ paused.output()+ )+ });let task_id = paused_ref["task_id"].as_str().expect("accepted task id")@@ -114,13 +119,22 @@ async fn spawn_subagent_with_same_task_key_resumes_paused_job_through_shared_dri.nth(1).and_then(|value| value.split("\n[/async_subagent_ref]").next()).and_then(|value| serde_json::from_str::<serde_json::Value>(value).ok())- .unwrap_or_else(|| panic!("resumed result carries task reference: {}", resumed.output()));+ .unwrap_or_else(|| {+ panic!(+ "resumed result carries task reference: {}",+ resumed.output()+ )+ });assert_eq!(resumed_ref["task_id"].as_str(),Some(task_id.as_str()),"resuming a checkpoint must keep its registered task identity");- assert_eq!(jobs.list().len(), before_job_count, "resume must not spawn a second child");+ assert_eq!(+ jobs.list().len(),+ before_job_count,+ "resume must not spawn a second child"+ );assert_eq!(resumed_ref["subagent_session_id"].as_str(),Some(before_session.subagent_session_id.as_str()),diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rsindex affeaa66e4..2ee69f666b 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rs@@ -3,8 +3,7 @@ use super::*;#[tokio::test]async fn failed_steer_of_running_reused_session_does_not_create_second_child() {use crate::agent::orchestration::subagent_sessions::{- DurableSubagentStatus, SubagentSessionSelector, SubagentSessionStore,- SubagentSessionUpsert,+ DurableSubagentStatus, SubagentSessionSelector, SubagentSessionStore, SubagentSessionUpsert,};use crate::agent::tinyagents::host::OpenHumanRunContext;use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};@@ -45,10 +44,13 @@ async fn failed_steer_of_running_reused_session_does_not_create_second_child() {parent_thread_id: Some(thread_id.into()),agent_id: "task_manager_agent".into(),model: Some("test-model".into()),- sandbox_mode: format!("{:?}", AgentDefinitionRegistry::builtins_only()- .get("task_manager_agent")- .expect("task manager definition")- .sandbox_mode),+ sandbox_mode: format!(+ "{:?}",+ AgentDefinitionRegistry::builtins_only()+ .get("task_manager_agent")+ .expect("task manager definition")+ .sandbox_mode+ ),action_root: None,task_key: "failed-steer-canary".into(),};@@ -97,15 +99,26 @@ async fn failed_steer_of_running_reused_session_does_not_create_second_child() {.await.expect("spawn tool executes");- assert!(result.is_error, "failed steer must be reported, got: {}", result.output());+ assert!(+ result.is_error,+ "failed steer must be reported, got: {}",+ result.output()+ );assert!(result.output().contains("refusing to start a duplicate")&& result.output().contains("existing-running-task"),"the refusal identifies the failed reusable task: {}",result.output());- assert!(provider.seen.lock().is_empty(), "no second child model run may start");- assert_eq!(jobs.list().len(), jobs_before, "no second child job is admitted");+ assert!(+ provider.seen.lock().is_empty(),+ "no second child model run may start"+ );+ assert_eq!(+ jobs.list().len(),+ jobs_before,+ "no second child job is admitted"+ );let after = store.load().expect("session store remains readable")@@ -113,7 +126,10 @@ async fn failed_steer_of_running_reused_session_does_not_create_second_child() {.find(|row| row.subagent_session_id == existing.subagent_session_id).expect("the original session remains");assert_eq!(after.status, DurableSubagentStatus::Running);- assert_eq!(after.current_task_id.as_deref(), Some("existing-running-task"));+ assert_eq!(+ after.current_task_id.as_deref(),+ Some("existing-running-task")+ );}#[tokio::test]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 390736a9f8..bfb02e0eb6 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@@ -298,4 +298,3 @@ mod driver_tests;#[path = "tools_e2e_continuation_tests.rs"]mod continuation_tests;-diff --git a/crates/openhuman-core/src/agent_registry/agents/loader_tests_builtin_registration_tests.rs b/crates/openhuman-core/src/agent_registry/agents/loader_tests_builtin_registration_tests.rsindex 06e0449414..20addfe96b 100644--- a/crates/openhuman-core/src/agent_registry/agents/loader_tests_builtin_registration_tests.rs+++ b/crates/openhuman-core/src/agent_registry/agents/loader_tests_builtin_registration_tests.rs@@ -258,11 +258,7 @@ fn master_agent_has_coding_hint_and_named_tools() {// always async and its result is delivered back on an idle// system turn, so there is nothing to collect and nothing to// block on.- for required in [- "spawn_subagent",- "list_subagents",- "continue_subagent",- ] {+ for required in ["spawn_subagent", "list_subagents", "continue_subagent"] {assert!(tools.iter().any(|t| t == required),"orchestrator must have sub-agent tool `{required}`"diff --git a/crates/openhuman-core/src/agent_registry/agents/orchestrator/prompt_tests_session_routing_tests.rs b/crates/openhuman-core/src/agent_registry/agents/orchestrator/prompt_tests_session_routing_tests.rsindex 7ba2ea54aa..e776f2d47a 100644--- a/crates/openhuman-core/src/agent_registry/agents/orchestrator/prompt_tests_session_routing_tests.rs+++ b/crates/openhuman-core/src/agent_registry/agents/orchestrator/prompt_tests_session_routing_tests.rs@@ -105,9 +105,8 @@ fn prompt_routes_workflow_authoring_to_the_builder_not_use_skill() {// The gate is the fix; this pins the prompt so the model is told the route// before it discovers the wall.assert!(- ARCHETYPE.contains(- "Build or edit a workflow: spawn `workflow_builder` with `spawn_subagent`"- ),+ ARCHETYPE+ .contains("Build or edit a workflow: spawn `workflow_builder` with `spawn_subagent`"),"orchestrator prompt must carry the workflow routing rule and name the spawn to make");diff --git a/crates/openhuman-core/src/agent_runs/subagent_control.rs b/crates/openhuman-core/src/agent_runs/subagent_control.rsindex 9897cec02a..831bcec051 100644--- a/crates/openhuman-core/src/agent_runs/subagent_control.rs+++ b/crates/openhuman-core/src/agent_runs/subagent_control.rs@@ -30,12 +30,10 @@ pub fn all_controller_schemas() -> Vec<ControllerSchema> {/// Registered controllers (schema + handler) for detached sub-agent control.pub fn all_registered_controllers() -> Vec<RegisteredController> {- vec![- RegisteredController {- schema: schema_for("subagent_cancel"),- handler: handle_subagent_cancel,- },- ]+ vec![RegisteredController {+ schema: schema_for("subagent_cancel"),+ handler: handle_subagent_cancel,+ }]}fn schema_for(function: &str) -> ControllerSchema {diff --git a/crates/openhuman-core/src/agent_runs/subagent_control_tests.rs b/crates/openhuman-core/src/agent_runs/subagent_control_tests.rsindex 8f20d9b3ad..f3e5626d6a 100644--- a/crates/openhuman-core/src/agent_runs/subagent_control_tests.rs+++ b/crates/openhuman-core/src/agent_runs/subagent_control_tests.rs@@ -230,4 +230,3 @@ async fn cancelling_a_paused_driver_queues_a_failed_delivery_with_reason() {assert!(delivery[0].result.text.contains("[SUBAGENT_FAILED]"));assert!(delivery[0].result.text.contains("user requested stop"));}-