Skip to content

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

style: apply rustfmt formatting to subagent orchestration code

Steven Enamakel0893a9d750f1
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs
index b9e28473e8..e8c53231ed 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs
@@ -30,7 +30,8 @@ pub(crate) struct CancelledSubagent {
pub(crate) already_finished: Option<FinishedOutcome>,
/// The selected durable driver row when a paused child needs host-side
/// terminal projection (its driver callback already returned on pause).
- pub(crate) driver_pause: Option<crate::agent::orchestration::subagent_sessions::DriverTaskCancellation>,
+ pub(crate) driver_pause:
+ Option<crate::agent::orchestration::subagent_sessions::DriverTaskCancellation>,
/// TinyAgents' awaited completion handler owns terminal delivery for this
/// driver-backed child; the RPC handler must not publish a duplicate.
pub(crate) driver_managed: bool,
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs
index fbf6245ac7..6dc9e2c7a3 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs
@@ -8,8 +8,8 @@ pub use ops::{
action_root_key, cancel_driver_job_by_task, cancel_driver_job_for_observed_session,
cancel_driver_jobs_for_thread, close_if_current, find_reusable, list_for_parent,
mark_driver_pause_cancelled, mark_failed, mark_finished, normalize_task_key,
- resolve_lifecycle_key, reuse_decision, DriverTaskCancellation,
- task_title_from_prompt, upsert_running,
+ resolve_lifecycle_key, reuse_decision, task_title_from_prompt, upsert_running,
+ DriverTaskCancellation,
};
pub(crate) use tiny_port::OpenHumanTinySubagentSessionStore;
pub use types::{
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
index c942e0afde..f5a8180ccf 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
@@ -223,7 +223,9 @@ pub fn cancel_driver_job_by_task(
session.parent_thread_id.as_deref(),
checkpoint_dir,
)
- .map_err(|error| format!("failed to resolve subagent lifecycle for cancellation: {error}"))?,
+ .map_err(|error| {
+ format!("failed to resolve subagent lifecycle for cancellation: {error}")
+ })?,
)
} else {
session.lifecycle_key.clone()
@@ -277,9 +279,10 @@ pub fn mark_driver_pause_cancelled(
.lock()
.map_err(|_| "subagent session store lock poisoned".to_string())?;
let mut sessions = store.load()?;
- let Some(session) = sessions.iter_mut().find(|session| {
- session.subagent_session_id == observed.subagent_session_id
- }) else {
+ let Some(session) = sessions
+ .iter_mut()
+ .find(|session| session.subagent_session_id == observed.subagent_session_id)
+ else {
return Ok(false);
};
if session.parent_session != observed.parent_session
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs
index 59bae26e6e..f5062be89c 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs
@@ -347,7 +347,10 @@ fn paused_driver_cancel_marks_only_the_observed_session_failed() {
assert!(!mark_driver_pause_cancelled(&store, &selected).unwrap());
let cancelled = store.load().unwrap().remove(0);
assert_eq!(cancelled.status, DurableSubagentStatus::Failed);
- assert_eq!(cancelled.current_task_id.as_deref(), Some("paused-cancel-task"));
+ assert_eq!(
+ cancelled.current_task_id.as_deref(),
+ Some("paused-cancel-task")
+ );
assert_eq!(cancelled.latest_history.as_ref().unwrap().len(), 1);
let mut stale = selected;
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs
index bf1a46da96..c27f2b91c5 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs
@@ -1,11 +1,11 @@
-use tinyagents_orchestration::subagent::{
- PersistedSubagentPause, SubagentOutcome, SubagentOutcomeKind, SubagentPause,
- SubagentPausePersistenceDisposition, SubagentPersistence, SubagentResume, SubagentTaskKey,
-};
use std::{
collections::HashMap,
sync::{Arc, Mutex},
};
+use tinyagents_orchestration::subagent::{
+ PersistedSubagentPause, SubagentOutcome, SubagentOutcomeKind, SubagentPause,
+ SubagentPausePersistenceDisposition, SubagentPersistence, SubagentResume, SubagentTaskKey,
+};
use super::lifecycle::{
decode_driver_job_result, host_in_flight, load_subagent_checkpoint, merged_resume_history,
@@ -449,14 +449,10 @@ async fn driver_inline_projection_returns_the_durable_winner_not_a_local_loser()
let result = tinytools::ToolResult::error(
serde_json::json!({"task_id":"public-job-42", "status":"incomplete"}).to_string(),
);
- let (projected, public_job_id) = resolve_inline_driver_outcome(
- result,
- &bundle,
- &key,
- "fallback-agent",
- )
- .await
- .unwrap();
+ let (projected, public_job_id) =
+ resolve_inline_driver_outcome(result, &bundle, &key, "fallback-agent")
+ .await
+ .unwrap();
assert_eq!(public_job_id, "public-job-42");
assert_eq!(projected.output, "durable winning output");
@@ -467,8 +463,14 @@ async fn driver_inline_projection_returns_the_durable_winner_not_a_local_loser()
SubagentRunStatus::Incomplete { ref reason } if reason == "winner stopped"
));
assert_eq!(projected.final_history.len(), 1);
- assert_eq!(projected.final_history[0].content, "durable winning history");
- assert_eq!(projected.persistence_disposition, Disposition::TerminalExisting);
+ assert_eq!(
+ projected.final_history[0].content,
+ "durable winning history"
+ );
+ assert_eq!(
+ projected.persistence_disposition,
+ Disposition::TerminalExisting
+ );
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/agent_runs/subagent_control.rs b/crates/openhuman-core/src/agent_runs/subagent_control.rs
index 2aebbc7e88..246ff81296 100644
--- a/crates/openhuman-core/src/agent_runs/subagent_control.rs
+++ b/crates/openhuman-core/src/agent_runs/subagent_control.rs
@@ -161,15 +161,16 @@ fn handle_subagent_cancel(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
// Publishing the legacy pseudo-completion here would
// duplicate both effects.
if let Some(paused) = meta.driver_pause.as_ref() {
- let store =
- subagent_sessions::SubagentSessionStore::new(meta.workspace_dir.clone());
- let transitioned = subagent_sessions::mark_driver_pause_cancelled(
- &store,
- paused,
- )
- .map_err(|error| {
- format!("subagent_cancel: failed to settle paused child: {error}")
- })?;
+ let store = subagent_sessions::SubagentSessionStore::new(
+ meta.workspace_dir.clone(),
+ );
+ let transitioned =
+ subagent_sessions::mark_driver_pause_cancelled(&store, paused)
+ .map_err(|error| {
+ format!(
+ "subagent_cancel: failed to settle paused child: {error}"
+ )
+ })?;
if transitioned {
let summary = match reason
.as_deref()