Skip to content

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

refactor(orchestration): reorder imports and collapse assert formatting

Steven Enamakelf64be5733b32
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rs
index c94cc2e7b2..733df0fbd5 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs
@@ -49,7 +49,7 @@ use std::sync::{Arc, Mutex, OnceLock};
use std::time::Duration;
use tinyagents_orchestration::subagent::{
- DetachedCompletionTarget, DetachedSubagentStatus, record_detached_completion,
+ record_detached_completion, DetachedCompletionTarget, DetachedSubagentStatus,
};
use tinyagents_tasks::{
CompletionRecord, CompletionResult, CompletionRouter, CompletionState, CompletionStore,
@@ -57,15 +57,15 @@ use tinyagents_tasks::{
};
use super::completion_notice::BackgroundCompletionFormatter;
-pub(crate) use super::completion_notice::{AWAITING_INPUT_LABEL, BackgroundAgentOutcome};
-pub(crate) use super::completion_target::CompletionTarget;
+pub(crate) use super::completion_notice::{BackgroundAgentOutcome, AWAITING_INPUT_LABEL};
use super::completion_target::awaiting_input_record_id;
#[cfg(test)]
pub(crate) use super::completion_target::claim_recovery;
#[cfg(test)]
pub(crate) use super::completion_target::tests::{
- TestWorkspace, forget_workspace_for_test, install_store_for_test,
+ forget_workspace_for_test, install_store_for_test, TestWorkspace,
};
+pub(crate) use super::completion_target::CompletionTarget;
pub(crate) use super::completion_target::{claim_recovery_ctx, forget_recovery_ctx};
/// How long a settled record (delivered / gave up / tombstoned) is kept before
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs b/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs
index 584351648c..546d96b73d 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs
@@ -2,8 +2,8 @@
use super::*;
use tinyagents_tasks::{
- CompletionRouterPool, CompletionStoreFallback, CompletionStoreReplaceOutcome,
- DEFAULT_MAX_ATTEMPTS, InMemoryCompletionStore, open_driver_completion_store_or_memory,
+ open_driver_completion_store_or_memory, CompletionRouterPool, CompletionStoreFallback,
+ CompletionStoreReplaceOutcome, InMemoryCompletionStore, DEFAULT_MAX_ATTEMPTS,
};
pub(in crate::agent::orchestration) fn router_scope_for(
@@ -96,8 +96,8 @@ pub(in crate::agent::orchestration) fn router_pool() -> &'static CompletionRoute
}
#[cfg(test)]
-pub(in crate::agent::orchestration) fn test_store_overrides()
--> &'static Mutex<HashMap<RouterScope, Arc<dyn CompletionStore>>> {
+pub(in crate::agent::orchestration) fn test_store_overrides(
+) -> &'static Mutex<HashMap<RouterScope, Arc<dyn CompletionStore>>> {
static STORES: OnceLock<Mutex<HashMap<RouterScope, Arc<dyn CompletionStore>>>> =
OnceLock::new();
STORES.get_or_init(|| Mutex::new(HashMap::new()))
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions/thread_index.rs b/crates/openhuman-core/src/agent/orchestration/background_completions/thread_index.rs
index fd75e1246e..c024cf712a 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions/thread_index.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions/thread_index.rs
@@ -7,7 +7,7 @@ use std::sync::Arc;
use tinyagents_tasks::CompletionRouter;
-use super::{SESSION_THREADS_CAP, state};
+use super::{state, SESSION_THREADS_CAP};
use crate::core::runtime::DispatchCtx;
/// The key of a thread or session id in `HostState`'s maps: per profile of
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions_pause_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_completions_pause_tests.rs
index 0d1f00d4f5..7ba9fccf1a 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions_pause_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_pause_tests.rs
@@ -158,12 +158,10 @@ fn delivered_pause_leaves_the_task_key_free_for_a_later_delivery() {
.receipt()
.expect("claimed completion has a settlement receipt");
assert_eq!(router.mark_delivered(&[completion_receipt]).unwrap(), 1);
- assert!(
- router
- .claim_pending("thread-sequential", usize::MAX)
- .unwrap()
- .is_empty()
- );
+ assert!(router
+ .claim_pending("thread-sequential", usize::MAX)
+ .unwrap()
+ .is_empty());
}
#[test]
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
index dff4dd7291..4bcf4a0420 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
@@ -68,12 +68,10 @@ fn record_is_thread_scoped_and_batches_in_completion_order() {
let claimed = router.claim_pending("thread-A", usize::MAX).unwrap();
assert_eq!(claimed.len(), 2, "everything ready is claimed as one batch");
assert_eq!(claimed[0].result.text, "eiffel");
- assert!(
- router
- .claim_pending("thread-A", usize::MAX)
- .unwrap()
- .is_empty()
- );
+ assert!(router
+ .claim_pending("thread-A", usize::MAX)
+ .unwrap()
+ .is_empty());
}
#[test]
@@ -93,12 +91,10 @@ fn headless_completion_is_dropped() {
let _guard = test_guard();
let ws = workspace();
record(ws.path(), "sess-headless", "sub-1", "x", None);
- assert!(
- router_for_workspace(ws.path())
- .claim_pending("", usize::MAX)
- .unwrap()
- .is_empty()
- );
+ assert!(router_for_workspace(ws.path())
+ .claim_pending("", usize::MAX)
+ .unwrap()
+ .is_empty());
assert!(recover_pending_threads(&cx(), ws.path()).is_empty());
}
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
index 63d80d4152..34e4dc7af5 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
@@ -138,8 +138,8 @@ fn schedule_delivery_inner(
.push((thread_id.clone(), delay));
#[cfg(not(test))]
let _ = delay; // The owner applies debounce/recovery timing inside its delivery API.
- // Scoped: the thread -> workspace table is keyed per profile, so the
- // delayed task must run under the profile that scheduled it.
+ // Scoped: the thread -> workspace table is keyed per profile, so the
+ // delayed task must run under the profile that scheduled it.
ctx.clone().spawn(async move {
let outcome = try_deliver(ctx.clone(), thread_id.clone(), fence.clone(), wait_idle).await;
if outcome == DeliveryOutcome::ParentBusy {
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents.rs
index 6708dc6d51..f07303591f 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents.rs
@@ -7,8 +7,8 @@ mod roster;
mod task_ledger;
pub(crate) use cancel::{
- CancelledSubagent, cancel_all, cancel_by_session_in_workspace,
- cancel_by_task_with_workspace_reason, cancel_for_thread, stop_for_thread,
+ cancel_all, cancel_by_session_in_workspace, cancel_by_task_with_workspace_reason,
+ cancel_for_thread, stop_for_thread, CancelledSubagent,
};
pub(crate) use registry::admit_spawn;
pub(crate) use roster::active_subagents_context_block;
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs
index cbbe54d187..03cbd66f9a 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs
@@ -11,11 +11,11 @@ use std::path::{Path, PathBuf};
use std::sync::{Arc, OnceLock};
use tinyagents_orchestration::subagent::{
- WaitError, orphaned_subagent_reason, record_agent_id, record_parent_session, task_status_label,
+ orphaned_subagent_reason, record_agent_id, record_parent_session, task_status_label, WaitError,
};
use tinyagents_tasks::{
- InMemoryTaskStore, OrchestrationTaskFilter, TaskStore, TaskStoreRegistry,
- open_driver_task_store_or_memory, reconcile_orphaned_tasks,
+ open_driver_task_store_or_memory, reconcile_orphaned_tasks, InMemoryTaskStore,
+ OrchestrationTaskFilter, TaskStore, TaskStoreRegistry,
};
/// One cached ledger: a workspace and the storage scope it was opened for.
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 20c0d7d221..2d7dc9c2ac 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs
@@ -8,10 +8,10 @@ mod tiny_port_epoch;
mod types;
pub use ops::{
- DriverTaskCancellation, 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_failed, mark_finished, normalize_task_key,
- resolve_driver_lifecycle_key, resolve_lifecycle_key, reuse_decision, upsert_running,
+ 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_failed,
+ mark_finished, normalize_task_key, resolve_driver_lifecycle_key, resolve_lifecycle_key,
+ reuse_decision, upsert_running, DriverTaskCancellation,
};
#[cfg(test)]
pub(crate) use tiny_port::OpenHumanTinySubagentSessionStore;
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 dac9d51f5a..4960043102 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
@@ -14,9 +14,9 @@ mod driver;
#[cfg(test)]
use driver::record_cancel_reason;
pub use driver::{
- DriverTaskCancellation, cancel_driver_job_by_task, cancel_driver_job_for_observed_session,
+ cancel_driver_job_by_task, cancel_driver_job_for_observed_session,
cancel_driver_jobs_for_thread, mark_driver_pause_cancelled, resolve_driver_lifecycle_key,
- resolve_lifecycle_key,
+ resolve_lifecycle_key, DriverTaskCancellation,
};
pub use tinyagents_orchestration::subagent::normalize_task_key;
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_followup_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_followup_tests.rs
index bf759d26b1..e724a1e46c 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_followup_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_followup_tests.rs
@@ -38,14 +38,12 @@ fn list_for_parent_without_thread_id_does_not_filter_by_thread() {
let all = list_for_parent(&store, "parent-a", None).unwrap();
assert_eq!(all.len(), 2);
- assert!(
- all.iter()
- .any(|session| session.subagent_session_id == first.subagent_session_id)
- );
- assert!(
- all.iter()
- .any(|session| session.subagent_session_id == second.subagent_session_id)
- );
+ assert!(all
+ .iter()
+ .any(|session| session.subagent_session_id == first.subagent_session_id));
+ assert!(all
+ .iter()
+ .any(|session| session.subagent_session_id == second.subagent_session_id));
let thread_a = list_for_parent(&store, "parent-a", Some("thread-a")).unwrap();
assert_eq!(thread_a.len(), 1);
@@ -56,16 +54,14 @@ fn list_for_parent_without_thread_id_does_not_filter_by_thread() {
fn missing_session_updates_return_errors() {
let dir = tempfile::tempdir().unwrap();
let store = SubagentSessionStore::new(dir.path().to_path_buf());
- assert!(
- mark_finished(
- &store,
- "missing",
- "sub-1",
- &SubagentRunStatus::Completed,
- vec![]
- )
- .is_err()
- );
+ assert!(mark_finished(
+ &store,
+ "missing",
+ "sub-1",
+ &SubagentRunStatus::Completed,
+ vec![]
+ )
+ .is_err());
assert!(mark_failed(&store, "missing", "sub-1", "boom".into()).is_err());
assert!(!close(&store, "missing").unwrap());
}
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 11b0bd631c..8910511776 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
@@ -111,51 +111,43 @@ fn stale_completion_cannot_overwrite_reused_or_closed_session() {
.unwrap();
assert_eq!(first.subagent_session_id, second.subagent_session_id);
- assert!(
- mark_finished(
- &store,
- &second.subagent_session_id,
- "first-task",
- &SubagentRunStatus::Completed,
- vec![TranscriptMessage::user("stale")],
- )
- .is_err()
- );
+ assert!(mark_finished(
+ &store,
+ &second.subagent_session_id,
+ "first-task",
+ &SubagentRunStatus::Completed,
+ vec![TranscriptMessage::user("stale")],
+ )
+ .is_err());
let current = store.load().unwrap().remove(0);
assert_eq!(current.current_task_id.as_deref(), Some("second-task"));
assert_eq!(current.status, DurableSubagentStatus::Running);
assert!(current.latest_history.is_none());
- assert!(
- mark_failed(
- &store,
- &second.subagent_session_id,
- "first-task",
- "stale failure".into(),
- )
- .is_err()
- );
+ assert!(mark_failed(
+ &store,
+ &second.subagent_session_id,
+ "first-task",
+ "stale failure".into(),
+ )
+ .is_err());
assert!(store.load().unwrap()[0].latest_error.is_none());
close(&store, &second.subagent_session_id).unwrap();
- assert!(
- mark_finished(
- &store,
- &second.subagent_session_id,
- "second-task",
- &SubagentRunStatus::Completed,
- vec![TranscriptMessage::user("late after close")],
- )
- .is_err()
- );
- assert!(
- mark_failed(
- &store,
- &second.subagent_session_id,
- "second-task",
- "late failure".into(),
- )
- .is_err()
- );
+ assert!(mark_finished(
+ &store,
+ &second.subagent_session_id,
+ "second-task",
+ &SubagentRunStatus::Completed,
+ vec![TranscriptMessage::user("late after close")],
+ )
+ .is_err());
+ assert!(mark_failed(
+ &store,
+ &second.subagent_session_id,
+ "second-task",
+ "late failure".into(),
+ )
+ .is_err());
let closed = store.load().unwrap().remove(0);
assert_eq!(closed.status, DurableSubagentStatus::Closed);
assert!(closed.latest_history.is_none());
@@ -315,14 +307,12 @@ fn driver_task_cancel_reports_legacy_failure_and_refuses_ambiguous_ids() {
.unwrap()
.is_none()
);
- assert!(
- store
- .load()
- .unwrap()
- .iter()
- .filter(|row| row.current_task_id.as_deref() == Some("same-public-id"))
- .all(|row| row.status == DurableSubagentStatus::Running)
- );
+ assert!(store
+ .load()
+ .unwrap()
+ .iter()
+ .filter(|row| row.current_task_id.as_deref() == Some("same-public-id"))
+ .all(|row| row.status == DurableSubagentStatus::Running));
}
#[test]
@@ -599,16 +589,14 @@ fn upsert_persists_the_full_lifecycle_key_without_collapsing_to_task_id() {
)
.unwrap();
assert_eq!(resolved, key);
- assert!(
- resolve_lifecycle_key(
- &store,
- &session.subagent_session_id,
- "another-parent",
- Some("thread-a"),
- dir.path(),
- )
- .is_err()
- );
+ assert!(resolve_lifecycle_key(
+ &store,
+ &session.subagent_session_id,
+ "another-parent",
+ Some("thread-a"),
+ dir.path(),
+ )
+ .is_err());
}
#[test]
@@ -642,7 +630,7 @@ fn closed_session_is_not_reusable() {
#[test]
fn an_equal_millisecond_live_close_persists_and_a_stale_snapshot_cannot_reopen_it() {
- use crate::agent::orchestration::subagent_sessions::store_documents::{Docs, with_override};
+ use crate::agent::orchestration::subagent_sessions::store_documents::{with_override, Docs};
use crate::storage::{MemoryStorage, Scope, StorageBackend};
let storage = MemoryStorage::new();
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
index a16d32de88..9b32ef2914 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
@@ -29,12 +29,12 @@ use serde_json::Value;
use tinyagents_session::transcript::TranscriptMessage;
use tinystoragedrivers::{CollectionSpec, Filter, Query, Sort};
-use super::storage_schema::{SESSIONS, spec};
+use super::storage_schema::{spec, SESSIONS};
use super::types::{DurableSubagentSession, DurableSubagentStatus};
-use crate::storage::DocumentStoreExt;
use crate::storage::documents::Repo;
use crate::storage::import_state;
use crate::storage::schema_support::{key_of, ms_rfc3339, rfc3339_ms};
+use crate::storage::DocumentStoreExt;
/// The `tsd.migrations` owner of the legacy-file import.
const OWNER: &str = "subagents";
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
index 3f8c6d1605..d928003878 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
@@ -35,12 +35,10 @@ fn session(id: &str) -> DurableSubagentSession {
#[test]
fn a_missing_list_loads_empty() {
- assert!(
- docs_in(&MemoryStorage::new(), "local")
- .load()
- .unwrap()
- .is_empty()
- );
+ assert!(docs_in(&MemoryStorage::new(), "local")
+ .load()
+ .unwrap()
+ .is_empty());
}
#[test]
@@ -84,11 +82,10 @@ fn the_store_uses_the_workspace_default_with_no_backend_installed() {
store.save(&[session("a")]).unwrap();
assert_eq!(store.load().unwrap().len(), 1);
// No JSON file store: the records are in the workspace's own database.
- assert!(
- !dir.path()
- .join(".openhuman/subagent_sessions.json")
- .exists()
- );
+ assert!(!dir
+ .path()
+ .join(".openhuman/subagent_sessions.json")
+ .exists());
assert!(dir.path().join("storage").exists());
}
@@ -121,11 +118,10 @@ fn the_store_dispatches_to_documents_when_a_backend_is_pinned() {
assert_eq!(store.load().unwrap().len(), 1);
});
assert_eq!(docs.load().unwrap().len(), 1);
- assert!(
- !dir.path()
- .join(".openhuman/subagent_sessions.json")
- .exists()
- );
+ assert!(!dir
+ .path()
+ .join(".openhuman/subagent_sessions.json")
+ .exists());
}
#[test]
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 6bf1790946..19c699e91d 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
@@ -59,11 +59,9 @@ async fn driver_store_imports_legacy_rows_without_losing_host_epoch() {
assert_eq!(imported.subagent_session_id, "legacy-session");
assert_eq!(imported.current_task_id.as_deref(), Some("legacy-task"));
assert_eq!(imported.status, TinyStatus::Idle);
- assert!(
- serde_json::to_string(&imported.latest_history)
- .unwrap()
- .contains("legacy history")
- );
+ assert!(serde_json::to_string(&imported.latest_history)
+ .unwrap()
+ .contains("legacy history"));
let retained = legacy.load().unwrap();
assert_eq!(retained[0].parent_epoch, Some(7));
@@ -208,18 +206,16 @@ async fn old_rows_without_checkpoint_identity_remain_readable_without_fabricated
assert_eq!(sessions[0].subagent_session_id, "legacy-session");
assert_eq!(sessions[0].current_task_id.as_deref(), Some("legacy-task"));
assert!(sessions[0].lifecycle_key.is_none());
- assert!(
- port.list_for_parent("foreign-owner", Some("thread"))
- .await
- .unwrap()
- .is_empty()
- );
- assert!(
- port.list_for_parent("owner", Some("other-thread"))
- .await
- .unwrap()
- .is_empty()
- );
+ assert!(port
+ .list_for_parent("foreign-owner", Some("thread"))
+ .await
+ .unwrap()
+ .is_empty());
+ assert!(port
+ .list_for_parent("owner", Some("other-thread"))
+ .await
+ .unwrap()
+ .is_empty());
assert_eq!(port.list_for_parent("owner", None).await.unwrap().len(), 1);
assert!(port.get("legacy-session").await.unwrap().is_some());
let other_thread = OpenHumanTinySubagentSessionStore::new(
@@ -266,12 +262,11 @@ async fn unthreaded_port_lists_only_unthreaded_rows() {
let sessions = port.list_for_parent("owner", None).await.unwrap();
assert_eq!(sessions.len(), 1);
assert_eq!(sessions[0].subagent_session_id, "unthreaded-session");
- assert!(
- port.list_for_parent("owner", Some("thread-a"))
- .await
- .unwrap()
- .is_empty()
- );
+ assert!(port
+ .list_for_parent("owner", Some("thread-a"))
+ .await
+ .unwrap()
+ .is_empty());
}
#[tokio::test]
@@ -376,41 +371,37 @@ async fn upsert_rejects_a_selector_or_lifecycle_key_outside_bound_scope() {
}
};
- assert!(
- port.upsert_running(upsert(
+ assert!(port
+ .upsert_running(upsert(
"foreign",
Some("thread-a"),
key(Some("thread-a"), "task-1")
))
.await
- .is_err()
- );
- assert!(
- port.upsert_running(upsert(
+ .is_err());
+ assert!(port
+ .upsert_running(upsert(
"owner",
Some("thread-b"),
key(Some("thread-b"), "task-1")
))
.await
- .is_err()
- );
- assert!(
- port.upsert_running(upsert(
+ .is_err());
+ assert!(port
+ .upsert_running(upsert(
"owner",
Some("thread-a"),
key(Some("thread-b"), "task-1")
))
.await
- .is_err()
- );
- assert!(
- port.upsert_running(upsert(
+ .is_err());
+ assert!(port
+ .upsert_running(upsert(
"owner",
Some("thread-a"),
key(Some("thread-a"), "other-task")
))
.await
- .is_err()
- );
+ .is_err());
assert!(store.load().unwrap().is_empty());
}
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs
index 3503bbc45b..2b9e55d274 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs
@@ -452,10 +452,8 @@ 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_subagent_completion.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_completion.rs
index 50a35ccc5f..4cceb6e746 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_completion.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_completion.rs
@@ -106,9 +106,9 @@ pub(super) fn make_completion(
Result<SubagentRunOutcome, String>,
bool,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = ()> + Send>>
-+ Send
-+ Sync
-+ 'static {
+ + Send
+ + Sync
+ + 'static {
move |_target: String,
result: Result<SubagentRunOutcome, String>,
emit_lifecycle_effects: bool|
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 ad80030ff6..b6d95d880d 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
@@ -10,11 +10,9 @@ fn parameters_schema_hides_legacy_mode_flags_and_keeps_required_agent_id() {
"legacy `{legacy}` is not advertised"
);
}
- assert!(
- schema["required"].as_array().is_some_and(|required| {
- required.iter().any(|key| key.as_str() == Some("agent_id"))
- })
- );
+ assert!(schema["required"]
+ .as_array()
+ .is_some_and(|required| { required.iter().any(|key| key.as_str() == Some("agent_id")) }));
}
#[test]
@@ -24,13 +22,11 @@ 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));
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rs
index 2d79886481..7a2b8d747b 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rs
@@ -232,11 +232,10 @@ async fn cancelling_a_paused_driver_settles_once_with_its_reason() {
.find(|row| row.current_task_id.as_deref() == Some(task_id.as_str()))
.expect("cancelled durable session remains available");
assert_eq!(row.status, DurableSubagentStatus::Failed);
- assert!(
- row.latest_error
- .as_deref()
- .is_some_and(|error| error.contains("user requested stop"))
- );
+ assert!(row
+ .latest_error
+ .as_deref()
+ .is_some_and(|error| error.contains("user requested stop")));
let deliveries = pending_for_ctx(
&live.data.dispatch_ctx(),
workspace.path(),
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
index 51425c9a8a..7a8645360b 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
@@ -26,8 +26,8 @@ mod checkpoint;
#[path = "lifecycle_outcome.rs"]
mod outcome;
use checkpoint::absolute_checkpoint_dir;
-use driver_adapter::HostInvocation;
pub(super) use driver_adapter::outcome_to_host;
+use driver_adapter::HostInvocation;
#[path = "lifecycle/driver_result.rs"]
mod driver_result;
@@ -103,13 +103,13 @@ pub(crate) async fn spawn_async_via_driver_tool(
input: String,
options: SubagentRunOptions,
completion: impl Fn(
- String,
- Result<SubagentRunOutcome, String>,
- bool,
- ) -> Pin<Box<dyn Future<Output = ()> + Send>>
- + Send
- + Sync
- + 'static,
+ String,
+ Result<SubagentRunOutcome, String>,
+ bool,
+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>
+ + Send
+ + Sync
+ + 'static,
) -> Result<String, SubagentRunError> {
spawn_async_via_driver_tool_using_jobs(
parent, definition, input, options, None, None, completion,
@@ -127,13 +127,13 @@ pub(crate) async fn resume_async_via_driver_tool(
input: String,
options: SubagentRunOptions,
completion: impl Fn(
- String,
- Result<SubagentRunOutcome, String>,
- bool,
- ) -> Pin<Box<dyn Future<Output = ()> + Send>>
- + Send
- + Sync
- + 'static,
+ String,
+ Result<SubagentRunOutcome, String>,
+ bool,
+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>
+ + Send
+ + Sync
+ + 'static,
) -> Result<String, SubagentRunError> {
spawn_async_via_driver_tool_using_jobs(
parent,
@@ -155,13 +155,13 @@ pub(crate) async fn spawn_async_via_driver_tool_with_jobs(
options: SubagentRunOptions,
jobs: tinyagents_harness_tools::subagents::SubAgentJobRegistry,
completion: impl Fn(
- String,
- Result<SubagentRunOutcome, String>,
- bool,
- ) -> Pin<Box<dyn Future<Output = ()> + Send>>
- + Send
- + Sync
- + 'static,
+ String,
+ Result<SubagentRunOutcome, String>,
+ bool,
+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>
+ + Send
+ + Sync
+ + 'static,
) -> Result<String, SubagentRunError> {
spawn_async_via_driver_tool_using_jobs(
parent,
@@ -183,13 +183,13 @@ async fn spawn_async_via_driver_tool_using_jobs(
jobs: Option<tinyagents_harness_tools::subagents::SubAgentJobRegistry>,
continuation: Option<(SubagentTaskKey, SubagentResume)>,
completion: impl Fn(
- String,
- Result<SubagentRunOutcome, String>,
- bool,
- ) -> Pin<Box<dyn Future<Output = ()> + Send>>
- + Send
- + Sync
- + 'static,
+ String,
+ Result<SubagentRunOutcome, String>,
+ bool,
+ ) -> Pin<Box<dyn Future<Output = ()> + Send>>
+ + Send
+ + Sync
+ + 'static,
) -> Result<String, SubagentRunError> {
let task_id = continuation
.as_ref()
diff --git a/crates/openhuman-core/src/agent_runs/subagent_control.rs b/crates/openhuman-core/src/agent_runs/subagent_control.rs
index a710a12ac5..2e8265223d 100644
--- a/crates/openhuman-core/src/agent_runs/subagent_control.rs
+++ b/crates/openhuman-core/src/agent_runs/subagent_control.rs
@@ -15,12 +15,12 @@
//! cancelled.
use crate::core::runtime::DispatchCtx;
-use serde_json::{Map, Value, json};
+use serde_json::{json, Map, Value};
use crate::agent::orchestration::running_subagents::CancelledSubagent;
use crate::agent::orchestration::{background_completions, running_subagents, subagent_sessions};
-use crate::core::Outcome;
use crate::core::all::{ControllerFuture, RegisteredController};
+use crate::core::Outcome;
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
/// Controller schemas exposed for detached sub-agent control.
diff --git a/crates/openhuman-core/src/agent_runs/subagent_control_tests.rs b/crates/openhuman-core/src/agent_runs/subagent_control_tests.rs
index 8ae83c888c..acacce8897 100644
--- a/crates/openhuman-core/src/agent_runs/subagent_control_tests.rs
+++ b/crates/openhuman-core/src/agent_runs/subagent_control_tests.rs
@@ -76,7 +76,7 @@ fn field(out: &Value, name: &str) -> Option<Value> {
/// durable session alone, instead of rewriting it as "cancelled by user".
#[tokio::test]
async fn cancel_of_a_legacy_failed_run_reports_its_outcome_and_rewrites_nothing() {
- use crate::agent::orchestration::subagent_sessions::{SubagentSessionStore, mark_failed};
+ use crate::agent::orchestration::subagent_sessions::{mark_failed, SubagentSessionStore};
use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};
use std::sync::Arc;
@@ -157,8 +157,8 @@ async fn cancelling_a_paused_driver_queues_a_failed_delivery_with_reason() {
forget_workspace_for_test, pending_for,
};
use crate::agent::orchestration::subagent_sessions::{
- DriverTaskCancellation, SubagentSessionSelector, SubagentSessionStore,
- SubagentSessionUpsert, mark_finished, upsert_running,
+ mark_finished, upsert_running, DriverTaskCancellation, SubagentSessionSelector,
+ SubagentSessionStore, SubagentSessionUpsert,
};
use std::sync::Arc;
use tinyagents_orchestration::subagent::SubagentTaskKey;
@@ -232,16 +232,14 @@ async fn cancelling_a_paused_driver_queues_a_failed_delivery_with_reason() {
config,
);
let ctx = DispatchCtx::new(Arc::clone(&core));
- assert!(
- settle_paused_driver_cancel(
- &ctx,
- &observed,
- observed.parent_epoch,
- Some("user requested stop")
- )
- .await
- .expect("paused cancellation settles")
- );
+ assert!(settle_paused_driver_cancel(
+ &ctx,
+ &observed,
+ observed.parent_epoch,
+ Some("user requested stop")
+ )
+ .await
+ .expect("paused cancellation settles"));
let driver = crate::agent::orchestration::subagent_sessions::open_for_context(
&ctx,