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
test(agent): add coverage for plan review, workflow, and session checkout
Steven Enamakel95b158d54341
diff --git a/crates/openhuman-core/src/agent/plan_review/tool_tests.rs b/crates/openhuman-core/src/agent/plan_review/tool_tests.rsindex 37dc3e50df..82e9c621f7 100644--- a/crates/openhuman-core/src/agent/plan_review/tool_tests.rs+++ b/crates/openhuman-core/src/agent/plan_review/tool_tests.rs@@ -31,6 +31,7 @@ async fn interactive_turn_parks_until_resolved() {// `plan_mode_is_inert_outside_plan_mode` below — so this thread must be// in Plan mode for the park to actually happen.crate::agent::tinyagents::run_mode::set_mode(+ &crate::core::runtime::DispatchCtx::ambient(),"t-int",tinyagents_harness::middleware::RunMode::Plan,);diff --git a/crates/openhuman-core/src/agent/tools/run_workflow_tests.rs b/crates/openhuman-core/src/agent/tools/run_workflow_tests.rsindex 79ec154735..e4528950cd 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,12 @@ 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(key.clone()).expect("first acquire");- let again = super::guard::acquire_await(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(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 +98,14 @@ 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(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("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("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 +173,15 @@ 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(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(key.clone()) }).await;+ 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(key.clone()) }).await;+ 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/agent/turn_origin_tests.rs b/crates/openhuman-core/src/agent/turn_origin_tests.rsindex 70ab8f7c96..dae8a7724f 100644--- a/crates/openhuman-core/src/agent/turn_origin_tests.rs+++ b/crates/openhuman-core/src/agent/turn_origin_tests.rs@@ -353,14 +353,14 @@ struct StateProbe;/// `scoped` answer as they do when nothing is scoped.#[tokio::test]async fn a_bare_origin_scope_is_invisible_to_every_other_reader() {- use crate::core::runtime::{current_slot, CoreContext};+ use crate::core::runtime::{slot_for, CoreContext, DispatchCtx};- let outside_slot = current_slot::<StateProbe>();+ let outside_slot = slot_for::<StateProbe>(&DispatchCtx::ambient());let outside_current = CoreContext::current();let (inside_slot, inside_current, inside_scoped, origin) =with_origin(AgentTurnOrigin::Cli, async {(- current_slot::<StateProbe>(),+ slot_for::<StateProbe>(&DispatchCtx::ambient()),CoreContext::current(),CoreContext::scoped(),current(),diff --git a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs b/crates/openhuman-core/src/web_chat/session_checkout_tests.rsindex 4cc68e2027..12e06dcff4 100644--- a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs+++ b/crates/openhuman-core/src/web_chat/session_checkout_tests.rs@@ -101,7 +101,7 @@ pub(super) fn host_seeded_with(config: &Config, marker: &str) -> OpenHumanSessio}async fn evict(thread_id: &str) {- thread_sessions()+ thread_sessions(&DispatchCtx::ambient()).lock_owned().await.remove(&key_for(&DispatchCtx::ambient(), thread_id));