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 across subagent session and tool registration code

Steven Enamakel422c3567ab52
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 18c69a8b45..b5cb2a7511 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs
@@ -1,19 +1,19 @@
mod ops;
mod store;
mod store_documents;
-mod types;
mod tiny_port;
+mod types;
pub use ops::{
action_root_key, close, find_reusable, list_for_parent, mark_failed, mark_finished,
normalize_task_key, resolve_lifecycle_key, reuse_decision, task_title_from_prompt,
upsert_running,
};
+pub(crate) use tiny_port::OpenHumanTinySubagentSessionStore;
pub use types::{
DurableSubagentSessionSummary, DurableSubagentStatus, SubagentSessionSelector,
SubagentSessionStore, SubagentSessionUpsert,
};
-pub(crate) use tiny_port::OpenHumanTinySubagentSessionStore;
// Test-only since the `harness-subagent-audit` debug binary (and the
// `orchestration::harness_audit` facade it needed) were removed: production
// callers reach the session records through `DurableSubagentSessionSummary`.
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs
index 5cb8249ba6..e99d6aa235 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs
@@ -38,8 +38,7 @@ impl OpenHumanTinySubagentSessionStore {
}
fn is_owned(&self, row: &DurableSubagentSession) -> bool {
- row.parent_session == self.parent_session
- && row.parent_thread_id == self.parent_thread_id
+ row.parent_session == self.parent_session && row.parent_thread_id == self.parent_thread_id
}
fn convert(&self, row: DurableSubagentSession) -> Result<TinySession, SubagentError> {
@@ -151,8 +150,7 @@ impl TinySessionStore for OpenHumanTinySubagentSessionStore {
let reuse = if upsert.force_fresh {
None
} else {
- super::find_reusable(&self.store, &selector)
- .map_err(SubagentError::Persistence)?
+ super::find_reusable(&self.store, &selector).map_err(SubagentError::Persistence)?
};
let decision = if upsert.force_fresh {
TinyReuseDecision::ForcedFresh
@@ -205,7 +203,10 @@ impl TinySessionStore for OpenHumanTinySubagentSessionStore {
TinyStatus::Idle => crate::agent::subagent_host::SubagentRunStatus::Completed,
TinyStatus::AwaitingUser => {
crate::agent::subagent_host::SubagentRunStatus::AwaitingUser {
- question: history.last().map(tinyinference_llm::message::Message::text).unwrap_or_default(),
+ question: history
+ .last()
+ .map(tinyinference_llm::message::Message::text)
+ .unwrap_or_default(),
options: None,
checkpoint: Some(self.checkpoint_dir.clone()),
}
@@ -231,8 +232,7 @@ impl TinySessionStore for OpenHumanTinySubagentSessionStore {
if self.get(id).await?.is_none() {
return Ok(false);
}
- super::mark_failed(&self.store, id, task_id, error)
- .map_err(SubagentError::Persistence)?;
+ super::mark_failed(&self.store, id, task_id, error).map_err(SubagentError::Persistence)?;
Ok(true)
}
}
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_tests.rs
index 227f35d008..dc96f07c00 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_tests.rs
@@ -44,7 +44,11 @@ async fn old_rows_without_checkpoint_identity_remain_readable_without_fabricated
.await
.unwrap()
.is_empty());
- assert!(port.list_for_parent("owner", Some("other-thread")).await.unwrap().is_empty());
+ assert!(port
+ .list_for_parent("owner", Some("other-thread"))
+ .await
+ .unwrap()
+ .is_empty());
assert!(port.get("legacy-session").await.unwrap().is_some());
let other_thread = OpenHumanTinySubagentSessionStore::new(
workspace.path().to_path_buf(),
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 21ce8fffc6..9619372f18 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs
@@ -194,11 +194,12 @@ async fn tiny_session_port_recovers_legacy_key_from_owned_pause_and_hides_foreig
.await
.unwrap();
- let port = crate::agent::orchestration::subagent_sessions::OpenHumanTinySubagentSessionStore::new(
- workspace.path().to_path_buf(),
- "owner-session",
- Some("thread".into()),
- );
+ let port =
+ crate::agent::orchestration::subagent_sessions::OpenHumanTinySubagentSessionStore::new(
+ workspace.path().to_path_buf(),
+ "owner-session",
+ Some("thread".into()),
+ );
let owned = port
.list_for_parent("owner-session", Some("thread"))
.await
diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
index 276dd8cc8a..0e89b6587f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
@@ -181,7 +181,8 @@ fn subagent_control_dispatches(
let Some(parent) = run_context.parent.as_ref() else {
return std::collections::HashMap::new();
};
- let registry = crate::core::runtime::slot_for::<SubAgentJobRegistry>(&run_context.dispatch_ctx());
+ let registry =
+ crate::core::runtime::slot_for::<SubAgentJobRegistry>(&run_context.dispatch_ctx());
let jobs = (*registry).clone();
let store: Arc<dyn tinyagents_orchestration::subagent::SubagentSessionStore> = Arc::new(
crate::agent::orchestration::subagent_sessions::OpenHumanTinySubagentSessionStore::new(
@@ -196,31 +197,31 @@ fn subagent_control_dispatches(
run_context.thread_id.as_deref().unwrap_or("no-thread")
);
let parent_session = parent.session_id.clone();
- let owner_scope: Arc<dyn Fn(u64) -> String + Send + Sync> =
- Arc::new(move |_| owner.clone());
+ let owner_scope: Arc<dyn Fn(u64) -> String + Send + Sync> = Arc::new(move |_| owner.clone());
let find_tool = |name: &str| -> Option<Arc<dyn tinytools::Tool>> {
shared_tool_adapter(tool_sets.to_vec(), name)
.map(|adapter| Arc::new(adapter) as Arc<dyn tinytools::Tool>)
};
- let make_jobs_alias = |name: &str, action: SubAgentJobAction| -> Option<RegisteredToolDispatch> {
- let adapter = find_tool(name)?;
- let parent_session = parent_session.clone();
- let dispatch = SubAgentJobsTool::new(jobs.clone())
- .with_tool_name(name)
- .with_description(adapter.description())
- .with_parameters(adapter.parameters_schema())
- .with_fixed_action(action)
- .with_metadata(
- adapter.permission_level(),
- adapter.scope(),
- adapter.category(),
- tinytools::ToolTimeout::Inherit,
- )
- .with_owner_scope(owner_scope.clone())
- .with_sessions(store.clone(), move |_| parent_session.clone());
- Some(Arc::new(dispatch))
- };
+ let make_jobs_alias =
+ |name: &str, action: SubAgentJobAction| -> Option<RegisteredToolDispatch> {
+ let adapter = find_tool(name)?;
+ let parent_session = parent_session.clone();
+ let dispatch = SubAgentJobsTool::new(jobs.clone())
+ .with_tool_name(name)
+ .with_description(adapter.description())
+ .with_parameters(adapter.parameters_schema())
+ .with_fixed_action(action)
+ .with_metadata(
+ adapter.permission_level(),
+ adapter.scope(),
+ adapter.category(),
+ tinytools::ToolTimeout::Inherit,
+ )
+ .with_owner_scope(owner_scope.clone())
+ .with_sessions(store.clone(), move |_| parent_session.clone());
+ Some(Arc::new(dispatch))
+ };
let mut dispatches = std::collections::HashMap::new();
if let Some(dispatch) = make_jobs_alias("list_subagents", SubAgentJobAction::Query) {
dispatches.insert("list_subagents".into(), dispatch);
diff --git a/tests/storage_desktop_upgrade_e2e.rs b/tests/storage_desktop_upgrade_e2e.rs
index de82318da0..45e883f821 100644
--- a/tests/storage_desktop_upgrade_e2e.rs
+++ b/tests/storage_desktop_upgrade_e2e.rs
@@ -430,7 +430,11 @@ async fn a_desktop_upgrade_is_lossless_and_leaves_the_legacy_files_untouched(cas
// TinyAgents' run ledger imports `sessions.db` (and appends to it) with
// checked batches, which a driver without `ValidatedBatch` refuses.
let local = case.backend().for_scope(&Scope::local()).unwrap();
- if !local.documents().capabilities().contains(Capability::ValidatedBatch) {
+ if !local
+ .documents()
+ .capabilities()
+ .contains(Capability::ValidatedBatch)
+ {
// Written to the stderr handle, not with `eprintln!`, which the test
// harness captures for a passing test: the skip must show in the log.
use std::io::Write;