Skip to content

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

style: apply rustfmt import ordering and assertion formatting

Steven Enamakele00873b475fa
diff --git a/crates/openhuman-core/src/agent/orchestration/tools.rs b/crates/openhuman-core/src/agent/orchestration/tools.rs
index 67b81f2222..d71ddd104d 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools.rs
@@ -45,10 +45,10 @@ mod tools_e2e_tests;
pub(crate) use dispatch::DelegationDispatch;
pub(crate) use subagent_control_surfaces::overlay_task_store_status;
pub(crate) use subagent_control_surfaces::{
- format_running_wait_message, requested_timeout_secs, wait_status_payload,
+ CloseSubagentTool, ListSubagentsTool, SteerSubagentTool, WaitSubagentTool,
};
pub(crate) use subagent_control_surfaces::{
- CloseSubagentTool, ListSubagentsTool, SteerSubagentTool, WaitSubagentTool,
+ format_running_wait_message, requested_timeout_secs, wait_status_payload,
};
/// A minimal live TinyAgents carrier over `parent`, for tests that drive a
@@ -67,13 +67,13 @@ pub(crate) fn live_parent_run_context(
}
pub use archetype_delegation::{ArchetypeDelegationTool, DelegationTarget};
-pub use collapsed_delegation::{CollapsedDelegationTool, DelegateTarget, DELEGATE_TO_TOOL_NAME};
+pub use collapsed_delegation::{CollapsedDelegationTool, DELEGATE_TO_TOOL_NAME, DelegateTarget};
pub(crate) use continue_subagent::ContinueSubagentDispatch;
pub use continue_subagent::ContinueSubagentTool;
pub(crate) use delegate_graph::DelegateGraphDispatch;
pub use delegate_graph::DelegateGraphTool;
pub(crate) use spawn_async_subagent::SpawnAsyncSubagentDispatch;
-pub use spawn_async_subagent::{scope_spawn_async_subagent_spec, SpawnAsyncSubagentTool};
+pub use spawn_async_subagent::{SpawnAsyncSubagentTool, scope_spawn_async_subagent_spec};
pub(crate) use spawn_parallel_agents::SpawnParallelAgentsDispatch;
pub use spawn_parallel_agents::SpawnParallelAgentsTool;
pub(crate) use spawn_subagent::SpawnSubagentDispatch;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/archetype_delegation_host.rs b/crates/openhuman-core/src/agent/orchestration/tools/archetype_delegation_host.rs
index 8428d8682d..a132d13a71 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/archetype_delegation_host.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/archetype_delegation_host.rs
@@ -1,6 +1,6 @@
use async_trait::async_trait;
-use serde_json::json;
use serde_json::Value;
+use serde_json::json;
use tinytools::ToolRunContext;
use tinytools::{
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/collapsed_delegation_host.rs b/crates/openhuman-core/src/agent/orchestration/tools/collapsed_delegation_host.rs
index c67772951f..10789e7083 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/collapsed_delegation_host.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/collapsed_delegation_host.rs
@@ -56,7 +56,7 @@
//! [`ToolExposure::Hidden`]: tinytools::ToolExposure::Hidden
use async_trait::async_trait;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use super::archetype_delegation::{delegation_envelope_properties, render_structured_handoff};
use tinytools::ToolRunContext;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent_host.rs b/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent_host.rs
index 82f43e6c34..a90d881ea6 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent_host.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent_host.rs
@@ -10,8 +10,8 @@
use crate::agent::orchestration::tools::dispatch::{incomplete_stop, stopped_subagent_result};
use crate::agent::subagent_host::{
- continue_subagent, continue_subagent_via_driver_tool, load_subagent_checkpoint,
- SubagentRunOptions, SubagentRunStatus,
+ SubagentRunOptions, SubagentRunStatus, continue_subagent, continue_subagent_via_driver_tool,
+ load_subagent_checkpoint,
};
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use crate::progress::AgentProgress;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs
index 38eea629be..f6f29f7715 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs
@@ -4,7 +4,7 @@ use std::sync::Arc;
use tinytools::Tool;
use super::super::collapsed_delegation::{
- dispatch_targets_from_schema, CollapsedDelegationTool, DelegateTarget,
+ CollapsedDelegationTool, DelegateTarget, dispatch_targets_from_schema,
};
use super::super::delegate_graph::DelegateGraphDispatch;
use crate::tools::delegate::DelegateToolDispatch;
@@ -130,8 +130,7 @@ fn archetype_dispatch_uses_the_registered_target_marker_not_ambient_names() {
});
assert!(
- DelegationDispatch::for_tool(tool.clone(), Some("scoped_only_agent".to_string()))
- .is_some(),
+ DelegationDispatch::for_tool(tool.clone(), Some("scoped_only_agent".to_string())).is_some(),
"an explicitly registered delegation target is routable even when its name is not in the ambient catalogue"
);
assert!(
@@ -248,9 +247,11 @@ async fn config_delegate_dispatch_preserves_tool_failure_in_shared_jobs() {
.expect("the host returns the configured tool result");
assert!(result.is_error);
- assert!(result
- .output()
- .contains("configured policy rejected the request"));
+ assert!(
+ result
+ .output()
+ .contains("configured policy rejected the request")
+ );
assert!(
jobs.list().iter().any(|job| {
job.agent == "configured-error"
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/list_subagents_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/list_subagents_tests.rs
index 1fb247e75d..5170e558f1 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/list_subagents_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/list_subagents_tests.rs
@@ -3,11 +3,13 @@ use super::*;
#[test]
fn schema_has_no_required_fields() {
let schema = ListSubagentsTool::new().parameters_schema();
- assert!(schema
- .get("required")
- .and_then(|v| v.as_array())
- .expect("required")
- .is_empty());
+ assert!(
+ schema
+ .get("required")
+ .and_then(|v| v.as_array())
+ .expect("required")
+ .is_empty()
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
index 8186eb6882..6aac1c51fd 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
@@ -301,9 +301,10 @@ fn async_reference_matches_the_orchestrator_fleet_vocabulary() {
.iter()
.filter_map(|v| v.as_str())
.collect();
- assert!(next
- .iter()
- .any(|a| a.contains("delivered to you automatically")));
+ assert!(
+ next.iter()
+ .any(|a| a.contains("delivered to you automatically"))
+ );
let message = format_async_subagent_accepted("task_manager_agent", &serialized, &fleet);
let prose = message.split("[async_subagent_ref]").next().unwrap();
@@ -615,8 +616,10 @@ fn scoped_instance_advertises_exactly_the_allowlist() {
schema["properties"]["agent_id"]["enum"],
serde_json::json!(["agent_memory", "workflow_builder"])
);
- assert!(schema["properties"]["agent_id"]["description"]
- .as_str()
- .unwrap_or_default()
- .contains("only these are dispatchable"));
+ assert!(
+ schema["properties"]["agent_id"]["description"]
+ .as_str()
+ .unwrap_or_default()
+ .contains("only these are dispatchable")
+ );
}
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs
index 3c8d6bfff9..e0aa14c8c5 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs
@@ -6,8 +6,8 @@ use crate::agent::orchestration::spawn_parallel::ParallelAgentLineage;
use crate::agent::orchestration::spawn_parallel::ParallelAgentResult;
use crate::agent::orchestration::spawn_parallel::ParallelAgentTask;
use crate::agent::orchestration::spawn_parallel::{
- format_spawn_parallel_success, run_spawn_parallel_tasks_with_cancellation_and_workspace,
- SpawnParallelGraphOutcome,
+ SpawnParallelGraphOutcome, format_spawn_parallel_success,
+ run_spawn_parallel_tasks_with_cancellation_and_workspace,
};
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use async_trait::async_trait;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_policy_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_policy_tests.rs
index 449c958c51..a8f0bb1e03 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_policy_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_policy_tests.rs
@@ -210,12 +210,16 @@ async fn collects_immediate_task_validation_failures() {
.iter()
.map(|result| result["error"].as_str().unwrap_or_default())
.collect::<Vec<_>>();
- assert!(errors
- .iter()
- .any(|error| error.contains("agent_id and prompt")));
- assert!(errors
- .iter()
- .any(|error| error.contains("unknown agent_id")));
+ assert!(
+ errors
+ .iter()
+ .any(|error| error.contains("agent_id and prompt"))
+ );
+ assert!(
+ errors
+ .iter()
+ .any(|error| error.contains("unknown agent_id"))
+ );
}
#[test]
@@ -303,9 +307,11 @@ fn shared_workspace_allows_readonly_or_explicitly_isolated_workers() {
&parent,
);
- assert!(preflight
- .into_iter()
- .all(|item| matches!(item, SpawnParallelTaskPreflight::Prepared(_))));
+ assert!(
+ preflight
+ .into_iter()
+ .all(|item| matches!(item, SpawnParallelTaskPreflight::Prepared(_)))
+ );
}
// This exercises the full parallel-subagent path (parent turn → spawn N
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
index c688170a0f..79e687c7ca 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
@@ -1,10 +1,10 @@
use super::*;
+use crate::agent::OpenHumanSessionHost;
use crate::agent::harness::fork_context::ParentExecutionContext;
use crate::agent::orchestration::spawn_parallel::{
- prepare_spawn_parallel_tasks_from_defs, ParallelTaskRejectionKind, SpawnParallelTaskPreflight,
+ ParallelTaskRejectionKind, SpawnParallelTaskPreflight, prepare_spawn_parallel_tasks_from_defs,
};
use crate::agent::tinyagents::host::OpenHumanRunContext;
-use crate::agent::OpenHumanSessionHost;
use crate::agent_registry::host_definition::AgentDefinition;
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use crate::config::AgentConfig;
@@ -13,8 +13,8 @@ use parking_lot::Mutex;
use serde_json::json;
use std::collections::HashMap;
use std::sync::{
- atomic::{AtomicUsize, Ordering},
Arc,
+ atomic::{AtomicUsize, Ordering},
};
use tinyagents_definition::{
AgentTier, DefinitionSource, ModelSpec, PromptSource, SandboxMode, ToolScope,
@@ -29,7 +29,7 @@ use tinytools::{PermissionLevel, Tool, ToolResult};
use tinytools_agent::dialect::NativeDialect;
use tinytools_agent::dialect::ToolCallFormat;
use tinytools_agent::dialect::TranscriptEntry;
-use tokio::time::{sleep, timeout, Duration};
+use tokio::time::{Duration, sleep, timeout};
const PARENT_PROMPT_CANARY: &str = "parallel-fanout-e2e-canary";
const RESEARCH_PROMPT_CANARY: &str = "research-branch-canary";
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.rs
index a8bcbd8253..ce200aad57 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
@@ -14,7 +14,7 @@
//!
use crate::agent::orchestration::tools::dispatch::{incomplete_stop, stopped_subagent_result};
use crate::agent::subagent_host::{
- run_subagent_via_driver_tool, SubagentRunOptions, SubagentRunOutcome, SubagentRunStatus,
+ SubagentRunOptions, SubagentRunOutcome, SubagentRunStatus, run_subagent_via_driver_tool,
};
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use crate::core::runtime::DispatchCtx;
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.rs
index 50d10575ff..fbd7fcc4dd 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
@@ -51,11 +51,13 @@ fn parameters_schema_advertises_dedicated_thread_flag() {
assert_eq!(flag.get("type").and_then(|v| v.as_str()), Some("boolean"));
// Must be off by default — workers are an opt-in escape hatch, not
// a free upgrade for every spawn.
- assert!(schema
- .get("required")
- .and_then(|v| v.as_array())
- .map(|arr| arr.iter().all(|s| s.as_str() != Some("dedicated_thread")))
- .unwrap_or(true));
+ assert!(
+ schema
+ .get("required")
+ .and_then(|v| v.as_array())
+ .map(|arr| arr.iter().all(|s| s.as_str() != Some("dedicated_thread")))
+ .unwrap_or(true)
+ );
}
#[test]
@@ -65,11 +67,13 @@ fn parameters_schema_advertises_optional_model_override() {
let props = schema.get("properties").expect("schema has properties");
let model = props.get("model").expect("model override advertised");
assert_eq!(model.get("type").and_then(|v| v.as_str()), Some("string"));
- assert!(schema
- .get("required")
- .and_then(|v| v.as_array())
- .map(|arr| arr.iter().all(|s| s.as_str() != Some("model")))
- .unwrap_or(true));
+ assert!(
+ schema
+ .get("required")
+ .and_then(|v| v.as_array())
+ .map(|arr| arr.iter().all(|s| s.as_str() != Some("model")))
+ .unwrap_or(true)
+ );
}
#[test]
@@ -232,9 +236,11 @@ async fn legacy_archetype_alias_is_accepted_for_lookup() {
.await
.unwrap();
assert!(result.is_error);
- assert!(result
- .output()
- .contains("unknown agent_id 'totally_made_up'"));
+ assert!(
+ result
+ .output()
+ .contains("unknown agent_id 'totally_made_up'")
+ );
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/subagent_abort_report.rs b/crates/openhuman-core/src/agent/orchestration/tools/subagent_abort_report.rs
index fab6ef3dcf..42aaf8bf5a 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/subagent_abort_report.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/subagent_abort_report.rs
@@ -24,8 +24,8 @@
//! only thing that settles the card. A closed channel has no reader left to
//! settle anything, so that case is logged and dropped.
-use tokio::sync::mpsc::error::TrySendError;
use tokio::sync::mpsc::Sender;
+use tokio::sync::mpsc::error::TrySendError;
use crate::progress::AgentProgress;
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.rs
index 8c286ce6d9..a916ca5036 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
@@ -7,7 +7,7 @@
//! envelopes only.
use async_trait::async_trait;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tinyagents_orchestration::subagent::SubagentResumeRef;
use tinytools::{PermissionLevel, Tool, ToolResult, ToolTimeout};
@@ -284,18 +284,31 @@ pub(crate) fn overlay_task_store_status(
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);
+ 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);
+ 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 {
- log::debug!("[subagent_reuse] overlaid task store status subagent_session_id={} task_id={} previous={:?} status={:?}", summary.subagent_session_id, task_id, previous, summary.status);
+ log::debug!(
+ "[subagent_reuse] overlaid task store status subagent_session_id={} task_id={} previous={:?} status={:?}",
+ summary.subagent_session_id,
+ task_id,
+ previous,
+ summary.status
+ );
}
}
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs b/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs
index 87479d06ee..cdcfb7ad8c 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs
@@ -1,7 +1,7 @@
//! Subagent dispatch logic shared by all agent delegation tools.
use crate::agent::subagent_host::{
- run_subagent_via_driver_tool, SubagentRunOptions, SubagentRunStatus,
+ SubagentRunOptions, SubagentRunStatus, run_subagent_via_driver_tool,
};
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use crate::progress::AgentProgress;