Skip to content

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

style(subagent_host): apply rustfmt formatting

Steven Enamakel980607ad6121
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
index 5b8c7456e5..bf65e5616b 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
@@ -112,16 +112,9 @@ pub(crate) async fn run_async_spawn_via_driver_tool(
let mut options = options;
options.task_id = Some(task_id.clone());
let task_key = SubagentTaskKey::from_context(parent, task_id.clone(), None);
- let (tool_result, bundle) = invoke_async_spawn_driver_tool(
- parent,
- definition,
- input,
- options,
- "inline",
- None,
- None,
- )
- .await?;
+ let (tool_result, bundle) =
+ invoke_async_spawn_driver_tool(parent, definition, input, options, "inline", None, None)
+ .await?;
let public_job_id = decode_driver_job_result(tool_result, &bundle, &task_key)?;
if let Some(outcome) = bundle
.host_outcome
@@ -161,7 +154,8 @@ pub(crate) async fn spawn_async_via_driver_tool(
+ Sync
+ 'static,
) -> Result<String, SubagentRunError> {
- spawn_async_via_driver_tool_using_jobs(parent, definition, input, options, None, completion).await
+ spawn_async_via_driver_tool_using_jobs(parent, definition, input, options, None, completion)
+ .await
}
#[cfg(test)]
@@ -227,8 +221,11 @@ async fn spawn_async_via_driver_tool_using_jobs(
}
type HostCompletion = Arc<
- dyn Fn(String, Result<SubagentRunOutcome, String>, bool)
- -> Pin<Box<dyn Future<Output = ()> + Send>>
+ dyn Fn(
+ String,
+ Result<SubagentRunOutcome, String>,
+ bool,
+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>
+ Send
+ Sync,
>;
@@ -244,20 +241,25 @@ async fn invoke_async_spawn_driver_tool(
) -> Result<(tinytools::ToolResult, OpenHumanDriverBundle), SubagentRunError> {
use tinyagents_harness::tool::ToolDispatch;
use tinyagents_orchestration::subagent::{DriverSubAgentTool, SubAgentJobRegistry};
- use tinytools::{PermissionLevel, ToolCategory, ToolCallOptions, ToolScope, ToolTimeout};
+ use tinytools::{PermissionLevel, ToolCallOptions, ToolCategory, ToolScope, ToolTimeout};
let task_id = options
.task_id
.clone()
.unwrap_or_else(|| format!("sub-{}", uuid::Uuid::new_v4()));
- let checkpoint_dir = absolute_checkpoint_dir(options.checkpoint_dir.clone().unwrap_or_else(|| {
- parent
- .data
- .parent
- .as_ref()
- .map(|context| context.workspace_dir.join(".openhuman/subagent_checkpoints"))
- .unwrap_or_else(|| PathBuf::from(".openhuman/subagent_checkpoints"))
- }));
+ let checkpoint_dir =
+ absolute_checkpoint_dir(options.checkpoint_dir.clone().unwrap_or_else(|| {
+ parent
+ .data
+ .parent
+ .as_ref()
+ .map(|context| {
+ context
+ .workspace_dir
+ .join(".openhuman/subagent_checkpoints")
+ })
+ .unwrap_or_else(|| PathBuf::from(".openhuman/subagent_checkpoints"))
+ }));
let bundle = OpenHumanDriverBundle::new(checkpoint_dir)?;
let host_request = HostRequest {
definition: definition.clone(),
@@ -423,7 +425,6 @@ fn bundle_failure_for_key(
.remove(task_key)
}
-
/// Recover the original durable key and complete host pause payload from the
/// safe task-id index written at the pause persistence boundary.
pub(crate) fn load_subagent_checkpoint(
@@ -1505,7 +1506,7 @@ impl tinyagents_orchestration::subagent::SubagentPersistence for OpenHumanPersis
#[path = "lifecycle_outcome.rs"]
mod outcome;
-use outcome::{HostInFlightMap, host_outcome_to_neutral};
+use outcome::{host_outcome_to_neutral, HostInFlightMap};
fn outcome_to_host(
result: SubagentRunResult,
diff --git a/crates/openhuman-core/src/agent/subagent_host/mod.rs b/crates/openhuman-core/src/agent/subagent_host/mod.rs
index 621f13e8c6..44f52476e0 100644
--- a/crates/openhuman-core/src/agent/subagent_host/mod.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/mod.rs
@@ -59,6 +59,8 @@ pub use autonomous::{definition_iter_cap, subagent_iter_cap_with_autonomous_lift
pub(crate) use lifecycle::load_subagent_checkpoint;
#[cfg(test)]
pub(crate) use lifecycle::run_async_spawn_via_driver_tool;
+#[cfg(test)]
+pub(crate) use lifecycle::spawn_async_via_driver_tool_with_jobs;
pub(crate) use lifecycle::spawn_async_via_driver_tool;
pub use lifecycle::{
continue_subagent, continue_subagent_with_parent, run_subagent, run_subagent_with_parent,
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
index a8116815c0..f119451c91 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
@@ -131,13 +131,11 @@ async fn detached_driver_spawn_repairs_replayed_host_outcome_without_reexecution
)
.await
.expect("first detached driver spawn should register");
- let (first_result, first_effects) = tokio::time::timeout(
- std::time::Duration::from_secs(5),
- first_rx,
- )
- .await
- .expect("first completion callback should not be skipped")
- .expect("first completion callback");
+ let (first_result, first_effects) =
+ tokio::time::timeout(std::time::Duration::from_secs(5), first_rx)
+ .await
+ .expect("first completion callback should not be skipped")
+ .expect("first completion callback");
let first_result = first_result.expect("first host outcome");
assert!(first_effects);
assert_eq!(first_result.output, "durable driver result");
@@ -166,13 +164,11 @@ async fn detached_driver_spawn_repairs_replayed_host_outcome_without_reexecution
)
.await
.expect("replayed detached driver spawn should register");
- let (replay_result, replay_effects) = tokio::time::timeout(
- std::time::Duration::from_secs(5),
- replay_rx,
- )
- .await
- .expect("replay repair callback should run")
- .expect("replay repair callback");
+ let (replay_result, replay_effects) =
+ tokio::time::timeout(std::time::Duration::from_secs(5), replay_rx)
+ .await
+ .expect("replay repair callback should run")
+ .expect("replay repair callback");
let replay_result = replay_result.expect("durable replay must retain host result");
assert!(!replay_effects, "terminal replay must not repeat effects");
assert_eq!(replay_result.output, "durable driver result");