The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: reformat code to satisfy rustfmt
Steven Enamakel5a41447d6fc8
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rsindex 0af4d7ecd5..418dde4438 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs@@ -331,9 +331,18 @@ async fn each_agent_dedupes_its_own_in_flight_sub_agents() {let alpha = test_agent_context(&root, "alpha");let beta = test_agent_context(&root, "beta");- let alpha_map = CoreContext::scope(Arc::clone(&alpha), async { host_in_flight(&crate::core::runtime::DispatchCtx::ambient()) }).await;- let beta_map = CoreContext::scope(beta, async { host_in_flight(&crate::core::runtime::DispatchCtx::ambient()) }).await;- let alpha_again = CoreContext::scope(alpha, async { host_in_flight(&crate::core::runtime::DispatchCtx::ambient()) }).await;+ let alpha_map = CoreContext::scope(Arc::clone(&alpha), async {+ host_in_flight(&crate::core::runtime::DispatchCtx::ambient())+ })+ .await;+ let beta_map = CoreContext::scope(beta, async {+ host_in_flight(&crate::core::runtime::DispatchCtx::ambient())+ })+ .await;+ let alpha_again = CoreContext::scope(alpha, async {+ host_in_flight(&crate::core::runtime::DispatchCtx::ambient())+ })+ .await;assert!(!Arc::ptr_eq(&alpha_map, &beta_map));assert!(Arc::ptr_eq(&alpha_map, &alpha_again));diff --git a/crates/openhuman-core/src/agent/tinyagents/journal_tests.rs b/crates/openhuman-core/src/agent/tinyagents/journal_tests.rsindex 0c35a4de43..2b25b310fe 100644--- a/crates/openhuman-core/src/agent/tinyagents/journal_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/journal_tests.rs@@ -9,16 +9,26 @@ async fn request_journal_runs_stay_with_the_agent_that_registered_them() {let beta = test_agent_context(&root, "beta");CoreContext::scope(std::sync::Arc::clone(&alpha), async {- register_request_journal_run(&crate::core::runtime::DispatchCtx::ambient(), "req-shared", "run-alpha");+ register_request_journal_run(+ &crate::core::runtime::DispatchCtx::ambient(),+ "req-shared",+ "run-alpha",+ );}).await;assert_eq!(- CoreContext::scope(beta, async { take_request_journal_run(&crate::core::runtime::DispatchCtx::ambient(), "req-shared") }).await,+ CoreContext::scope(beta, async {+ take_request_journal_run(&crate::core::runtime::DispatchCtx::ambient(), "req-shared")+ })+ .await,None);assert_eq!(- CoreContext::scope(alpha, async { take_request_journal_run(&crate::core::runtime::DispatchCtx::ambient(), "req-shared") }).await,+ CoreContext::scope(alpha, async {+ take_request_journal_run(&crate::core::runtime::DispatchCtx::ambient(), "req-shared")+ })+ .await,Some("run-alpha".to_string()));}diff --git a/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs b/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rsindex 2abbfab92f..c1770181a6 100644--- a/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs@@ -83,20 +83,45 @@ fn thread_choice_wins_over_config_and_clears_back_to_it() {let mut config = Config::default();config.runtime.reasoning_effort = Some("low".into());- apply_requested_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, Some("high")).expect("valid effort");+ apply_requested_effort(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ Some("high"),+ )+ .expect("valid effort");assert_eq!(- turn_reasoning(&crate::core::runtime::DispatchCtx::ambient(), Some(thread), Some(&config)),+ turn_reasoning(+ &crate::core::runtime::DispatchCtx::ambient(),+ Some(thread),+ Some(&config)+ ),Some(ReasoningConfig::effort(ReasoningEffort::High)));// Absent leaves the thread's choice untouched.- apply_requested_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, None).expect("absent is fine");- assert_eq!(thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread), Some(ReasoningEffort::High));+ apply_requested_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, None)+ .expect("absent is fine");+ assert_eq!(+ thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread),+ Some(ReasoningEffort::High)+ );- apply_requested_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, Some("default")).expect("clear");- assert_eq!(thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread), None);+ apply_requested_effort(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ Some("default"),+ )+ .expect("clear");+ assert_eq!(+ thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread),+ None+ );assert_eq!(- turn_reasoning(&crate::core::runtime::DispatchCtx::ambient(), Some(thread), Some(&config)),+ turn_reasoning(+ &crate::core::runtime::DispatchCtx::ambient(),+ Some(thread),+ Some(&config)+ ),Some(ReasoningConfig::effort(ReasoningEffort::Low)));}@@ -104,21 +129,41 @@ fn thread_choice_wins_over_config_and_clears_back_to_it() {#[test]fn unknown_requested_effort_is_rejected_and_keeps_the_prior_choice() {let thread = "reasoning-test-thread-reject";- apply_requested_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, Some("off")).expect("valid effort");- assert!(apply_requested_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, Some("turbo")).is_err());- assert_eq!(thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread), Some(ReasoningEffort::None));+ apply_requested_effort(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ Some("off"),+ )+ .expect("valid effort");+ assert!(apply_requested_effort(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ Some("turbo")+ )+ .is_err());+ assert_eq!(+ thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread),+ Some(ReasoningEffort::None)+ );set_thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, None);}#[test]fn turn_without_thread_or_config_has_no_reasoning() {- assert_eq!(turn_reasoning(&crate::core::runtime::DispatchCtx::ambient(), None, None), None);+ assert_eq!(+ turn_reasoning(&crate::core::runtime::DispatchCtx::ambient(), None, None),+ None+ );}#[test]fn root_turn_follows_the_thread_choice() {let thread = "reasoning-test-thread-root";- set_thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, Some(ReasoningEffort::High));+ set_thread_effort(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ Some(ReasoningEffort::High),+ );let mut ctx = crate::agent::tinyagents::host::OpenHumanRunContext::new();ctx.thread_id = Some(thread.to_string());assert_eq!(@@ -131,7 +176,11 @@ fn root_turn_follows_the_thread_choice() {#[test]fn subagent_turn_keeps_the_provider_default() {let thread = "reasoning-test-thread-subagent";- set_thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, Some(ReasoningEffort::High));+ set_thread_effort(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ Some(ReasoningEffort::High),+ );let mut ctx = crate::agent::tinyagents::host::OpenHumanRunContext::new();ctx.thread_id = Some(thread.to_string());ctx.spawn_depth = 1;@@ -156,7 +205,11 @@ fn root_turn_reasoning_reserves_output_room_with_a_budget() {// the whole output cap and return `length` with no tool call. A capped// turn now also carries a thinking budget of about 55% of that cap.let thread = "reasoning-test-thread-budget";- set_thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, Some(ReasoningEffort::High));+ set_thread_effort(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ Some(ReasoningEffort::High),+ );let mut ctx = crate::agent::tinyagents::host::OpenHumanRunContext::new();ctx.thread_id = Some(thread.to_string());let reasoning = turn_reasoning_for(@@ -239,16 +292,26 @@ async fn reasoning_effort_stays_with_the_agent_that_chose_it() {let thread = "effort-shared-thread";CoreContext::scope(std::sync::Arc::clone(&alpha), async {- set_thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread, Some(ReasoningEffort::High));+ set_thread_effort(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ Some(ReasoningEffort::High),+ );}).await;assert_eq!(- CoreContext::scope(alpha, async { thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread) }).await,+ CoreContext::scope(alpha, async {+ thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread)+ })+ .await,Some(ReasoningEffort::High));assert_eq!(- CoreContext::scope(beta, async { thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread) }).await,+ CoreContext::scope(beta, async {+ thread_effort(&crate::core::runtime::DispatchCtx::ambient(), thread)+ })+ .await,None);}diff --git a/crates/openhuman-core/src/agent/tinyagents/run_mode_tests.rs b/crates/openhuman-core/src/agent/tinyagents/run_mode_tests.rsindex 586ef93d3c..3e8e5f7866 100644--- a/crates/openhuman-core/src/agent/tinyagents/run_mode_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/run_mode_tests.rs@@ -3,23 +3,44 @@ use super::*;#[test]fn defaults_to_build_mode_for_an_unseen_thread() {let thread_id = format!("run-mode-test-{}", uuid::Uuid::new_v4());- assert_eq!(get_mode(&crate::core::runtime::DispatchCtx::ambient(), &thread_id), RunMode::Build);+ assert_eq!(+ get_mode(&crate::core::runtime::DispatchCtx::ambient(), &thread_id),+ RunMode::Build+ );}#[test]fn set_mode_is_observed_through_a_fresh_handle_lookup() {let thread_id = format!("run-mode-test-{}", uuid::Uuid::new_v4());- set_mode(&crate::core::runtime::DispatchCtx::ambient(), &thread_id, RunMode::Plan);- assert_eq!(get_mode(&crate::core::runtime::DispatchCtx::ambient(), &thread_id), RunMode::Plan);- set_mode(&crate::core::runtime::DispatchCtx::ambient(), &thread_id, RunMode::Build);- assert_eq!(get_mode(&crate::core::runtime::DispatchCtx::ambient(), &thread_id), RunMode::Build);+ set_mode(+ &crate::core::runtime::DispatchCtx::ambient(),+ &thread_id,+ RunMode::Plan,+ );+ assert_eq!(+ get_mode(&crate::core::runtime::DispatchCtx::ambient(), &thread_id),+ RunMode::Plan+ );+ set_mode(+ &crate::core::runtime::DispatchCtx::ambient(),+ &thread_id,+ RunMode::Build,+ );+ assert_eq!(+ get_mode(&crate::core::runtime::DispatchCtx::ambient(), &thread_id),+ RunMode::Build+ );}#[test]fn handle_for_thread_shares_state_with_set_mode() {let thread_id = format!("run-mode-test-{}", uuid::Uuid::new_v4());let handle = handle_for_thread(&crate::core::runtime::DispatchCtx::ambient(), &thread_id);- set_mode(&crate::core::runtime::DispatchCtx::ambient(), &thread_id, RunMode::Plan);+ set_mode(+ &crate::core::runtime::DispatchCtx::ambient(),+ &thread_id,+ RunMode::Plan,+ );assert_eq!(handle.get(), RunMode::Plan);}@@ -42,16 +63,26 @@ async fn plan_mode_stays_with_the_agent_that_set_it() {let thread = "plan-mode-shared-thread";CoreContext::scope(std::sync::Arc::clone(&alpha), async {- set_mode(&crate::core::runtime::DispatchCtx::ambient(), thread, RunMode::Plan);+ set_mode(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ RunMode::Plan,+ );}).await;assert_eq!(- CoreContext::scope(alpha, async { get_mode(&crate::core::runtime::DispatchCtx::ambient(), thread) }).await,+ CoreContext::scope(alpha, async {+ get_mode(&crate::core::runtime::DispatchCtx::ambient(), thread)+ })+ .await,RunMode::Plan);assert_eq!(- CoreContext::scope(beta, async { get_mode(&crate::core::runtime::DispatchCtx::ambient(), thread) }).await,+ CoreContext::scope(beta, async {+ get_mode(&crate::core::runtime::DispatchCtx::ambient(), thread)+ })+ .await,RunMode::Build);}diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rsindex ce2a4a2c28..c711535979 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs@@ -419,7 +419,9 @@ async fn drive_turn({journal::register_request_journal_run(&run_context.dispatch_ctx(),- request_id, journal_run_id.as_str());+ request_id,+ journal_run_id.as_str(),+ );}}ctx = ctx.with_events(sink.clone());@@ -519,15 +521,12 @@ async fn drive_turn(has_route_fallback,hosted_security_gate,pause_at_cap,- run_mode: run_context- .thread_id- .as_deref()- .map(|thread_id| {- crate::agent::tinyagents::run_mode::handle_for_thread(- &run_context.dispatch_ctx(),- thread_id,- )- }),+ run_mode: run_context.thread_id.as_deref().map(|thread_id| {+ crate::agent::tinyagents::run_mode::handle_for_thread(+ &run_context.dispatch_ctx(),+ thread_id,+ )+ }),memory_turn: run_context.memory_turn.clone(),summarizer_model,failure_map: failure_map.clone(),diff --git a/crates/openhuman-core/src/agent/tools/plan_exit_tests.rs b/crates/openhuman-core/src/agent/tools/plan_exit_tests.rsindex 9778bb5e42..03a63ed3f2 100644--- a/crates/openhuman-core/src/agent/tools/plan_exit_tests.rs+++ b/crates/openhuman-core/src/agent/tools/plan_exit_tests.rs@@ -47,7 +47,10 @@ async fn plan_exit_does_not_flip_while_a_review_is_parked() {.unwrap();assert!(!result.is_error);assert_eq!(- crate::agent::tinyagents::run_mode::get_mode(&crate::core::runtime::DispatchCtx::ambient(), thread_id),+ crate::agent::tinyagents::run_mode::get_mode(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id+ ),tinyagents_harness::middleware::RunMode::Plan,"plan_exit must not flip to Build while a review is still parked");@@ -70,7 +73,10 @@ async fn plan_exit_does_not_flip_while_a_review_is_parked() {.unwrap();assert!(!result.is_error);assert_eq!(- crate::agent::tinyagents::run_mode::get_mode(&crate::core::runtime::DispatchCtx::ambient(), thread_id),+ crate::agent::tinyagents::run_mode::get_mode(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id+ ),tinyagents_harness::middleware::RunMode::Build);}diff --git a/crates/openhuman-core/src/agent/tools/run_workflow.rs b/crates/openhuman-core/src/agent/tools/run_workflow.rsindex c2f95599ba..a768e5c093 100644--- a/crates/openhuman-core/src/agent/tools/run_workflow.rs+++ b/crates/openhuman-core/src/agent/tools/run_workflow.rs@@ -53,10 +53,10 @@ const MAX_WAIT_SECONDS: u64 = 600;/// Coarse, process-global spawn/await guardrails. See the module doc for why/// these are global rather than per-lineage.mod guard {+ use crate::core::runtime::DispatchCtx;use std::collections::HashSet;use std::sync::atomic::{AtomicU64, Ordering};use std::sync::{Arc, Mutex};- use crate::core::runtime::DispatchCtx;/// Per-agent lifetime backstop against a runaway spawn loop.const TOTAL_SPAWN_BACKSTOP: u64 = 500;diff --git a/crates/openhuman-core/src/agent/tools/run_workflow_tests.rs b/crates/openhuman-core/src/agent/tools/run_workflow_tests.rsindex e4afe44ed9..feecd730e1 100644--- a/crates/openhuman-core/src/agent/tools/run_workflow_tests.rs+++ b/crates/openhuman-core/src/agent/tools/run_workflow_tests.rs@@ -84,12 +84,16 @@ fn guard_serial() -> &'static tokio::sync::Mutex<()> {fn acquire_await_rejects_the_same_key_reentrantly() {let _s = guard_serial().blocking_lock();let key = "reentry-test\u{1}null".to_string();- let held = super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key.clone()).expect("first acquire");- let again = super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key.clone());+ let held =+ super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key.clone())+ .expect("first acquire");+ let again =+ super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key.clone());assert!(again.is_err(), "the same key while held must be rejected");assert!(again.err().unwrap().contains("re-entrant"));drop(held); // frees the key- super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key).expect("after drop the key is free again");+ super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key)+ .expect("after drop the key is free again");}#[test]@@ -98,14 +102,27 @@ fn acquire_await_caps_concurrent_awaits() {// MAX_ACTIVE_AWAITS is 8; hold 8 distinct keys, then the 9th must reject.let mut held = Vec::new();for i in 0..8 {- held.push(super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), format!("cap-test-{i}")).expect("under the cap"));+ held.push(+ super::guard::acquire_await(+ &crate::core::runtime::DispatchCtx::ambient(),+ format!("cap-test-{i}"),+ )+ .expect("under the cap"),+ );}- let ninth = super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), "cap-test-9".to_string());+ let ninth = super::guard::acquire_await(+ &crate::core::runtime::DispatchCtx::ambient(),+ "cap-test-9".to_string(),+ );assert!(ninth.is_err(), "the 9th concurrent await must reject");assert!(ninth.err().unwrap().contains("already being awaited"));// Free one slot → the next acquire succeeds.held.pop();- super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), "cap-test-9".to_string()).expect("a freed slot is reusable");+ super::guard::acquire_await(+ &crate::core::runtime::DispatchCtx::ambient(),+ "cap-test-9".to_string(),+ )+ .expect("a freed slot is reusable");}#[tokio::test]@@ -173,15 +190,20 @@ async fn each_agent_owns_its_workflow_await_guard() {let key = "agent-guard-shared-key".to_string();let held = CoreContext::scope(std::sync::Arc::clone(&alpha), async {- super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key.clone()).expect("alpha acquires")+ super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key.clone())+ .expect("alpha acquires")}).await;- let beta_result =- CoreContext::scope(beta, async { super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key.clone()) }).await;+ let beta_result = CoreContext::scope(beta, async {+ super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key.clone())+ })+ .await;assert!(beta_result.is_ok(), "beta is not blocked by alpha's await");- let alpha_again =- CoreContext::scope(alpha, async { super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key.clone()) }).await;+ let alpha_again = CoreContext::scope(alpha, async {+ super::guard::acquire_await(&crate::core::runtime::DispatchCtx::ambient(), key.clone())+ })+ .await;assert!(alpha_again.is_err(), "alpha still holds its own key");drop(held);}diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rsindex 593e679f6f..ca25fd4b39 100644--- a/crates/openhuman-core/src/channels/routes_tests.rs+++ b/crates/openhuman-core/src/channels/routes_tests.rs@@ -245,7 +245,10 @@ async fn sign_out_cancels_remote_invalidation_while_it_waits_for_the_session_tabcrate::core::runtime::CoreContext::for_test(crate::core::runtime::DomainSet::full(), None);let expected_core_context = Arc::clone(&core_context);crate::core::runtime::CoreContext::scope(core_context, async {- let guard = crate::web_chat::lock_thread_sessions_for_test(&crate::core::runtime::DispatchCtx::ambient()).await;+ let guard = crate::web_chat::lock_thread_sessions_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ )+ .await;let cancellation = tokio_util::sync::CancellationToken::new();let callback = RouteCallbacks::new(runtime_context(PathBuf::from("/tmp/channel-callback")),diff --git a/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs b/crates/openhuman-core/src/core/runtime/agent_scope_tests.rsindex 557e77b782..0f80bd50ed 100644--- a/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs+++ b/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs@@ -218,7 +218,10 @@ async fn an_explicit_dispatch_context_wins_over_the_ambient_one() {}).await;- assert!(Arc::ptr_eq(&explicit, &alpha.agent_state().slot::<Counter>()));+ assert!(Arc::ptr_eq(+ &explicit,+ &alpha.agent_state().slot::<Counter>()+ ));assert!(Arc::ptr_eq(&ambient, &beta.agent_state().slot::<Counter>()));assert!(!Arc::ptr_eq(&explicit, &ambient));}diff --git a/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs b/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rsindex ba5de36ba1..4e40311d05 100644--- a/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs+++ b/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs@@ -78,12 +78,20 @@ async fn pre_turn_logs_the_user_turn_and_injects_what_memory_holds() {.unwrap();let identity = MemoryIdentity::agent("orchestrator").resolve(&config);- let pack = pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &identity, input("t1", 0, "what colour do I like?"))- .await- .expect("a pack");+ let pack = pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &identity,+ input("t1", 0, "what colour do I like?"),+ )+ .await+ .expect("a pack");assert!(pack.markdown.contains("teal"), "{}", pack.markdown);assert!(!pack.refs.is_empty());- let chips = crate::memory::tools::take_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), "t1");+ let chips = crate::memory::tools::take_turn_citations(+ &crate::core::runtime::DispatchCtx::ambient(),+ "t1",+ );assert!(chips.iter().any(|chip| chip.snippet.contains("teal")),"the pack's citations reach the chat: {chips:?}"@@ -114,11 +122,14 @@ async fn recall_off_still_logs_and_logging_off_still_recalls() {config.memory.recall.enabled = false;let quiet = MemoryIdentity::agent("a").resolve(&config);- assert!(- pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &quiet, input("t", 0, "when do deploys happen?"))- .await- .is_none()- );+ assert!(pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &quiet,+ input("t", 0, "when do deploys happen?")+ )+ .await+ .is_none());assert_eq!(stored(&engine, MetaFilter::kinds([ItemKind::Conversation])).await@@ -129,7 +140,13 @@ async fn recall_off_still_logs_and_logging_off_still_recalls() {config.memory.recall.enabled = true;config.memory.conversations.enabled = false;let reader = MemoryIdentity::agent("a").resolve(&config);- let pack = pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &reader, input("t", 2, "when do deploys happen?")).await;+ let pack = pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &reader,+ input("t", 2, "when do deploys happen?"),+ )+ .await;assert!(pack.expect("a pack").markdown.contains("Fridays"));assert_eq!(stored(&engine, MetaFilter::kinds([ItemKind::Conversation]))@@ -141,9 +158,14 @@ async fn recall_off_still_logs_and_logging_off_still_recalls() {config.memory.recall.enabled = false;let none = MemoryIdentity::agent("a").resolve(&config);- assert!(pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &none, input("t", 4, "hi"))- .await- .is_none());+ assert!(pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &none,+ input("t", 4, "hi")+ )+ .await+ .is_none());}#[tokio::test]@@ -151,9 +173,14 @@ async fn pre_turn_without_an_engine_runs_the_turn_without_a_pack() {let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);let identity = MemoryIdentity::agent("a").resolve(&config);- assert!(pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &identity, input("t", 0, "hello"))- .await- .is_none());+ assert!(pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &identity,+ input("t", 0, "hello")+ )+ .await+ .is_none());post_turn(&config, &identity, reply("t", 1, "hi")).await;}@@ -227,9 +254,14 @@ async fn an_out_of_credits_recall_tells_the_turn_memory_is_unavailable() {crate::memory::test_fixtures::RefusingEngine::out_of_credits().bind(&config);let identity = MemoryIdentity::agent("orchestrator").resolve(&config);- let pack = pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &identity, input("t", 0, "what colour do I like?"))- .await- .expect("a refused recall still gives the turn a notice");+ let pack = pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &identity,+ input("t", 0, "what colour do I like?"),+ )+ .await+ .expect("a refused recall still gives the turn a notice");assert_eq!(pack.refusal,@@ -255,9 +287,14 @@ async fn an_unreachable_engine_is_named_as_unreachable() {.bind(&config);let identity = MemoryIdentity::agent("orchestrator").resolve(&config);- let pack = pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &identity, input("t", 0, "hello"))- .await- .expect("notice");+ let pack = pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &identity,+ input("t", 0, "hello"),+ )+ .await+ .expect("notice");assert_eq!(pack.refusal, Some(crate::memory::error::UNAVAILABLE));assert!(@@ -277,9 +314,14 @@ async fn an_engine_fault_that_is_not_account_wide_injects_nothing() {.bind(&config);let identity = MemoryIdentity::agent("orchestrator").resolve(&config);- assert!(pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &identity, input("t", 0, "hello"))- .await- .is_none());+ assert!(pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &identity,+ input("t", 0, "hello")+ )+ .await+ .is_none());}#[test]@@ -427,7 +469,14 @@ async fn a_resumed_session_pack_stays_within_one_budget_and_repeats_nothing() {let mut resumed = input("t-resumed", 12, "when does the Lisbon release ship?");resumed.resumed_after_compaction = true;resumed.in_prompt_from = 12;- let pack = pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &identity, resumed).await.expect("a pack");+ let pack = pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &identity,+ resumed,+ )+ .await+ .expect("a pack");eprintln!("resumed session: pack {} tokens (budget {}), repeated lines {}",pack.tokens,@@ -480,7 +529,14 @@ async fn a_resumed_session_without_logging_still_opens_with_the_thread() {let mut resumed = input("t-quiet", 2, "remind me where the offsite is");resumed.resumed_after_compaction = true;resumed.in_prompt_from = 2;- let pack = pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &reader, resumed).await.expect("a pack");+ let pack = pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &reader,+ resumed,+ )+ .await+ .expect("a pack");assert!(pack.markdown.contains("Alfama hotel"), "{}", pack.markdown);assert!(repeated_lines(&pack.markdown).is_empty());}@@ -491,9 +547,14 @@ async fn a_blank_turn_is_refused_without_a_pack_with_or_without_logging() {let mut config = config_in(&tmp);let engine = bind_reference(&config);let identity = MemoryIdentity::agent("orchestrator").resolve(&config);- assert!(pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &identity, input("t-blank", 0, " "))- .await- .is_none());+ assert!(pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &identity,+ input("t-blank", 0, " ")+ )+ .await+ .is_none());assert!(stored(&engine, MetaFilter::kinds([ItemKind::Conversation])).await@@ -503,12 +564,24 @@ async fn a_blank_turn_is_refused_without_a_pack_with_or_without_logging() {config.memory.conversations.enabled = false;let reader = MemoryIdentity::agent("orchestrator").resolve(&config);- assert!(pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &reader, input("t-blank", 2, " "))- .await- .is_none());+ assert!(pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &reader,+ input("t-blank", 2, " ")+ )+ .await+ .is_none());let mut resumed = input(" ", 4, "where were we?");resumed.resumed_after_compaction = true;- assert!(pre_turn(&crate::core::runtime::DispatchCtx::ambient(),&config, &reader, resumed).await.is_none());+ assert!(pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &reader,+ resumed+ )+ .await+ .is_none());}/// With `date_hint` on, the turn's text goes to the chat model with the datediff --git a/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs b/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rsindex fb28073128..d3127bfc54 100644--- a/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs+++ b/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs@@ -313,7 +313,14 @@ async fn slow_engine_results_survive_the_manual_pre_turn_cutoff() {observed_actor: None,};let config = Arc::new(config);- assert!(pre_turn(&crate::core::runtime::DispatchCtx::ambient(), config.clone(), identity.clone(), input(0), None).is_none());+ assert!(pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ config.clone(),+ identity.clone(),+ input(0),+ None+ )+ .is_none());// Even after the old one-millisecond cutoff, the pack remains owned by// the background worker instead of being discarded by the live turn.tokio::time::sleep(Duration::from_millis(5)).await;@@ -322,14 +329,27 @@ async fn slow_engine_results_survive_the_manual_pre_turn_cutoff() {assert!(completed(&cache, &key).is_none());release.add_permits(100);drain(&cache, &key).await;- let pack = pre_turn(&crate::core::runtime::DispatchCtx::ambient(), config.clone(), identity.clone(), input(2), None)- .expect("next turn uses completed slow lookup");+ let pack = pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ config.clone(),+ identity.clone(),+ input(2),+ None,+ )+ .expect("next turn uses completed slow lookup");assert!(pack.markdown.contains("teal"));assert!(pack.markdown.contains("earlier turn"));drain(&cache, &key).await;let mut omitted = identity;omitted.recall = false;- assert!(pre_turn(&crate::core::runtime::DispatchCtx::ambient(), config.clone(), omitted.clone(), input(4), None).is_none());+ assert!(pre_turn(+ &crate::core::runtime::DispatchCtx::ambient(),+ config.clone(),+ omitted.clone(),+ input(4),+ None+ )+ .is_none());drain(&cache, &Key::new(&config, &omitted, "slow", false)).await;let turns = crate::memory::test_fixtures::stored(&engine.inner,diff --git a/crates/openhuman-core/src/memory/tools.rs b/crates/openhuman-core/src/memory/tools.rsindex 9374b3015c..93ce425440 100644--- a/crates/openhuman-core/src/memory/tools.rs+++ b/crates/openhuman-core/src/memory/tools.rs@@ -49,7 +49,8 @@ fn turn_citations(ctx: &DispatchCtx) -> Arc<TurnCitations> {fn record_turn_citations(ctx: &DispatchCtx,- thread_id: &str, citations: &[tinymemory_api::Citation],+ thread_id: &str,+ citations: &[tinymemory_api::Citation],) {if citations.is_empty() {return;diff --git a/crates/openhuman-core/src/memory/tools_agent_tests.rs b/crates/openhuman-core/src/memory/tools_agent_tests.rsindex 5ca616a19a..61bc4f17e2 100644--- a/crates/openhuman-core/src/memory/tools_agent_tests.rs+++ b/crates/openhuman-core/src/memory/tools_agent_tests.rs@@ -32,16 +32,30 @@ async fn turn_citations_stay_with_the_agent_that_recorded_them() {let thread = "shared-thread";CoreContext::scope(Arc::clone(&alpha), async {- record_pack_citations(&crate::core::runtime::DispatchCtx::ambient(), thread, vec![citation("alpha-cite")]);+ record_pack_citations(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ vec![citation("alpha-cite")],+ );}).await;CoreContext::scope(Arc::clone(&beta), async {- record_pack_citations(&crate::core::runtime::DispatchCtx::ambient(), thread, vec![citation("beta-cite")]);+ record_pack_citations(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ vec![citation("beta-cite")],+ );}).await;- let from_beta = CoreContext::scope(beta, async { take_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), thread) }).await;- let from_alpha = CoreContext::scope(alpha, async { take_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), thread) }).await;+ let from_beta = CoreContext::scope(beta, async {+ take_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), thread)+ })+ .await;+ let from_alpha = CoreContext::scope(alpha, async {+ take_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), thread)+ })+ .await;assert_eq!(from_alpha.iter().map(|c| c.id.as_str()).collect::<Vec<_>>(),diff --git a/crates/openhuman-core/src/memory/tools_tests.rs b/crates/openhuman-core/src/memory/tools_tests.rsindex f0d7dec371..a51a27d62b 100644--- a/crates/openhuman-core/src/memory/tools_tests.rs+++ b/crates/openhuman-core/src/memory/tools_tests.rs@@ -88,7 +88,13 @@ async fn every_action_reports_memory_off_as_a_tool_error() {json!({"action": "learn", "text": "t"}),json!({"action": "forget", "ids": ["a"]}),] {- let result = run_action(&crate::core::runtime::DispatchCtx::ambient(), &config, &args, &facts()).await;+ let result = run_action(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &args,+ &facts(),+ )+ .await;assert!(result.is_error, "{args}");assert!(text(&result).contains("MEMORY_OFF"), "{}", text(&result));}@@ -100,15 +106,33 @@ async fn bad_arguments_and_unknown_actions_are_model_visible_errors() {let config = config_in(&tmp);bind_reference(&config);- let unknown = run_action(&crate::core::runtime::DispatchCtx::ambient(), &config, &json!({"action": "explode"}), &facts()).await;+ let unknown = run_action(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &json!({"action": "explode"}),+ &facts(),+ )+ .await;assert!(unknown.is_error);assert!(text(&unknown).contains("unknown action `explode`"));- let missing = run_action(&crate::core::runtime::DispatchCtx::ambient(), &config, &json!({}), &facts()).await;+ let missing = run_action(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &json!({}),+ &facts(),+ )+ .await;assert!(missing.is_error);for action in ["recall", "fetch", "learn", "forget"] {- let result = run_action(&crate::core::runtime::DispatchCtx::ambient(), &config, &json!({ "action": action }), &facts()).await;+ let result = run_action(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &json!({ "action": action }),+ &facts(),+ )+ .await;assert!(result.is_error, "{action}");assert!(text(&result).contains("invalid arguments"), "{action}");}@@ -128,7 +152,13 @@ async fn learn_stamps_what_the_host_knows_and_ignores_model_meta() {// The model must not be able to forge host-owned fields."meta": {"thread_id": "forged", "agent_id": "forged"},});- let result = run_action(&crate::core::runtime::DispatchCtx::ambient(), &config, &args, &facts()).await;+ let result = run_action(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &args,+ &facts(),+ )+ .await;assert!(!result.is_error, "{}", text(&result));let id = serde_json::from_str::<Value>(&text(&result)).unwrap()["id"].as_str()@@ -185,10 +215,17 @@ async fn recall_fetch_and_forget_round_trip_and_recall_records_citations() {).await;assert!(!recalled.is_error, "{}", text(&recalled));- let cites = take_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), "thread-citations");+ let cites = take_turn_citations(+ &crate::core::runtime::DispatchCtx::ambient(),+ "thread-citations",+ );assert!(cites.iter().any(|c| c.id == id), "{cites:?}");assert!(- take_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), "thread-citations").is_empty(),+ take_turn_citations(+ &crate::core::runtime::DispatchCtx::ambient(),+ "thread-citations"+ )+ .is_empty(),"draining empties the thread's citations");@@ -208,7 +245,13 @@ async fn recall_fetch_and_forget_round_trip_and_recall_records_citations() {1);- let forgotten = run_action(&crate::core::runtime::DispatchCtx::ambient(), &config, &json!({"action": "forget", "ids": [id]}), &facts).await;+ let forgotten = run_action(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &json!({"action": "forget", "ids": [id]}),+ &facts,+ )+ .await;assert!(!forgotten.is_error, "{}", text(&forgotten));assert!(engine.is_empty());}@@ -275,7 +318,11 @@ fn turn_citations_are_capped_and_deduplicated() {let thread = "thread-cap";let many: Vec<_> = (0..MAX_TURN_CITATIONS + 10).map(citation).collect();record_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), thread, &many);- record_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), thread, &many[..2]);+ record_turn_citations(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread,+ &many[..2],+ );record_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), thread, &[]);let drained = take_turn_citations(&crate::core::runtime::DispatchCtx::ambient(), thread);assert_eq!(drained.len(), MAX_TURN_CITATIONS);diff --git a/crates/openhuman-core/src/profiles/lease_tests.rs b/crates/openhuman-core/src/profiles/lease_tests.rsindex 88f58e8383..527ad11627 100644--- a/crates/openhuman-core/src/profiles/lease_tests.rs+++ b/crates/openhuman-core/src/profiles/lease_tests.rs@@ -167,7 +167,12 @@ async fn renewal_keeps_the_lease_and_a_lost_lease_fences_the_profile() {let turn = tokio_util::sync::CancellationToken::new();CoreContext::scope(Arc::clone(state.context()),- crate::web_chat::track_parallel_turn_for_test(&crate::core::runtime::DispatchCtx::ambient(), "t1", "req-1", turn.clone()),+ crate::web_chat::track_parallel_turn_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ "t1",+ "req-1",+ turn.clone(),+ ),).await;assert_eq!(diff --git a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs b/crates/openhuman-core/src/web_chat/ops/channel_ops.rsindex 7c6decb04d..53283ea0fb 100644--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs@@ -231,7 +231,11 @@ async fn cancel_chat_inner(/// Is a primary or parallel turn still running on `thread_id`?async fn thread_has_live_turn(ctx: &DispatchCtx, thread_id: &str, map_key: &str) -> bool {- if super::state::in_flight(ctx).lock().await.contains_key(map_key) {+ if super::state::in_flight(ctx)+ .lock()+ .await+ .contains_key(map_key)+ {return true;}super::state::parallel_in_flight(ctx)diff --git a/crates/openhuman-core/src/web_chat/ops/state_tests.rs b/crates/openhuman-core/src/web_chat/ops/state_tests.rsindex 730c61a4a5..f704e9f0b7 100644--- a/crates/openhuman-core/src/web_chat/ops/state_tests.rs+++ b/crates/openhuman-core/src/web_chat/ops/state_tests.rs@@ -21,14 +21,25 @@ async fn each_agent_context_owns_its_turn_tables() {let (alpha_sessions, alpha_in_flight, alpha_parallel) =CoreContext::scope(Arc::clone(&alpha), async {- (thread_sessions(&crate::core::runtime::DispatchCtx::ambient()), in_flight(&crate::core::runtime::DispatchCtx::ambient()), parallel_in_flight(&crate::core::runtime::DispatchCtx::ambient()))+ (+ thread_sessions(&crate::core::runtime::DispatchCtx::ambient()),+ in_flight(&crate::core::runtime::DispatchCtx::ambient()),+ parallel_in_flight(&crate::core::runtime::DispatchCtx::ambient()),+ )}).await;let (beta_sessions, beta_in_flight, beta_parallel) = CoreContext::scope(beta, async {- (thread_sessions(&crate::core::runtime::DispatchCtx::ambient()), in_flight(&crate::core::runtime::DispatchCtx::ambient()), parallel_in_flight(&crate::core::runtime::DispatchCtx::ambient()))+ (+ thread_sessions(&crate::core::runtime::DispatchCtx::ambient()),+ in_flight(&crate::core::runtime::DispatchCtx::ambient()),+ parallel_in_flight(&crate::core::runtime::DispatchCtx::ambient()),+ )+ })+ .await;+ let alpha_again = CoreContext::scope(alpha, async {+ in_flight(&crate::core::runtime::DispatchCtx::ambient())}).await;- let alpha_again = CoreContext::scope(alpha, async { in_flight(&crate::core::runtime::DispatchCtx::ambient()) }).await;assert!(!Arc::ptr_eq(&alpha_sessions, &beta_sessions));assert!(!Arc::ptr_eq(&alpha_in_flight, &beta_in_flight));@@ -80,7 +91,13 @@ async fn two_profiles_on_the_same_thread_id_hold_two_keys() {#[tokio::test]async fn a_user_cancel_under_the_fence_placeholder_id_keeps_the_callers_client() {let token = tokio_util::sync::CancellationToken::new();- track_parallel_turn_for_test(&crate::core::runtime::DispatchCtx::ambient(), "fence-thread", "fence-req", token.clone()).await;+ track_parallel_turn_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ "fence-thread",+ "fence-req",+ token.clone(),+ )+ .await;let mut events = crate::web_chat::subscribe_web_channel_events();crate::web_chat::ops::channel_ops::cancel_chat_scoped(diff --git a/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rs b/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rsindex e21b64f3eb..a30d23f863 100644--- a/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rs+++ b/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rs@@ -112,7 +112,9 @@ async fn record_prunes_other_threads_stale_entries() {// ...which a later budget event on a DIFFERENT thread sweeps away.record_budget_signal(&ctx(), active, BINDING).await;{- let signals = thread_budget_signals(&crate::core::runtime::DispatchCtx::ambient()).lock_owned().await;+ let signals = thread_budget_signals(&crate::core::runtime::DispatchCtx::ambient())+ .lock_owned()+ .await;assert!(!signals.contains_key(abandoned),"stale entry should be pruned"diff --git a/crates/openhuman-core/src/web_chat/session_checkout_agents_tests.rs b/crates/openhuman-core/src/web_chat/session_checkout_agents_tests.rsindex a6f0a317b0..0c36684799 100644--- a/crates/openhuman-core/src/web_chat/session_checkout_agents_tests.rs+++ b/crates/openhuman-core/src/web_chat/session_checkout_agents_tests.rs@@ -66,7 +66,10 @@ async fn two_agents_with_the_same_thread_id_get_their_own_cache_slots() {let (ctx, key) = (Arc::clone(ctx), key.clone());async move {CoreContext::scope(ctx, async move {- thread_sessions(&crate::core::runtime::DispatchCtx::ambient()).lock_owned().await.contains_key(&key)+ thread_sessions(&crate::core::runtime::DispatchCtx::ambient())+ .lock_owned()+ .await+ .contains_key(&key)}).await}diff --git a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs b/crates/openhuman-core/src/web_chat/session_checkout_tests.rsindex 01e7950500..79f841a4fc 100644--- a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs+++ b/crates/openhuman-core/src/web_chat/session_checkout_tests.rs@@ -154,10 +154,12 @@ async fn checkout_cold_boots_from_the_thread_transcript_and_checkin_keeps_it_war);checkin_session_agent(&DispatchCtx::ambient(), &thread_id, agent, fingerprint).await;- assert!(thread_sessions(&crate::core::runtime::DispatchCtx::ambient())- .lock()- .await- .contains_key(&key_for(&DispatchCtx::ambient(), &thread_id)));+ assert!(+ thread_sessions(&crate::core::runtime::DispatchCtx::ambient())+ .lock()+ .await+ .contains_key(&key_for(&DispatchCtx::ambient(), &thread_id))+ );// The next checkout — a user turn — reuses the warm agent with that history.let CheckedOutSession { agent, .. } = checkout_session_agent(@@ -179,10 +181,12 @@ async fn checkout_cold_boots_from_the_thread_transcript_and_checkin_keeps_it_war"warm checkout must carry the same history");// Checked out means removed: nobody else can drive this agent meanwhile.- assert!(!thread_sessions(&crate::core::runtime::DispatchCtx::ambient())- .lock()- .await- .contains_key(&key_for(&DispatchCtx::ambient(), &thread_id)));+ assert!(+ !thread_sessions(&crate::core::runtime::DispatchCtx::ambient())+ .lock()+ .await+ .contains_key(&key_for(&DispatchCtx::ambient(), &thread_id))+ );evict(&thread_id).await;}@@ -287,10 +291,12 @@ async fn a_fork_never_takes_or_returns_the_cached_agent() {// Built fresh: no transcript on disk for this thread, so an empty history.assert!(prose(&agent.history()).is_empty());// The primary's cached agent was left in place.- assert!(thread_sessions(&crate::core::runtime::DispatchCtx::ambient())- .lock()- .await- .contains_key(&key_for(&DispatchCtx::ambient(), &thread_id)));+ assert!(+ thread_sessions(&crate::core::runtime::DispatchCtx::ambient())+ .lock()+ .await+ .contains_key(&key_for(&DispatchCtx::ambient(), &thread_id))+ );evict(&thread_id).await;}@@ -685,10 +691,12 @@ async fn each_checkout_arms_the_reply_language_from_its_own_locale() {checkin_session_agent(&DispatchCtx::ambient(), &thread_id, agent, fingerprint).await;// Reused again, now Hindi: re-armed with the new language.- assert!(thread_sessions(&crate::core::runtime::DispatchCtx::ambient())- .lock()- .await- .contains_key(&key_for(&DispatchCtx::ambient(), &thread_id)));+ assert!(+ thread_sessions(&crate::core::runtime::DispatchCtx::ambient())+ .lock()+ .await+ .contains_key(&key_for(&DispatchCtx::ambient(), &thread_id))+ );let CheckedOutSession { agent, .. } = checkout(Some("hi")).await;let directive = agent.reply_language_directive()diff --git a/crates/openhuman-core/src/web_chat/web_tests.rs b/crates/openhuman-core/src/web_chat/web_tests.rsindex 4ff414a620..93ff2f41a8 100644--- a/crates/openhuman-core/src/web_chat/web_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests.rs@@ -75,7 +75,8 @@ fn fp(async fn wait_for_in_flight<F: Fn(&[(String, String)]) -> bool>(pred: F) -> Vec<(String, String)> {timeout(Duration::from_secs(5), async {loop {- let entries = in_flight_entries_for_test(&crate::core::runtime::DispatchCtx::ambient()).await;+ let entries =+ in_flight_entries_for_test(&crate::core::runtime::DispatchCtx::ambient()).await;if pred(&entries) {return entries;}@@ -110,7 +111,9 @@ fn make_block() -> TestRunChatTaskBlock {async fn wait_for_parallel<F: Fn(&[(String, String)]) -> bool>(pred: F) -> Vec<(String, String)> {timeout(Duration::from_secs(5), async {loop {- let entries = parallel_in_flight_entries_for_test(&crate::core::runtime::DispatchCtx::ambient()).await;+ let entries =+ parallel_in_flight_entries_for_test(&crate::core::runtime::DispatchCtx::ambient())+ .await;if pred(&entries) {return entries;}diff --git a/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rsindex cc99222b10..b4a36af797 100644--- a/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs@@ -67,7 +67,12 @@ async fn web_queue_retains_typed_queued_turn_metadata() {// This drains the actual in-flight host queue, not a standalone// RunQueue<String>, proving the concrete public DTO survives admission.- let queued = drain_queued_turns_for_test(&crate::core::runtime::DispatchCtx::ambient(), thread_id, QueueLane::Followup).await;+ let queued = drain_queued_turns_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id,+ QueueLane::Followup,+ )+ .await;assert_eq!(queued.len(), 1);let queued = &queued[0];assert_eq!(queued.text, "defer this exact payload");@@ -222,15 +227,27 @@ async fn cancellation_discards_pending_lanes_before_a_replacement_turn() {.await.expect("replacement queue status should be available");assert_eq!(replacement.value["total"], 0);- assert!(drain_queued_turns_for_test(&crate::core::runtime::DispatchCtx::ambient(), thread_id, QueueLane::Followup)- .await- .is_empty());- assert!(drain_queued_turns_for_test(&crate::core::runtime::DispatchCtx::ambient(), thread_id, QueueLane::Steer)- .await- .is_empty());- assert!(drain_queued_turns_for_test(&crate::core::runtime::DispatchCtx::ambient(), thread_id, QueueLane::Collect)- .await- .is_empty());+ assert!(drain_queued_turns_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id,+ QueueLane::Followup+ )+ .await+ .is_empty());+ assert!(drain_queued_turns_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id,+ QueueLane::Steer+ )+ .await+ .is_empty());+ assert!(drain_queued_turns_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id,+ QueueLane::Collect+ )+ .await+ .is_empty());cancel_parked_turn(thread_id, &replacement_block).await;}@@ -455,7 +472,9 @@ async fn chat_done_is_published_only_after_the_in_flight_slot_is_released() {event.event == "chat_done" && event.request_id == request_id};- let held = crate::web_chat::ops::in_flight(&crate::core::runtime::DispatchCtx::ambient()).lock_owned().await;+ let held = crate::web_chat::ops::in_flight(&crate::core::runtime::DispatchCtx::ambient())+ .lock_owned()+ .await;block.release.notify_one();let early = timeout(Duration::from_millis(500), async {loop {