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

Steven Enamakelcd497ad8c4a2
diff --git a/crates/openhuman-core/src/agent/tools/plan_exit_tests.rs b/crates/openhuman-core/src/agent/tools/plan_exit_tests.rs
index cb6dcb10bb..5189240780 100644
--- a/crates/openhuman-core/src/agent/tools/plan_exit_tests.rs
+++ b/crates/openhuman-core/src/agent/tools/plan_exit_tests.rs
@@ -147,7 +147,9 @@ async fn plan_exit_publishes_build_run_mode_change() {
let event = tokio::time::timeout(std::time::Duration::from_secs(1), async {
loop {
match events.recv().await {
- Some((event_thread_id, mode)) if event_thread_id == thread_id && mode == "build" => {
+ Some((event_thread_id, mode))
+ if event_thread_id == thread_id && mode == "build" =>
+ {
break (event_thread_id, mode);
}
Some(_) => continue,
diff --git a/crates/openhuman-core/src/plan_review/gate_tests.rs b/crates/openhuman-core/src/plan_review/gate_tests.rs
index ca947d1a10..fa7af65ef1 100644
--- a/crates/openhuman-core/src/plan_review/gate_tests.rs
+++ b/crates/openhuman-core/src/plan_review/gate_tests.rs
@@ -26,16 +26,19 @@ impl tinybus::EventHandler<crate::core::events::DomainEvent> for DecisionCollect
}
}
-async fn decision_events(thread_id: &'static str) -> (
+async fn decision_events(
+ thread_id: &'static str,
+) -> (
impl Drop,
tokio::sync::mpsc::UnboundedReceiver<(String, Option<String>)>,
) {
crate::core::bus::init().await.expect("bus init");
let (tx, rx) = tokio::sync::mpsc::unbounded_channel();
- let handle = crate::core::bus::BUS.subscribe(std::sync::Arc::new(DecisionCollector {
- thread_id,
- sender: tx,
- }))
+ let handle = crate::core::bus::BUS
+ .subscribe(std::sync::Arc::new(DecisionCollector {
+ thread_id,
+ sender: tx,
+ }))
.expect("subscribe to core events");
(handle, rx)
}
@@ -112,7 +115,10 @@ async fn timeout_fails_closed_to_reject() {
)
.await;
assert_eq!(resolution, PlanReviewResolution::Reject);
- assert_eq!(decisions.recv().await, Some(("reject".into(), Some("expired".into()))));
+ assert_eq!(
+ decisions.recv().await,
+ Some(("reject".into(), Some("expired".into())))
+ );
// The waiter is cleaned up after timeout.
assert!(!gate.decide_by_thread(&tenant(), "t3", PlanReviewResolution::Approve));
}
@@ -124,16 +130,23 @@ async fn cancelled_park_publishes_cancelled_decision() {
let g2 = gate.clone();
let handle = tokio::spawn(async move {
g2.request_review(
- tenant(), Some("t-cancel-event".into()), Some("client-cancel".into()),
- "Plan".into(), vec![], None,
- ).await
+ tenant(),
+ Some("t-cancel-event".into()),
+ Some("client-cancel".into()),
+ "Plan".into(),
+ vec![],
+ None,
+ )
+ .await
});
tokio::time::sleep(Duration::from_millis(20)).await;
handle.abort();
let _ = handle.await;
assert_eq!(
- tokio::time::timeout(Duration::from_secs(1), decisions.recv()).await.unwrap(),
+ tokio::time::timeout(Duration::from_secs(1), decisions.recv())
+ .await
+ .unwrap(),
Some(("reject".into(), Some("cancelled".into()))),
"cancelling a parked review must tell the frontend to clear its card"
);
diff --git a/crates/openhuman-core/src/threads/run_mode.rs b/crates/openhuman-core/src/threads/run_mode.rs
index ddc5460fc1..63a6609fd4 100644
--- a/crates/openhuman-core/src/threads/run_mode.rs
+++ b/crates/openhuman-core/src/threads/run_mode.rs
@@ -227,15 +227,14 @@ async fn require_owned_thread(ctx: &DispatchCtx, thread_id: &str) -> Result<(),
return Err("thread_id is required".to_string());
}
let config = ctx.load_config().await?;
- let threads = crate::threads::store::blocking::list_threads(
- ctx.clone(),
- config.workspace_dir,
- )
- .await?;
+ let threads =
+ crate::threads::store::blocking::list_threads(ctx.clone(), config.workspace_dir).await?;
if threads.iter().any(|thread| thread.id == thread_id) {
Ok(())
} else {
- Err(format!("thread '{thread_id}' not found or not owned by caller"))
+ Err(format!(
+ "thread '{thread_id}' not found or not owned by caller"
+ ))
}
}
diff --git a/crates/openhuman-core/src/threads/run_mode_tests.rs b/crates/openhuman-core/src/threads/run_mode_tests.rs
index 54b78b29b6..58d8838c33 100644
--- a/crates/openhuman-core/src/threads/run_mode_tests.rs
+++ b/crates/openhuman-core/src/threads/run_mode_tests.rs
@@ -89,7 +89,7 @@ async fn plan_mode_stays_with_the_agent_that_set_it() {
#[tokio::test]
async fn run_mode_rpcs_reject_threads_owned_by_another_profile() {
use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};
- use crate::threads::store::{CreateConversationThread, blocking::ensure_thread};
+ use crate::threads::store::{blocking::ensure_thread, CreateConversationThread};
use crate::tools::toolpacks::ToolGroups;
let scratch = tempfile::tempdir().expect("workspace");
@@ -101,10 +101,12 @@ async fn run_mode_rpcs_reject_threads_owned_by_another_profile() {
..Default::default()
};
let context = |profile: &str| {
- DispatchCtx::new(CoreContext::for_test(DomainSet::full(), Some(dir.clone())).derive_with(
- ContextOverlay::new(config.clone(), DomainSet::full(), ToolGroups::none())
- .profile(profile),
- ))
+ DispatchCtx::new(
+ CoreContext::for_test(DomainSet::full(), Some(dir.clone())).derive_with(
+ ContextOverlay::new(config.clone(), DomainSet::full(), ToolGroups::none())
+ .profile(profile),
+ ),
+ )
};
let owner = context("run-mode-owner");
let other = context("run-mode-other");
@@ -131,9 +133,7 @@ async fn run_mode_rpcs_reject_threads_owned_by_another_profile() {
.unwrap()
.clone();
assert!(
- handle_get_run_mode(other.clone(), id_params)
- .await
- .is_err(),
+ handle_get_run_mode(other.clone(), id_params).await.is_err(),
"get_run_mode must not disclose another profile's thread state"
);
let set_params = serde_json::json!({ "thread_id": thread_id, "mode": "build" })