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 control and lifecycle code

Steven Enamakel93d14bb15a62
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 f19988f666..3d25dc24e4 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
@@ -175,15 +175,9 @@ fn driver_task_cancel_reports_durable_finished_outcomes_and_refuses_ambiguous_id
Vec::new(),
)
.unwrap();
- let selected = cancel_driver_job_by_task(
- &store,
- dir.path(),
- &jobs,
- "finished-completed",
- None,
- )
- .unwrap()
- .expect("completed public task remains reportable");
+ let selected = cancel_driver_job_by_task(&store, dir.path(), &jobs, "finished-completed", None)
+ .unwrap()
+ .expect("completed public task remains reportable");
assert_eq!(selected.already_finished, Some(FinishedOutcome::Completed));
let failed = upsert_running(
@@ -206,15 +200,9 @@ fn driver_task_cancel_reports_durable_finished_outcomes_and_refuses_ambiguous_id
"provider failed".into(),
)
.unwrap();
- let selected = cancel_driver_job_by_task(
- &store,
- dir.path(),
- &jobs,
- "finished-failed",
- None,
- )
- .unwrap()
- .expect("failed public task remains reportable");
+ let selected = cancel_driver_job_by_task(&store, dir.path(), &jobs, "finished-failed", None)
+ .unwrap()
+ .expect("failed public task remains reportable");
assert_eq!(selected.already_finished, Some(FinishedOutcome::Failed));
let ambiguous = upsert_running(
@@ -254,9 +242,11 @@ fn driver_task_cancel_reports_durable_finished_outcomes_and_refuses_ambiguous_id
)
.unwrap();
assert_ne!(ambiguous.subagent_session_id, second.subagent_session_id);
- assert!(cancel_driver_job_by_task(&store, dir.path(), &jobs, "same-public-id", None)
- .unwrap()
- .is_none());
+ assert!(
+ cancel_driver_job_by_task(&store, dir.path(), &jobs, "same-public-id", None)
+ .unwrap()
+ .is_none()
+ );
assert!(store
.load()
.unwrap()
@@ -288,8 +278,11 @@ fn cancellation_reason_is_written_only_for_the_observed_full_lifecycle() {
None,
)
.unwrap();
- assert!(record_cancel_reason(&store, &session, "finish the current step" ).unwrap());
- assert_eq!(store.load().unwrap()[0].latest_error.as_deref(), Some("finish the current step"));
+ assert!(record_cancel_reason(&store, &session, "finish the current step").unwrap());
+ assert_eq!(
+ store.load().unwrap()[0].latest_error.as_deref(),
+ Some("finish the current step")
+ );
let mut stale = session;
stale.lifecycle_key = Some(SubagentTaskKey {
@@ -297,7 +290,10 @@ fn cancellation_reason_is_written_only_for_the_observed_full_lifecycle() {
..key
});
assert!(!record_cancel_reason(&store, &stale, "stale reason").unwrap());
- assert_eq!(store.load().unwrap()[0].latest_error.as_deref(), Some("finish the current step"));
+ assert_eq!(
+ store.load().unwrap()[0].latest_error.as_deref(),
+ Some("finish the current step")
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_completion.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_completion.rs
index 41dda79733..5d2134a46f 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_completion.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_completion.rs
@@ -210,8 +210,14 @@ pub(super) fn make_completion(
None
}
};
- let error = match reason.as_deref().map(str::trim).filter(|reason| !reason.is_empty()) {
- Some(reason) => format!("async sub-agent was cancelled. Reason: {reason}"),
+ let error = match reason
+ .as_deref()
+ .map(str::trim)
+ .filter(|reason| !reason.is_empty())
+ {
+ Some(reason) => {
+ format!("async sub-agent was cancelled. Reason: {reason}")
+ }
None => "async sub-agent was cancelled".to_string(),
};
if let Err(err) = subagent_sessions::mark_finished(
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
index b23e64c9a5..4ff1aa5c75 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
@@ -17,9 +17,9 @@ use tinyagents_harness::context::{RunConfig, RunContext};
use tinyagents_orchestration::subagent::{
ArtifactReference, PreparedSubagent, SubagentCapabilities, SubagentDriver, SubagentError,
SubagentExecution, SubagentExecutor, SubagentIncomplete, SubagentOutcome, SubagentOutcomeKind,
- SubagentPause, SubagentPausePersistenceDisposition, SubagentPlanner, SubagentRequest,
- SubagentPersistence, SubagentPersistenceDisposition, SubagentResume, SubagentRunResult,
- SubagentTaskKey, SubagentTerminalPersistenceDisposition,
+ SubagentPause, SubagentPausePersistenceDisposition, SubagentPersistence,
+ SubagentPersistenceDisposition, SubagentPlanner, SubagentRequest, SubagentResume,
+ SubagentRunResult, SubagentTaskKey, SubagentTerminalPersistenceDisposition,
};
use tinyagents_runtime::ToolSnapshot;
use tinyinference_llm::{
@@ -583,10 +583,11 @@ pub(super) async fn resolve_inline_driver_outcome(
{
Some((
outcome,
- cached.as_ref().map_or(
- SubagentPersistenceDisposition::TerminalExisting,
- |host| host.persistence_disposition,
- ),
+ cached
+ .as_ref()
+ .map_or(SubagentPersistenceDisposition::TerminalExisting, |host| {
+ host.persistence_disposition
+ }),
))
} else if let Some(outcome) = bundle
.persistence
@@ -596,19 +597,21 @@ pub(super) async fn resolve_inline_driver_outcome(
{
Some((
outcome,
- cached.as_ref().map_or(
- SubagentPersistenceDisposition::PauseExisting,
- |host| host.persistence_disposition,
- ),
+ cached
+ .as_ref()
+ .map_or(SubagentPersistenceDisposition::PauseExisting, |host| {
+ host.persistence_disposition
+ }),
))
} else {
None
};
if let Some((outcome, disposition)) = persisted {
- if declared_status.as_deref().is_some_and(|status| {
- neutral_status_for_outcome(&outcome.status) != Some(status)
- }) {
+ if declared_status
+ .as_deref()
+ .is_some_and(|status| neutral_status_for_outcome(&outcome.status) != Some(status))
+ {
return Err(SubagentRunError::Provider(anyhow::anyhow!(
"driver-backed async spawn failed: lifecycle status did not match its durable outcome"
)));
diff --git a/crates/openhuman-core/src/agent_runs/subagent_control.rs b/crates/openhuman-core/src/agent_runs/subagent_control.rs
index 672beeae38..22267cbcf7 100644
--- a/crates/openhuman-core/src/agent_runs/subagent_control.rs
+++ b/crates/openhuman-core/src/agent_runs/subagent_control.rs
@@ -127,7 +127,9 @@ fn handle_subagent_cancel(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
{
let config = crate::config::ops::load_config_in(&ctx)
.await
- .map_err(|error| format!("subagent_cancel: failed to resolve active workspace: {error}"))?;
+ .map_err(|error| {
+ format!("subagent_cancel: failed to resolve active workspace: {error}")
+ })?;
cancelled_subagent = running_subagents::cancel_by_task_with_workspace_reason(
&ctx,
&task_id,