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(core): cover headless marker in dispatch context
Steven Enamakelff17dcdfae49
diff --git a/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rs b/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rsindex 16c958cdcb..46ebcde989 100644--- a/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rs+++ b/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rs@@ -28,7 +28,12 @@ fn whoami(ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {.await.map_err(|e| e.to_string())?};- Ok(json!({ "bound": bound, "workspace": workspace, "spawned": spawned }))+ Ok(json!({+ "bound": bound,+ "workspace": workspace,+ "spawned": spawned,+ "headless_agent_chat": ctx.is_headless_agent_chat(),+ }))})}@@ -58,6 +63,7 @@ async fn handler_receives_the_context_the_caller_dispatched_with() {.expect("handler succeeds");assert_eq!(value["bound"], json!(true));assert_eq!(value["workspace"], json!("/tmp/ctx-probe-a"));+ assert_eq!(value["headless_agent_chat"], json!(false));assert_eq!(value["spawned"],json!("/tmp/ctx-probe-a"),@@ -65,6 +71,28 @@ async fn handler_receives_the_context_the_caller_dispatched_with() {);}+#[tokio::test]+async fn registered_dispatch_preserves_headless_marker_when_binding_scoped_core() {+ register_probe();+ let scoped = CoreContext::for_test(DomainSet::full(), Some("/tmp/ctx-probe-headless".into()));+ let value = CoreContext::scope(scoped, async {+ try_invoke_registered_rpc(+ DispatchCtx::unbound().with_headless_agent_chat(),+ "openhuman.ext_ctx_probe_whoami",+ Map::new(),+ )+ .await+ })+ .await+ .expect("dispatch task succeeds")+ .expect("probe is registered")+ .expect("probe handler succeeds");++ assert_eq!(value["bound"], json!(true));+ assert_eq!(value["workspace"], json!("/tmp/ctx-probe-headless"));+ assert_eq!(value["headless_agent_chat"], json!(true));+}+/// Two tenants dispatched at once, interleaving at an await point, each see only/// their own context: nothing in the dispatch carries one call's value to the/// other.