Skip to content

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

style: apply rustfmt import ordering and line wrapping

Steven Enamakelcde4061e6b91
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rs
index eac889f2b1..c94cc2e7b2 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs
@@ -38,7 +38,7 @@ pub(super) use store_adapter::{
pub(super) use store_adapter::{
entry_for, router_for_workspace, router_scope, test_store_overrides,
};
-use thread_index::{key, note_thread_workspace};
+use thread_index::key;
pub(crate) use thread_index::{
note_session_thread, note_thread_workspace, router_for_thread, thread_for_session,
workspace_for_thread,
@@ -49,7 +49,7 @@ use std::sync::{Arc, Mutex, OnceLock};
use std::time::Duration;
use tinyagents_orchestration::subagent::{
- record_detached_completion, DetachedCompletionTarget, DetachedSubagentStatus,
+ DetachedCompletionTarget, DetachedSubagentStatus, record_detached_completion,
};
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::{BackgroundAgentOutcome, AWAITING_INPUT_LABEL};
+pub(crate) use super::completion_notice::{AWAITING_INPUT_LABEL, BackgroundAgentOutcome};
+pub(crate) use super::completion_target::CompletionTarget;
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::{
- forget_workspace_for_test, install_store_for_test, TestWorkspace,
+ TestWorkspace, forget_workspace_for_test, install_store_for_test,
};
-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/parent_lifecycle.rs b/crates/openhuman-core/src/agent/orchestration/background_completions/parent_lifecycle.rs
index 0e560395ac..a09200843e 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions/parent_lifecycle.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions/parent_lifecycle.rs
@@ -183,7 +183,9 @@ pub(crate) fn mark_stopped_task_if_thread_stopped(
);
}
if let Err(tombstone_error) = entry.router.tombstone(task_id) {
- log::warn!("[background_completions] tombstone failed task_id={task_id} error={tombstone_error}");
+ log::warn!(
+ "[background_completions] tombstone failed task_id={task_id} error={tombstone_error}"
+ );
}
let mut st = state();
if st
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 546d96b73d..584351648c 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::{
- open_driver_completion_store_or_memory, CompletionRouterPool, CompletionStoreFallback,
- CompletionStoreReplaceOutcome, InMemoryCompletionStore, DEFAULT_MAX_ATTEMPTS,
+ CompletionRouterPool, CompletionStoreFallback, CompletionStoreReplaceOutcome,
+ DEFAULT_MAX_ATTEMPTS, InMemoryCompletionStore, open_driver_completion_store_or_memory,
};
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 da052404f5..fd75e1246e 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::{state, SESSION_THREADS_CAP};
+use super::{SESSION_THREADS_CAP, state};
use crate::core::runtime::DispatchCtx;
/// The key of a thread or session id in `HostState`'s maps: per profile of
@@ -21,7 +21,7 @@ pub(super) fn key(ctx: &DispatchCtx, id: &str) -> String {
}
/// Remember which workspace holds `thread_id`'s completions.
-pub(super) fn note_thread_workspace(ctx: &DispatchCtx, thread_id: &str, workspace_dir: &Path) {
+pub(crate) fn note_thread_workspace(ctx: &DispatchCtx, thread_id: &str, workspace_dir: &Path) {
state()
.thread_workspaces
.insert(key(ctx, thread_id), workspace_dir.to_path_buf());
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 7ba9fccf1a..0d1f00d4f5 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,10 +158,12 @@ 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 4bcf4a0420..dff4dd7291 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
@@ -68,10 +68,12 @@ 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]
@@ -91,10 +93,12 @@ 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());
}