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: drop DispatchCtx from handler call sites in tests
Steven Enamakeld6432f4d8769
diff --git a/crates/openhuman-core/src/agent/orchestration/command_center/schemas_tests.rs b/crates/openhuman-core/src/agent/orchestration/command_center/schemas_tests.rsindex 798debc8a4..a15dc65afa 100644--- a/crates/openhuman-core/src/agent/orchestration/command_center/schemas_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/command_center/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -59,7 +58,7 @@ fn params(value: Value) -> Map<String, Value> {#[tokio::test]async fn listing_work_on_an_empty_ledger_answers() {- let v = with_scratch_workspace(|| handle_agent_work_list(DispatchCtx::process_default(), params(serde_json::json!({ "limit": 5 }))))+ let v = with_scratch_workspace(|| handle_agent_work_list(params(serde_json::json!({ "limit": 5 })))).await.expect("an empty ledger lists as an empty view");assert_eq!(v["total"], 0, "{v}");@@ -71,12 +70,12 @@ async fn listing_work_on_an_empty_ledger_answers() {#[tokio::test]async fn control_requires_a_run_id_and_action() {- let err = with_scratch_workspace(|| handle_agent_work_control(DispatchCtx::process_default(), Map::new()))+ let err = with_scratch_workspace(|| handle_agent_work_control(Map::new())).await.unwrap_err();assert_eq!(err, "missing required param: runId");let err = with_scratch_workspace(|| {- handle_agent_work_control(DispatchCtx::process_default(), params(serde_json::json!({ "runId": "r1" })))+ handle_agent_work_control(params(serde_json::json!({ "runId": "r1" })))}).await.unwrap_err();@@ -86,7 +85,7 @@ async fn control_requires_a_run_id_and_action() {#[tokio::test]async fn control_refuses_an_unknown_action() {let err = with_scratch_workspace(|| {- handle_agent_work_control(DispatchCtx::process_default(), params(+ handle_agent_work_control(params(serde_json::json!({ "runId": "r1", "action": "explode" }),))})@@ -98,7 +97,7 @@ async fn control_refuses_an_unknown_action() {#[tokio::test]async fn control_of_an_unknown_run_is_an_error_not_a_panic() {let err = with_scratch_workspace(|| {- handle_agent_work_control(DispatchCtx::process_default(), params(+ handle_agent_work_control(params(serde_json::json!({ "runId": "no-such-run", "action": "stop", "reason": "test" }),))})diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rsindex 80e2f81380..fedaf2f641 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet, Mode};use crate::tools::toolpacks::ToolGroups;@@ -128,7 +127,7 @@ async fn control(function: &str, task: &str) -> serde_json::Value {if function == "steer" {params.insert("message".into(), serde_json::json!("ownership regression"));}- (controller.handler)(DispatchCtx::process_default(), params)+ (controller.handler)(params).await.expect("control response")}@@ -147,7 +146,6 @@ async fn dispatched_control(function: &str, task: &str) -> Result<serde_json::Vaparams["message"] = serde_json::json!("scoped dispatch regression");}crate::core::invoke::invoke_method(- DispatchCtx::process_default(),crate::core::invoke::default_state(),&format!("openhuman.subagent_{function}"),params,@@ -215,7 +213,6 @@ async fn saas_dispatch_exposes_only_the_callers_detached_worker_controls() {assert!(crate::core::all::schema_for_rpc_method(&method).is_none());assert!(crate::core::invoke::invoke_method(- DispatchCtx::process_default(),crate::core::invoke::default_state(),&method,serde_json::json!({}),diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rsindex 7b8b2d464b..2d9708d43c 100644--- a/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -31,7 +30,7 @@ async fn cancel_unknown_task_is_a_noop_false() {let _lock = crate::config::TEST_ENV_LOCK.lock().await;let mut params = Map::new();params.insert("taskId".into(), json!("sub-does-not-exist"));- let out = handle_subagent_cancel(DispatchCtx::process_default(), params).await.expect("handler ok");+ let out = handle_subagent_cancel(params).await.expect("handler ok");// Outcome wraps the payload under `data`.let cancelled = out.get("data")@@ -126,7 +125,7 @@ async fn cancel_of_a_finished_run_reports_its_outcome_and_rewrites_nothing() {let mut params = Map::new();params.insert("taskId".into(), json!(task_id));- let out = handle_subagent_cancel(DispatchCtx::process_default(), params).await.expect("handler ok");+ let out = handle_subagent_cancel(params).await.expect("handler ok");assert_eq!(field(&out, "cancelled"), Some(json!(false)), "{task_id}");assert_eq!(field(&out, "outcome"), Some(json!(outcome)), "{task_id}");}@@ -143,7 +142,7 @@ async fn steer_unknown_task_is_a_noop_false() {let mut params = Map::new();params.insert("taskId".into(), json!("sub-does-not-exist"));params.insert("message".into(), json!("redirect"));- let out = handle_subagent_steer(DispatchCtx::process_default(), params).await.expect("handler ok");+ let out = handle_subagent_steer(params).await.expect("handler ok");let data = out.get("data").unwrap_or(&out);assert_eq!(data.get("steered").and_then(Value::as_bool), Some(false));assert_eq!(data.get("reason").and_then(Value::as_str), Some("unknown"));diff --git a/crates/openhuman-core/src/agent/orchestration/worktree_schemas_tests.rs b/crates/openhuman-core/src/agent/orchestration/worktree_schemas_tests.rsindex 9529093c94..e2684b2ab3 100644--- a/crates/openhuman-core/src/agent/orchestration/worktree_schemas_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/worktree_schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use std::process::Command;use tinyagents_harness::workspace::{create_git_worktree, GitWorktreeBaseRef, GitWorktreeStatus};@@ -92,7 +91,7 @@ async fn handle_list_degrades_for_non_git_action_dir() {std::env::set_var("OPENHUMAN_ACTION_DIR", &action_dir);}- let out = handle_list(DispatchCtx::process_default(), Map::new())+ let out = handle_list(Map::new()).await.expect("list handler degrades cleanly for a non-git action_dir");// `into_cli_compatible_json` returns the bare value when there are nodiff --git a/crates/openhuman-core/src/agent/schemas_tests.rs b/crates/openhuman-core/src/agent/schemas_tests.rsindex cc6daacc75..f1233455df 100644--- a/crates/openhuman-core/src/agent/schemas_tests.rs+++ b/crates/openhuman-core/src/agent/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use crate::core::TypeSchema;use serde_json::json;@@ -81,7 +80,7 @@ fn deserialize_params_and_helpers_cover_success_and_failure_paths() {#[tokio::test]async fn graph_topologies_handler_exports_structural_reports() {- let result = handle_graph_topologies(DispatchCtx::process_default(), Map::new())+ let result = handle_graph_topologies(Map::new()).await.expect("topology export is infallible");let graphs = result@@ -127,7 +126,7 @@ async fn graph_topologies_handler_exports_structural_reports() {#[tokio::test]async fn reload_and_definition_handlers_cover_missing_registry_paths() {- let reload = handle_reload_definitions(DispatchCtx::process_default(), Map::new())+ let reload = handle_reload_definitions(Map::new()).await.expect("reload handler should always succeed");assert_eq!(reload.get("status").and_then(Value::as_str), Some("noop"));@@ -137,13 +136,13 @@ async fn reload_and_definition_handlers_cover_missing_registry_paths() {.unwrap().contains("Restart"));- let list_result = handle_list_definitions(DispatchCtx::process_default(), Map::new()).await;+ let list_result = handle_list_definitions(Map::new()).await;match list_result {Ok(value) => assert!(value.get("definitions").and_then(Value::as_array).is_some()),Err(err) => assert!(err.contains("AgentDefinitionRegistry not initialised")),}- let get_err = handle_get_definition(DispatchCtx::process_default(), Map::from_iter([(+ let get_err = handle_get_definition(Map::from_iter([("id".into(),Value::String("__definitely_missing_definition__".into()),)]))@@ -157,7 +156,7 @@ async fn reload_and_definition_handlers_cover_missing_registry_paths() {#[tokio::test]async fn triage_handler_rejects_unknown_source_and_to_json_maps_outcome() {- let err = handle_triage_evaluate(DispatchCtx::process_default(), Map::from_iter([+ let err = handle_triage_evaluate(Map::from_iter([("source".into(), Value::String("__unknown_source__".into())),("display_label".into(), Value::String("lbl".into())),("payload".into(), json!({})),diff --git a/crates/openhuman-core/src/agent/session_db/schemas_tests.rs b/crates/openhuman-core/src/agent/session_db/schemas_tests.rsindex df14a1c1d9..1fa753d947 100644--- a/crates/openhuman-core/src/agent/session_db/schemas_tests.rs+++ b/crates/openhuman-core/src/agent/session_db/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -103,7 +102,7 @@ fn params(value: Value) -> Map<String, Value> {#[tokio::test]async fn listing_an_empty_ledger_returns_no_runs() {- let value = with_scratch_workspace(|| handle_run_ledger_list(DispatchCtx::process_default(), Map::new()))+ let value = with_scratch_workspace(|| handle_run_ledger_list(Map::new())).await.expect("list answers on an empty ledger");let text = value.to_string();@@ -114,7 +113,7 @@ async fn listing_an_empty_ledger_returns_no_runs() {#[tokio::test]async fn listing_rejects_malformed_params() {let err = with_scratch_workspace(|| {- handle_run_ledger_list(DispatchCtx::process_default(), params(serde_json::json!({ "limit": "many" })))+ handle_run_ledger_list(params(serde_json::json!({ "limit": "many" })))}).await.expect_err("a non-numeric limit is refused");@@ -124,7 +123,7 @@ async fn listing_rejects_malformed_params() {#[tokio::test]async fn getting_an_unknown_run_answers_null() {let value = with_scratch_workspace(|| {- handle_run_ledger_get(DispatchCtx::process_default(), params(serde_json::json!({ "id": "no-such-run" })))+ handle_run_ledger_get(params(serde_json::json!({ "id": "no-such-run" })))}).await.expect("get answers for an unknown id");@@ -133,7 +132,7 @@ async fn getting_an_unknown_run_answers_null() {#[tokio::test]async fn getting_a_run_requires_an_id() {- let err = with_scratch_workspace(|| handle_run_ledger_get(DispatchCtx::process_default(), Map::new()))+ let err = with_scratch_workspace(|| handle_run_ledger_get(Map::new())).await.expect_err("id is required");assert!(err.contains("missing required param: id"), "{err}");@@ -142,7 +141,7 @@ async fn getting_a_run_requires_an_id() {#[tokio::test]async fn events_of_an_unknown_run_are_empty() {let value = with_scratch_workspace(|| {- handle_run_ledger_events(DispatchCtx::process_default(), params(serde_json::json!({ "runId": "no-such-run" })))+ handle_run_ledger_events(params(serde_json::json!({ "runId": "no-such-run" })))}).await.expect("events answer for an unknown run");@@ -152,7 +151,7 @@ async fn events_of_an_unknown_run_are_empty() {#[tokio::test]async fn events_reject_malformed_params() {- let err = with_scratch_workspace(|| handle_run_ledger_events(DispatchCtx::process_default(), Map::new()))+ let err = with_scratch_workspace(|| handle_run_ledger_events(Map::new())).await.expect_err("runId is required");assert!(err.contains("invalid run ledger events params"), "{err}");diff --git a/crates/openhuman-core/src/agent/session_import/schemas_tests.rs b/crates/openhuman-core/src/agent/session_import/schemas_tests.rsindex 1b051b77a6..aa2560a2da 100644--- a/crates/openhuman-core/src/agent/session_import/schemas_tests.rs+++ b/crates/openhuman-core/src/agent/session_import/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -23,7 +22,7 @@ async fn handler_runs_dry_against_explicit_workspace() {Value::String(tmp.path().to_string_lossy().to_string()),);- let result = handle_session_import_run(DispatchCtx::process_default(), params).await.expect("handler ok");+ let result = handle_session_import_run(params).await.expect("handler ok");assert_eq!(result["dry_run"], Value::Bool(true));assert_eq!(result["sources"]["sessions_db"], Value::Bool(false));assert_eq!(result["imports"], json!([]));@@ -40,7 +39,7 @@ async fn dry_run_reports_the_legacy_sources_a_workspace_holds() {Value::String(tmp.path().to_string_lossy().to_string()),);- let result = handle_session_import_run(DispatchCtx::process_default(), params).await.expect("handler ok");+ let result = handle_session_import_run(params).await.expect("handler ok");assert_eq!(result["sources"]["session_raw"], Value::Bool(true));assert_eq!(result["sources"]["turn_states"], Value::Bool(false));}@@ -49,7 +48,7 @@ async fn dry_run_reports_the_legacy_sources_a_workspace_holds() {async fn handler_rejects_invalid_params() {let mut params = Map::new();params.insert("dry_run".into(), Value::String("yes".into())); // wrong type- let err = handle_session_import_run(DispatchCtx::process_default(), params).await.unwrap_err();+ let err = handle_session_import_run(params).await.unwrap_err();assert!(err.contains("invalid params"), "{err}");}@@ -75,7 +74,7 @@ async fn run_import(workspace: Option<&std::path::Path>) -> Value {Value::String(workspace.to_string_lossy().to_string()),);}- let result = handle_session_import_run(DispatchCtx::process_default(), params).await;+ let result = handle_session_import_run(params).await;result.expect("the import handler answers even with nothing to import")}diff --git a/crates/openhuman-core/src/agent/tinyagents/replay/schemas_tests.rs b/crates/openhuman-core/src/agent/tinyagents/replay/schemas_tests.rsindex 6d92b925c2..2759af9f50 100644--- a/crates/openhuman-core/src/agent/tinyagents/replay/schemas_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/replay/schemas_tests.rs@@ -1,8 +1,7 @@-use crate::core::runtime::DispatchCtx;use super::*;#[tokio::test]async fn run_events_rejects_missing_run_id() {- let err = handle_run_events(DispatchCtx::process_default(), Map::new()).await.unwrap_err();+ let err = handle_run_events(Map::new()).await.unwrap_err();assert!(err.contains("invalid params"), "{err}");}diff --git a/crates/openhuman-core/src/channels/providers/relay/schemas_tests.rs b/crates/openhuman-core/src/channels/providers/relay/schemas_tests.rsindex 5757dd1f5e..c696065b47 100644--- a/crates/openhuman-core/src/channels/providers/relay/schemas_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -34,7 +33,7 @@ fn the_controller_is_registered() {async fn malformed_params_are_refused_before_any_work() {let mut params = Map::new();params.insert("channel".into(), Value::String("telegram".into()));- let err = handle_relay_inbound(DispatchCtx::process_default(), params)+ let err = handle_relay_inbound(params).await.expect_err("missing fields");assert!(err.contains("invalid params"), "{err}");diff --git a/crates/openhuman-core/src/commands/ops_tests.rs b/crates/openhuman-core/src/commands/ops_tests.rsindex 920be77587..565146af93 100644--- a/crates/openhuman-core/src/commands/ops_tests.rs+++ b/crates/openhuman-core/src/commands/ops_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use serde_json::json;@@ -65,7 +64,7 @@ async fn commands_list_always_includes_every_builtin_even_if_catalogs_fail() {// end (no config override) — the important assertion is that whatever// they do, every builtin is still present and the call itself never// errors.- let outcome = commands_list(DispatchCtx::process_default()).await.expect("commands_list must not fail");+ let outcome = commands_list().await.expect("commands_list must not fail");let ids: Vec<&str> = outcome.value.commandsdiff --git a/crates/openhuman-core/src/commands/schemas_tests.rs b/crates/openhuman-core/src/commands/schemas_tests.rsindex 890ab4956c..7b9179a92c 100644--- a/crates/openhuman-core/src/commands/schemas_tests.rs+++ b/crates/openhuman-core/src/commands/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -24,7 +23,7 @@ fn list_schema_has_no_required_inputs() {async fn handle_list_returns_every_builtin() {use serde_json::Map;- let value = handle_list(DispatchCtx::process_default(), Map::new())+ let value = handle_list(Map::new()).await.expect("handler must not fail");// Bare (no logs) or wrapped ({"result": ...}) — read through both.diff --git a/crates/openhuman-core/src/config/schemas/controllers_tests.rs b/crates/openhuman-core/src/config/schemas/controllers_tests.rsindex 5abb0facbd..6f32ee1f30 100644--- a/crates/openhuman-core/src/config/schemas/controllers_tests.rs+++ b/crates/openhuman-core/src/config/schemas/controllers_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;// ── get_data_paths user scoping (#4950) ─────────────────────@@ -15,7 +14,7 @@ async fn handle_get_data_paths_scopes_to_explicit_user_id() {Value::String("clear-me-4950".to_string()),);- let value = handle_get_data_paths(DispatchCtx::process_default(), params).await.unwrap();+ let value = handle_get_data_paths(params).await.unwrap();// `get_data_paths_for_user` attaches a log, so the outcome is wrapped as// `{ "result": <paths>, "logs": [...] }`.let current = valuediff --git a/crates/openhuman-core/src/config/schemas_tests.rs b/crates/openhuman-core/src/config/schemas_tests.rsindex 3d1e5fc68e..a845b7d431 100644--- a/crates/openhuman-core/src/config/schemas_tests.rs+++ b/crates/openhuman-core/src/config/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::schema_defs::schemas;use super::*;@@ -307,7 +306,7 @@ async fn handle_get_autonomy_settings_returns_current_value() {.await.expect("seed");- let out = super::handle_get_autonomy_settings(DispatchCtx::process_default(), serde_json::Map::new())+ let out = super::handle_get_autonomy_settings(serde_json::Map::new()).await.expect("handler");// into_cli_compatible_json wraps data under "result" when logs are present.@@ -330,7 +329,7 @@ async fn handle_update_autonomy_settings_rejects_invalid_value() {let mut params = serde_json::Map::new();params.insert("max_actions_per_hour".into(), serde_json::json!(0));- let err = super::handle_update_autonomy_settings(DispatchCtx::process_default(), params)+ let err = super::handle_update_autonomy_settings(params).await.unwrap_err();assert!(err.contains("at least 1"), "got: {err}");@@ -366,7 +365,7 @@ async fn handle_get_agent_paths_returns_action_workspace_and_projects() {std::env::set_var("OPENHUMAN_WORKSPACE", tmp.path());}- let out = super::handle_get_agent_paths(DispatchCtx::process_default(), serde_json::Map::new())+ let out = super::handle_get_agent_paths(serde_json::Map::new()).await.expect("get_agent_paths handler must succeed");// into_cli_compatible_json wraps data under "result" when logs are present.@@ -419,7 +418,7 @@ async fn handle_get_agent_paths_reflects_openhuman_action_dir_env_override() {std::env::set_var("OPENHUMAN_ACTION_DIR", &custom_actions);}- let out = super::handle_get_agent_paths(DispatchCtx::process_default(), serde_json::Map::new())+ let out = super::handle_get_agent_paths(serde_json::Map::new()).await.expect("get_agent_paths handler must succeed");let inner = out.get("result").unwrap_or(&out);diff --git a/crates/openhuman-core/src/core/all_extensions_tests.rs b/crates/openhuman-core/src/core/all_extensions_tests.rsindex 5c7fbd87e1..3a579b9824 100644--- a/crates/openhuman-core/src/core/all_extensions_tests.rs+++ b/crates/openhuman-core/src/core/all_extensions_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use serde_json::Map;use super::*;@@ -6,7 +5,7 @@ use super::*;// ── Controller extensions (crates above the core) ──────────────────────────fn ext_controller(namespace: &'static str, function: &'static str) -> RegisteredController {- fn handler(_ctx: DispatchCtx, _params: Map<String, serde_json::Value>) -> ControllerFuture {+ fn handler(_params: Map<String, serde_json::Value>) -> ControllerFuture {Box::pin(async { Ok(serde_json::json!({"ext": true})) })}RegisteredController {@@ -39,7 +38,7 @@ async fn registry_extension_is_visible_to_every_lookup_and_dispatches() {Some("Registry extension probe."));- let result = try_in(DispatchCtx::ambient(), "openhuman.ext_probe_ping", Map::new())_ping", Map::new())+ let result = try_invoke_registered_rpc("openhuman.ext_probe_ping", Map::new()).await.expect("extension method is dispatchable").expect("handler succeeds");@@ -97,7 +96,7 @@ async fn registry_extension_is_gated_by_its_domain_group() {let ctx = CoreContext::for_test(domains, None);let hidden = CoreContext::scope(ctx, async {(- try_in(DispatchCtx::ambient(), "openhuman.ext_gate_ping", Map::new())_ping", Map::new())+ try_invoke_registered_rpc("openhuman.ext_gate_ping", Map::new()).await.is_none(),schema_for_rpc_method("openhuman.ext_gate_ping").is_none(),diff --git a/crates/openhuman-core/src/core/dispatch_tests.rs b/crates/openhuman-core/src/core/dispatch_tests.rsindex e16d125e65..ef01dddf26 100644--- a/crates/openhuman-core/src/core/dispatch_tests.rs+++ b/crates/openhuman-core/src/core/dispatch_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use crate::config::test_env::EnvVarGuard;use serde_json::json;@@ -11,7 +10,7 @@ fn test_state() -> AppState {#[tokio::test]async fn dispatch_core_ping_returns_ok_true() {- let out = dispatch(DispatchCtx::process_default(), test_state(), "core.ping", json!({}))+ let out = dispatch(test_state(), "core.ping", json!({})).await.expect("core.ping should succeed");assert_eq!(out, json!({ "ok": true }));@@ -19,7 +18,7 @@ async fn dispatch_core_ping_returns_ok_true() {#[tokio::test]async fn dispatch_core_version_returns_state_version() {- let out = dispatch(DispatchCtx::process_default(), test_state(), "core.version", json!({}))+ let out = dispatch(test_state(), "core.version", json!({})).await.expect("core.version should succeed");assert_eq!(out, json!({ "version": "9.9.9-test" }));@@ -28,7 +27,7 @@ async fn dispatch_core_version_returns_state_version() {#[tokio::test]async fn dispatch_core_ignores_params() {// Params must be tolerated even when the method takes none.- let out = dispatch(DispatchCtx::process_default(), test_state(), "core.ping", json!({ "extra": 1 }))+ let out = dispatch(test_state(), "core.ping", json!({ "extra": 1 })).await.expect("core.ping should ignore extra params");assert_eq!(out, json!({ "ok": true }));@@ -40,7 +39,7 @@ async fn dispatch_rewrites_legacy_alias_before_lookup() {// alias table. Going through the dispatcher must rewrite it and// route successfully to Tier 1 instead of falling through to the// unknown-method error path.- let out = dispatch(DispatchCtx::process_default(), test_state(), "openhuman.ping", json!({}))+ let out = dispatch(test_state(), "openhuman.ping", json!({})).await.expect("legacy alias openhuman.ping must resolve to core.ping");assert_eq!(out, json!({ "ok": true }));@@ -48,7 +47,7 @@ async fn dispatch_rewrites_legacy_alias_before_lookup() {#[tokio::test]async fn dispatch_unknown_method_returns_error() {- let err = dispatch(DispatchCtx::process_default(), test_state(), "does.not.exist", json!({}))+ let err = dispatch(test_state(), "does.not.exist", json!({})).await.expect_err("unknown methods must error");assert!(err.contains("unknown method"));@@ -57,7 +56,7 @@ async fn dispatch_unknown_method_returns_error() {#[tokio::test]async fn dispatch_empty_method_returns_unknown_method_error() {- let err = dispatch(DispatchCtx::process_default(), test_state(), "", json!({}))+ let err = dispatch(test_state(), "", json!({})).await.expect_err("empty method must error");assert!(err.contains("unknown method"));@@ -69,7 +68,7 @@ async fn dispatch_delegates_to_tier2_for_domain_method() {// it must succeed and return a policy object.let workspace = tempfile::tempdir().expect("temporary workspace");let _workspace_env = EnvVarGuard::workspace_async(workspace.path()).await;- let out = dispatch(DispatchCtx::process_default(), test_state(), "openhuman.security_policy_info", json!({}))+ let out = dispatch(test_state(), "openhuman.security_policy_info", json!({})).await.expect("security_policy_info should route via tier 2");// With logs present, payload is wrapped as { result, logs }.@@ -107,7 +106,7 @@ fn try_core_dispatch_version_reflects_appstate() {#[tokio::test]async fn dispatch_legacy_ping_rewrites_and_succeeds() {- let out = dispatch(DispatchCtx::process_default(), test_state(), "openhuman.ping", json!({}))+ let out = dispatch(test_state(), "openhuman.ping", json!({})).await.expect("openhuman.ping should be rewritten to core.ping and succeed");assert_eq!(out, json!({ "ok": true }));@@ -143,7 +142,7 @@ fn is_known_probe_method_matches_allow_list_exactly() {#[cfg(feature = "channels")]async fn dispatch_dotted_channel_list_aliases_route_to_registry() {for method in ["channels.list", "openhuman.channels.list"] {- let out = dispatch(DispatchCtx::process_default(), test_state(), method, json!({}))+ let out = dispatch(test_state(), method, json!({})).await.unwrap_or_else(|err| panic!("{method} should route via channels_list: {err}"));assert!(@@ -168,7 +167,7 @@ async fn dispatch_probe_method_still_returns_unknown_method_error() {// Allow-listed probe names must not be silently "handled" — the caller// still gets a method-not-found error. Only the Sentry severity (in the// transport layer) changes; the dispatch contract is unchanged.- let err = dispatch(DispatchCtx::process_default(), test_state(), "rpc.discover", json!({}))+ let err = dispatch(test_state(), "rpc.discover", json!({})).await.expect_err("probe methods are still unknown to the dispatcher");assert_eq!(unknown_method_name(&err), Some("rpc.discover"));diff --git a/crates/openhuman-core/src/core/invoke_tests.rs b/crates/openhuman-core/src/core/invoke_tests.rsindex 0a6214aafa..30201389b4 100644--- a/crates/openhuman-core/src/core/invoke_tests.rs+++ b/crates/openhuman-core/src/core/invoke_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use serde_json::json;use super::super::session_expiry::is_session_expired_error;@@ -8,7 +7,7 @@ use super::{#[tokio::test]async fn invoke_health_snapshot_via_registry() {- let result = invoke_method(DispatchCtx::ambient(), default_state(), "openhuman.health_snapshot", json!({}))+ let result = invoke_method(default_state(), "openhuman.health_snapshot", json!({})).await.expect("health snapshot should succeed");assert!(result.get("result").is_some());@@ -16,7 +15,7 @@ async fn invoke_health_snapshot_via_registry() {#[tokio::test]async fn invoke_encrypt_secret_missing_required_param_fails_validation() {- let err = invoke_method(DispatchCtx::ambient(), default_state(), "openhuman.encrypt_secret", json!({}))+ let err = invoke_method(default_state(), "openhuman.encrypt_secret", json!({})).await.expect_err("missing plaintext should fail");assert!(err.contains("missing required param 'plaintext'"));@@ -25,7 +24,6 @@ async fn invoke_encrypt_secret_missing_required_param_fails_validation() {#[tokio::test]async fn invoke_doctor_models_rejects_unknown_param() {let err = invoke_method(- DispatchCtx::process_default(),default_state(),"openhuman.doctor_models",json!({ "invalid": true }),@@ -60,7 +58,7 @@ async fn gated_method_is_unknown_at_transport_even_with_malformed_params() {let ctx = CoreContext::for_test(DomainSet::harness(), None);let err = CoreContext::scope(ctx,- invoke_method(DispatchCtx::ambient(), default_state(), &gated_method, params.clone()),+ invoke_method(default_state(), &gated_method, params.clone()),).await.expect_err("gated flows method must error under harness()");@@ -78,7 +76,6 @@ async fn gated_method_is_unknown_at_transport_even_with_malformed_params() {#[tokio::test]async fn invoke_config_get_runtime_flags_via_registry() {let result = invoke_method(- DispatchCtx::process_default(),default_state(),"openhuman.config_get_runtime_flags",json!({}),@@ -90,7 +87,7 @@ async fn invoke_config_get_runtime_flags_via_registry() {#[tokio::test]async fn invoke_auth_store_session_missing_token_fails_validation() {- let err = invoke_method(DispatchCtx::ambient(), default_state(), "openhuman.auth_store_session", json!({}))+ let err = invoke_method(default_state(), "openhuman.auth_store_session", json!({})).await.expect_err("missing token should fail");assert!(err.contains("missing required param 'token'"));@@ -99,7 +96,6 @@ async fn invoke_auth_store_session_missing_token_fails_validation() {#[tokio::test]async fn invoke_service_status_rejects_unknown_param() {let err = invoke_method(- DispatchCtx::process_default(),default_state(),"openhuman.service_status",json!({ "x": 1 }),@@ -114,7 +110,7 @@ async fn invoke_memory_init_accepts_empty_params() {// jwt_token is optional (accepted for backward compat but ignored).// The call may still fail for workspace reasons in test, but must NOT// fail with a missing-param error for jwt_token.- let result = invoke_method(DispatchCtx::ambient(), default_state(), "openhuman.memory_init", json!({})).await;+ let result = invoke_method(default_state(), "openhuman.memory_init", json!({})).await;if let Err(ref e) = result {assert!(!e.contains("missing required param") || !e.contains("jwt_token"),@@ -126,7 +122,6 @@ async fn invoke_memory_init_accepts_empty_params() {#[tokio::test]async fn invoke_memory_learn_rejects_unknown_param() {let err = invoke_method(- DispatchCtx::process_default(),default_state(),"openhuman.memory_learn",json!({ "text": "prefers tea", "extra": true }),@@ -139,7 +134,6 @@ async fn invoke_memory_learn_rejects_unknown_param() {#[tokio::test]async fn invoke_memory_recall_missing_question_fails() {let err = invoke_method(- DispatchCtx::process_default(),default_state(),"openhuman.memory_recall",json!({ "limit": 3 }),@@ -152,7 +146,6 @@ async fn invoke_memory_recall_missing_question_fails() {#[tokio::test]async fn invoke_retired_v1_memory_method_is_unknown() {let err = invoke_method(- DispatchCtx::process_default(),default_state(),"openhuman.memory_recall_memories",json!({ "namespace": "team" }),@@ -192,7 +185,6 @@ async fn invoke_method_rejects_array_params_for_registered_method() {// Passing an array must fail with a clear "invalid params" error// instead of silently calling the handler with no args.let err = invoke_method(- DispatchCtx::process_default(),default_state(),"openhuman.health_snapshot",json!([1, 2, 3]),@@ -205,7 +197,7 @@ async fn invoke_method_rejects_array_params_for_registered_method() {#[tokio::test]async fn invoke_method_rejects_string_params_for_registered_method() {- let err = invoke_method(DispatchCtx::ambient(), default_state(), "openhuman.health_snapshot", json!("oops"))+ let err = invoke_method(default_state(), "openhuman.health_snapshot", json!("oops")).await.expect_err("string params should be rejected");assert!(err.contains("invalid params"));@@ -215,7 +207,7 @@ async fn invoke_method_rejects_string_params_for_registered_method() {#[tokio::test]async fn invoke_method_accepts_null_params_for_registered_method() {// JSON-RPC 2.0 allows omitting params; null must be treated like {}.- let result = invoke_method(DispatchCtx::ambient(), default_state(), "openhuman.health_snapshot", json!(null)).await;+ let result = invoke_method(default_state(), "openhuman.health_snapshot", json!(null)).await;// Call should succeed or fail for domain reasons — but must NOT// fail with the "invalid params" shape error.if let Err(e) = result {@@ -228,7 +220,7 @@ async fn invoke_method_accepts_null_params_for_registered_method() {#[tokio::test]async fn invoke_method_unknown_method_returns_unknown_error() {- let err = invoke_method(DispatchCtx::ambient(), default_state(), "openhuman.totally_made_up_xyz", json!({}))+ let err = invoke_method(default_state(), "openhuman.totally_made_up_xyz", json!({})).await.expect_err("unknown methods must error");assert!(err.contains("unknown method"));@@ -237,7 +229,7 @@ async fn invoke_method_unknown_method_returns_unknown_error() {#[tokio::test]async fn invoke_method_core_ping_via_tier1() {// core.* methods aren't in the registry; they route through tier 1.- let result = invoke_method(DispatchCtx::ambient(), default_state(), "core.ping", json!({}))+ let result = invoke_method(default_state(), "core.ping", json!({})).await.expect("core.ping should succeed via tier 1");assert_eq!(result, json!({ "ok": true }));@@ -248,7 +240,7 @@ async fn invoke_method_core_version_via_tier1_reflects_state() {let state = super::AppState {core_version: "0.0.1-abc".into(),};- let result = invoke_method(DispatchCtx::ambient(), state, "core.version", json!({}))+ let result = invoke_method(state, "core.version", json!({})).await.expect("core.version should succeed");assert_eq!(result, json!({ "version": "0.0.1-abc" }));diff --git a/crates/openhuman-core/src/core/subsystem/schemas_tests.rs b/crates/openhuman-core/src/core/subsystem/schemas_tests.rsindex 0e52c11ee9..3568451a08 100644--- a/crates/openhuman-core/src/core/subsystem/schemas_tests.rs+++ b/crates/openhuman-core/src/core/subsystem/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -24,7 +23,7 @@ fn schemas_and_controllers_line_up() {#[tokio::test]async fn handler_returns_a_subsystems_array_containing_the_memory_slot() {- let value = handle_status(DispatchCtx::process_default(), Map::new()).await.expect("handler succeeds");+ let value = handle_status(Map::new()).await.expect("handler succeeds");let rows = value["subsystems"].as_array().expect("array");assert_eq!(rows.len(), 1);assert_eq!(rows[0]["slot"], "memory");diff --git a/crates/openhuman-core/src/desktop/control/schemas_tests.rs b/crates/openhuman-core/src/desktop/control/schemas_tests.rsindex 2ea3528105..992c0de83b 100644--- a/crates/openhuman-core/src/desktop/control/schemas_tests.rs+++ b/crates/openhuman-core/src/desktop/control/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use crate::core::runtime::context::CoreContext;use crate::core::runtime::DomainSet;@@ -37,7 +36,7 @@ fn scoped_context(computer: bool) -> (tempfile::TempDir, std::sync::Arc<CoreContasync fn pending_lists_actions_while_the_computer_component_is_on() {let (_dir, context) = scoped_context(true);CoreContext::scope(context, async {- let value = (controller("pending").handler)(DispatchCtx::process_default(), Map::new()).await.unwrap();+ let value = (controller("pending").handler)(Map::new()).await.unwrap();assert!(value.is_array());}).await;@@ -48,7 +47,7 @@ async fn every_desktop_controller_answers_component_disabled_when_computer_is_oflet (_dir, context) = scoped_context(false);CoreContext::scope(context, async {for function in ["status", "probe", "pending"] {- let error = (controller(function).handler)(DispatchCtx::process_default(), Map::new())+ let error = (controller(function).handler)(Map::new()).await.unwrap_err();assert!(@@ -58,14 +57,14 @@ async fn every_desktop_controller_answers_component_disabled_when_computer_is_of}let mut params = Map::new();params.insert("enabled".to_owned(), Value::Bool(true));- let error = (controller("set_enabled").handler)(DispatchCtx::process_default(), params)+ let error = (controller("set_enabled").handler)(params).await.unwrap_err();assert!(error.contains("COMPONENT_DISABLED:computer"), "{error}");let mut params = Map::new();params.insert("confirmation_id".to_owned(), Value::String("id".to_owned()));params.insert("approve".to_owned(), Value::Bool(true));- let error = (controller("confirm").handler)(DispatchCtx::process_default(), params).await.unwrap_err();+ let error = (controller("confirm").handler)(params).await.unwrap_err();assert!(error.contains("COMPONENT_DISABLED:computer"), "{error}");}).await;@@ -81,7 +80,7 @@ async fn malformed_controller_inputs_fail_before_loading_config_or_acting() {let mut params = Map::new();params.insert("enabled".to_owned(), invalid);assert_eq!(- (controller("set_enabled").handler)(DispatchCtx::process_default(), params)+ (controller("set_enabled").handler)(params).await.unwrap_err(),"enabled must be a boolean"@@ -91,14 +90,14 @@ async fn malformed_controller_inputs_fail_before_loading_config_or_acting() {params.insert("confirmation_id".to_owned(), Value::String(String::new()));params.insert("approve".to_owned(), Value::Bool(true));assert_eq!(- (controller("confirm").handler)(DispatchCtx::process_default(), params).await.unwrap_err(),+ (controller("confirm").handler)(params).await.unwrap_err(),"confirmation_id is required");let mut params = Map::new();params.insert("confirmation_id".to_owned(), Value::String("id".to_owned()));params.insert("approve".to_owned(), Value::String("yes".to_owned()));assert_eq!(- (controller("confirm").handler)(DispatchCtx::process_default(), params).await.unwrap_err(),+ (controller("confirm").handler)(params).await.unwrap_err(),"approve must be a boolean");}@@ -112,16 +111,16 @@ async fn controllers_use_scoped_config_for_disabled_desktop_and_reject_unknown_clet context = CoreContext::for_test_with_config(DomainSet::full(), config);CoreContext::scope(context, async {- let status = (controller("status").handler)(DispatchCtx::process_default(), Map::new()).await.unwrap();+ let status = (controller("status").handler)(Map::new()).await.unwrap();assert_eq!(status["enabled"], false);- let probe = (controller("probe").handler)(DispatchCtx::process_default(), Map::new()).await.unwrap();+ let probe = (controller("probe").handler)(Map::new()).await.unwrap();assert_eq!(probe["ok"], false);assert!(probe["reason"].as_str().unwrap().contains("disabled"));let mut params = Map::new();params.insert("enabled".to_owned(), Value::Bool(false));- let disabled = (controller("set_enabled").handler)(DispatchCtx::process_default(), params).await.unwrap();+ let disabled = (controller("set_enabled").handler)(params).await.unwrap();assert_eq!(disabled["enabled"], false);let mut params = Map::new();@@ -130,7 +129,7 @@ async fn controllers_use_scoped_config_for_disabled_desktop_and_reject_unknown_cValue::String("missing".to_owned()),);params.insert("approve".to_owned(), Value::Bool(true));- let error = (controller("confirm").handler)(DispatchCtx::process_default(), params).await.unwrap_err();+ let error = (controller("confirm").handler)(params).await.unwrap_err();assert!(error.contains("missing or expired"));}).await;diff --git a/crates/openhuman-core/src/inference/embedding_host/schemas_tests.rs b/crates/openhuman-core/src/inference/embedding_host/schemas_tests.rsindex 3310cd2954..4969e73023 100644--- a/crates/openhuman-core/src/inference/embedding_host/schemas_tests.rs+++ b/crates/openhuman-core/src/inference/embedding_host/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -32,7 +31,7 @@ async fn all_handlers_accept_empty_params_without_panic() {// The handler is an async fn pointer; calling it with empty params// must not panic. We don't assert Ok because mandatory-param// handlers legitimately return Err("invalid params: ...").- let _result = (ctrl.handler)(DispatchCtx::process_default(), params).await;+ let _result = (ctrl.handler)(params).await;// If we reach here the handler did not panic.}}diff --git a/crates/openhuman-core/src/inference/schemas_tests.rs b/crates/openhuman-core/src/inference/schemas_tests.rsindex 2f829df5eb..84d0508ff0 100644--- a/crates/openhuman-core/src/inference/schemas_tests.rs+++ b/crates/openhuman-core/src/inference/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use crate::core::TypeSchema;@@ -129,7 +128,7 @@ fn inference_openai_oauth_schemas_are_registered_with_expected_shapes() {#[tokio::test]async fn inference_openai_oauth_complete_handler_rejects_invalid_params() {let params = Map::from_iter([("callback_url".to_string(), Value::Bool(true))]);- let err = handle_inference_openai_oauth_complete(DispatchCtx::process_default(), params)+ let err = handle_inference_openai_oauth_complete(params).await.expect_err("invalid params");assert!(err.contains("invalid params"));@@ -143,7 +142,7 @@ fn inference_unknown_schema_panics() {#[tokio::test]async fn inference_status_handler_returns_cli_json() {- let value = handle_inference_status(DispatchCtx::process_default(), Map::new())+ let value = handle_inference_status(Map::new()).await.expect("handler value");assert!(value.get("result").is_some() || value.get("logs").is_some());@@ -152,7 +151,7 @@ async fn inference_status_handler_returns_cli_json() {#[tokio::test]async fn inference_prompt_handler_rejects_invalid_shape() {let params = Map::from_iter([("prompt".to_string(), Value::Bool(true))]);- let err = handle_inference_prompt(DispatchCtx::process_default(), params)+ let err = handle_inference_prompt(params).await.expect_err("invalid params");assert!(err.contains("invalid params"));diff --git a/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rsindex e34e2192a6..0facfcd61a 100644--- a/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rs+++ b/crates/openhuman-core/src/inference/tokenjuice/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -206,7 +205,7 @@ async fn tokenjuice_methods_are_not_gated_when_juice_is_on() {);crate::core::runtime::context::CoreContext::scope(ctx, async {// Gate passes; the handler then fails on its own missing param.- let err = handle_detect(DispatchCtx::process_default(), Map::new()).await.unwrap_err();+ let err = handle_detect(Map::new()).await.unwrap_err();assert!(!err.contains("COMPONENT_DISABLED"), "{err}");}).await;diff --git a/crates/openhuman-core/src/mcp/audit/schemas_tests.rs b/crates/openhuman-core/src/mcp/audit/schemas_tests.rsindex f5dabb2506..75b15a0dc8 100644--- a/crates/openhuman-core/src/mcp/audit/schemas_tests.rs+++ b/crates/openhuman-core/src/mcp/audit/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use serde_json::json;@@ -48,7 +47,7 @@ async fn handle_list_returns_persisted_audit_records() {.await.expect("record write");- let value = handle_list(DispatchCtx::process_default(), Map::new()).await.expect("handle list");+ let value = handle_list(Map::new()).await.expect("handle list");let records = value["records"].as_array().expect("records array");assert_eq!(records.len(), 1);assert_eq!(records[0]["tool_name"], "memory.store");diff --git a/crates/openhuman-core/src/mcp/ui/schemas_tests.rs b/crates/openhuman-core/src/mcp/ui/schemas_tests.rsindex aaaf9fd659..5df38fb169 100644--- a/crates/openhuman-core/src/mcp/ui/schemas_tests.rs+++ b/crates/openhuman-core/src/mcp/ui/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -36,7 +35,7 @@ fn params(value: Value) -> Map<String, Value> {#[tokio::test]async fn resource_read_handler_rejects_a_missing_server() {- let error = with_workspace(handle_resource_read(DispatchCtx::process_default(), params(serde_json::json!({}))))+ let error = with_workspace(handle_resource_read(params(serde_json::json!({})))).await.unwrap_err();assert!(error.contains("server_id"));@@ -44,7 +43,7 @@ async fn resource_read_handler_rejects_a_missing_server() {#[tokio::test]async fn resource_read_handler_rejects_an_unknown_inline_id() {- let error = with_workspace(handle_resource_read(DispatchCtx::process_default(), params(+ let error = with_workspace(handle_resource_read(params(serde_json::json!({"inline_id": "absent"}),))).await@@ -54,7 +53,7 @@ async fn resource_read_handler_rejects_an_unknown_inline_id() {#[tokio::test]async fn tool_call_handler_rejects_a_missing_server() {- let error = with_workspace(handle_tool_call(DispatchCtx::process_default(), params(serde_json::json!({}))))+ let error = with_workspace(handle_tool_call(params(serde_json::json!({})))).await.unwrap_err();assert!(error.contains("server_id"));@@ -62,7 +61,7 @@ async fn tool_call_handler_rejects_a_missing_server() {#[tokio::test]async fn tool_call_handler_refuses_an_unavailable_server() {- let result = with_workspace(handle_tool_call(DispatchCtx::process_default(), params(+ let result = with_workspace(handle_tool_call(params(serde_json::json!({"server_id": "nowhere", "tool_name": "order"}),))).await;diff --git a/crates/openhuman-core/src/memory/schemas_tests.rs b/crates/openhuman-core/src/memory/schemas_tests.rsindex 24cbedd1ef..da3a3bd4cf 100644--- a/crates/openhuman-core/src/memory/schemas_tests.rs+++ b/crates/openhuman-core/src/memory/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use crate::config::Config;use crate::core::runtime::context::CoreContext;@@ -57,7 +56,7 @@ fn object(value: Value) -> Map<String, Value> {async fn call(config: &Config, function: &str, params: Value) -> Result<Value, String> {let handler = handler_for(function);let ctx = CoreContext::for_test_with_config(DomainSet::full(), config.clone());- CoreContext::scope(ctx, async move { handler(DispatchCtx::process_default(), object(params)).await }).await+ CoreContext::scope(ctx, async move { handler(object(params)).await }).await}#[test]diff --git a/crates/openhuman-core/src/modules/schemas_tests.rs b/crates/openhuman-core/src/modules/schemas_tests.rsindex f8121ffb2d..2046a2646c 100644--- a/crates/openhuman-core/src/modules/schemas_tests.rs+++ b/crates/openhuman-core/src/modules/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::{all_controller_schemas, all_registered_controllers, controller_value, schemas, string_param,};@@ -61,7 +60,7 @@ async fn computer_status_handler_returns_serialized_status() {CoreContext::for_test_with_config(DomainSet::full(), crate::config::Config::default());let status = CoreContext::scope(ctx, async {- super::handle_computer_status(DispatchCtx::process_default(), Map::new()).await+ super::handle_computer_status(Map::new()).await}).await.expect("computer status should serialize");@@ -87,8 +86,8 @@ async fn forgetting_sites_reports_how_many_went() {"site".to_string(),Value::String("https://www.shop.test/cart".to_string()),);- let one = super::handle_browser_forget_sites(DispatchCtx::process_default(), one).await;- (one, super::handle_browser_forget_sites(DispatchCtx::process_default(), Map::new()).await)+ let one = super::handle_browser_forget_sites(one).await;+ (one, super::handle_browser_forget_sites(Map::new()).await)}).await;@@ -127,7 +126,7 @@ async fn a_blank_or_unreadable_site_forgets_nothing() {for site in [Value::String(" ".to_string()), Value::from(7)] {let mut params = Map::new();params.insert("site".to_string(), site);- let error = super::handle_browser_forget_sites(DispatchCtx::process_default(), params)+ let error = super::handle_browser_forget_sites(params).await.unwrap_err();assert!(error.contains("must name a site"), "{error}");diff --git a/crates/openhuman-core/src/platform/connectivity/schemas_tests.rs b/crates/openhuman-core/src/platform/connectivity/schemas_tests.rsindex 84f5bedbdb..29e53e6779 100644--- a/crates/openhuman-core/src/platform/connectivity/schemas_tests.rs+++ b/crates/openhuman-core/src/platform/connectivity/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -31,6 +30,6 @@ fn diag_schema_outputs_a_diag_payload_field() {#[tokio::test]async fn handle_diag_returns_json_object() {- let value = handle_diag(DispatchCtx::process_default(), Map::new()).await.expect("diag handler ok");+ let value = handle_diag(Map::new()).await.expect("diag handler ok");assert!(value.is_object(), "payload should be a JSON object");}diff --git a/crates/openhuman-core/src/platform/health/schemas_tests.rs b/crates/openhuman-core/src/platform/health/schemas_tests.rsindex e0c7bc90c2..2233c024d8 100644--- a/crates/openhuman-core/src/platform/health/schemas_tests.rs+++ b/crates/openhuman-core/src/platform/health/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -42,14 +41,14 @@ fn schemas_and_controllers_match() {#[tokio::test]async fn handle_snapshot_returns_json_object() {- let result = handle_snapshot(DispatchCtx::process_default(), Map::new()).await;+ let result = handle_snapshot(Map::new()).await;assert!(result.is_ok());assert!(result.unwrap().is_object());}#[tokio::test]async fn handle_system_info_returns_json_object() {- let result = handle_system_info(DispatchCtx::process_default(), Map::new()).await;+ let result = handle_system_info(Map::new()).await;assert!(result.is_ok());let json = result.unwrap();assert!(json.is_object());@@ -77,7 +76,7 @@ fn to_json_helper() {#[tokio::test]async fn system_info_declared_output_types_match_emitted_json() {let schema = schemas("system_info");- let json = handle_system_info(DispatchCtx::process_default(), Map::new())+ let json = handle_system_info(Map::new()).await.expect("system_info handler succeeds");diff --git a/crates/openhuman-core/src/platform/socket/schemas_tests.rs b/crates/openhuman-core/src/platform/socket/schemas_tests.rsindex 419e1221b7..b05c7bfc1e 100644--- a/crates/openhuman-core/src/platform/socket/schemas_tests.rs+++ b/crates/openhuman-core/src/platform/socket/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -101,16 +100,16 @@ async fn handlers_error_without_initialized_manager() {return;}- let err = handle_disconnect(DispatchCtx::process_default(), Map::new()).await.unwrap_err();+ let err = handle_disconnect(Map::new()).await.unwrap_err();assert!(err.contains("SocketManager not initialized"));- let err = handle_state(DispatchCtx::process_default(), Map::new()).await.unwrap_err();+ let err = handle_state(Map::new()).await.unwrap_err();assert!(err.contains("SocketManager not initialized"));- let err = handle_connect(DispatchCtx::process_default(), Map::new()).await.unwrap_err();+ let err = handle_connect(Map::new()).await.unwrap_err();assert!(err.contains("SocketManager not initialized"));- let err = handle_emit(DispatchCtx::process_default(), Map::new()).await.unwrap_err();+ let err = handle_emit(Map::new()).await.unwrap_err();assert!(err.contains("SocketManager not initialized"));}diff --git a/crates/openhuman-core/src/sandbox/schemas_tests.rs b/crates/openhuman-core/src/sandbox/schemas_tests.rsindex dee9cca673..6e3a8ea54a 100644--- a/crates/openhuman-core/src/sandbox/schemas_tests.rs+++ b/crates/openhuman-core/src/sandbox/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use crate::core::runtime::context::CoreContext;use crate::core::runtime::DomainSet;@@ -30,7 +29,7 @@ fn registered_controllers_match_schemas() {#[tokio::test]async fn handle_status_returns_json() {let ctx = scoped_ctx(crate::config::Config::default());- let result = CoreContext::scope(ctx, async { handle_status(DispatchCtx::process_default(), Map::new()).await }).await;+ let result = CoreContext::scope(ctx, async { handle_status(Map::new()).await }).await;assert!(result.is_ok());}@@ -39,7 +38,7 @@ async fn handle_resolve_policy_none() {let mut params = Map::new();params.insert("sandbox_mode".into(), Value::String("none".into()));let ctx = scoped_ctx(crate::config::Config::default());- let result = CoreContext::scope(ctx, async { handle_resolve_policy(DispatchCtx::process_default(), params).await }).await;+ let result = CoreContext::scope(ctx, async { handle_resolve_policy(params).await }).await;assert!(result.is_ok());}@@ -49,7 +48,7 @@ async fn handle_resolve_policy_sandboxed_remote() {params.insert("sandbox_mode".into(), Value::String("sandboxed".into()));params.insert("is_remote".into(), Value::Bool(true));let ctx = scoped_ctx(crate::config::Config::default());- let result = CoreContext::scope(ctx, async { handle_resolve_policy(DispatchCtx::process_default(), params).await }).await;+ let result = CoreContext::scope(ctx, async { handle_resolve_policy(params).await }).await;assert!(result.is_ok());let val = result.unwrap();let backend = val.get("backend").and_then(|b| b.as_str());@@ -81,7 +80,7 @@ async fn handle_resolve_policy_honors_loaded_docker_runtime() {params.insert("sandbox_mode".into(), Value::String("sandboxed".into()));params.insert("is_remote".into(), Value::Bool(false));- let val = CoreContext::scope(ctx, async { handle_resolve_policy(DispatchCtx::process_default(), params).await })+ let val = CoreContext::scope(ctx, async { handle_resolve_policy(params).await }).await.expect("resolve_policy should succeed under the scoped config");@@ -119,7 +118,7 @@ async fn handle_status_honors_loaded_docker_runtime() {params.insert("backend".into(), Value::String("local".into()));params.insert("is_remote".into(), Value::Bool(false));- let val = CoreContext::scope(ctx, async { handle_status(DispatchCtx::process_default(), params).await })+ let val = CoreContext::scope(ctx, async { handle_status(params).await }).await.expect("status should succeed under the scoped config");@@ -150,7 +149,7 @@ async fn handle_resolve_policy_uses_loaded_action_dir() {let mut params = Map::new();params.insert("sandbox_mode".into(), Value::String("none".into()));- let val = CoreContext::scope(ctx, async { handle_resolve_policy(DispatchCtx::process_default(), params).await })+ let val = CoreContext::scope(ctx, async { handle_resolve_policy(params).await }).await.expect("resolve_policy should succeed under the scoped config");@@ -182,7 +181,7 @@ fn docker_policy_params(workspace: &str) -> Map<String, Value> {async fn handle_validate_policy_rejects_a_malformed_policy() {let mut params = Map::new();params.insert("policy".into(), Value::String("not a policy".into()));- let err = handle_validate_policy(DispatchCtx::process_default(), params).await.unwrap_err();+ let err = handle_validate_policy(params).await.unwrap_err();assert!(err.contains("Invalid policy"), "{err}");}@@ -195,7 +194,7 @@ async fn handle_validate_policy_errors_instead_of_passing_when_tinybox_is_unavaiconfig.modules.enabled = false;let ctx = scoped_ctx(config);let result = CoreContext::scope(ctx, async {- handle_validate_policy(DispatchCtx::process_default(), docker_policy_params("/")).await+ handle_validate_policy(docker_policy_params("/")).await}).await;let err = result.unwrap_err();@@ -231,7 +230,7 @@ async fn sandbox_methods_are_not_gated_when_sandbox_is_on() {crate::core::runtime::ComponentSet::all(),);crate::core::runtime::context::CoreContext::scope(ctx, async {- let err = handle_validate_policy(DispatchCtx::process_default(), Map::new()).await.unwrap_err();+ let err = handle_validate_policy(Map::new()).await.unwrap_err();assert!(!err.contains("COMPONENT_DISABLED"), "{err}");}).await;diff --git a/crates/openhuman-core/src/tools/registry/schemas_tests.rs b/crates/openhuman-core/src/tools/registry/schemas_tests.rsindex 30be0194b7..469113745b 100644--- a/crates/openhuman-core/src/tools/registry/schemas_tests.rs+++ b/crates/openhuman-core/src/tools/registry/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use serde_json::json;@@ -50,7 +49,7 @@ fn required_tool_id_rejects_wrong_type() {#[tokio::test]async fn handle_list_returns_registry_object() {- let value = handle_list(DispatchCtx::process_default(), Map::new()).await.expect("list json");+ let value = handle_list(Map::new()).await.expect("list json");let tools = value.get("tools").and_then(Value::as_array)@@ -75,7 +74,7 @@ async fn handle_get_returns_one_registry_entry() {let mut params = Map::new();params.insert("tool_id".to_string(), json!("tools.web_search"));- let value = handle_get(DispatchCtx::process_default(), params).await.expect("get json");+ let value = handle_get(params).await.expect("get json");assert_eq!(value.get("tool_id").and_then(Value::as_str),Some("tools.web_search")@@ -84,7 +83,7 @@ async fn handle_get_returns_one_registry_entry() {#[tokio::test]async fn handle_diagnostics_returns_counts() {- let value = handle_diagnostics(DispatchCtx::process_default(), Map::new())+ let value = handle_diagnostics(Map::new()).await.expect("diagnostics json");let diagnostics = value.get("diagnostics").unwrap_or(&value);diff --git a/crates/openhuman-core/src/voice/live/schemas_tests.rs b/crates/openhuman-core/src/voice/live/schemas_tests.rsindex d6a97935c3..a00d4ed4f6 100644--- a/crates/openhuman-core/src/voice/live/schemas_tests.rs+++ b/crates/openhuman-core/src/voice/live/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;#[test]@@ -27,11 +26,11 @@ fn registers_four_live_controllers_in_the_voice_namespace() {#[tokio::test]async fn handlers_reject_bad_params() {let bad = |v: serde_json::Value| v.as_object().unwrap().clone();- assert!(handle_live_test_provider(DispatchCtx::process_default(), bad(serde_json::json!({})))+ assert!(handle_live_test_provider(bad(serde_json::json!({}))).await.is_err());assert!(- handle_live_settings_set(DispatchCtx::process_default(), bad(serde_json::json!({"gemini": 5})))+ handle_live_settings_set(bad(serde_json::json!({"gemini": 5}))).await.is_err());diff --git a/crates/openhuman-core/src/voice/schemas_tests.rs b/crates/openhuman-core/src/voice/schemas_tests.rsindex 03acdb7f85..95dd5d910b 100644--- a/crates/openhuman-core/src/voice/schemas_tests.rs+++ b/crates/openhuman-core/src/voice/schemas_tests.rs@@ -1,4 +1,3 @@-use crate::core::runtime::DispatchCtx;use super::*;use serde_json::json;@@ -146,7 +145,7 @@ async fn overlay_notify_recording_started_publishes_pressed_event() {let mut rx = subscribe_dictation_events();let params = Map::from_iter([("state".to_string(), json!("recording_started"))]);- let result = handle_overlay_stt_notify(DispatchCtx::process_default(), params)+ let result = handle_overlay_stt_notify(params).await.expect("overlay notify should succeed");assert_eq!(result["ok"], true);@@ -181,7 +180,7 @@ async fn overlay_notify_transcription_done_publishes_text_and_release() {("text".to_string(), json!("hello from overlay")),]);- let result = handle_overlay_stt_notify(DispatchCtx::process_default(), params)+ let result = handle_overlay_stt_notify(params).await.expect("overlay notify should succeed");assert_eq!(result["ok"], true);@@ -205,7 +204,7 @@ async fn overlay_notify_transcription_done_publishes_text_and_release() {async fn overlay_notify_transcription_done_requires_text() {let params = Map::from_iter([("state".to_string(), json!("transcription_done"))]);- let err = handle_overlay_stt_notify(DispatchCtx::process_default(), params)+ let err = handle_overlay_stt_notify(params).await.expect_err("missing text should fail");assert!(err.contains("text` is required"));@@ -217,10 +216,10 @@ async fn server_status_and_stop_return_stopped_when_uninitialized() {// the same binary may have already initialised it — in that case we// accept whatever its current state is and only verify the handlers// respond without error.- let status = handle_voice_server_status(DispatchCtx::process_default(), Map::new())+ let status = handle_voice_server_status(Map::new()).await.expect("status handler");- let stopped = handle_voice_server_stop(DispatchCtx::process_default(), Map::new())+ let stopped = handle_voice_server_stop(Map::new()).await.expect("stop handler");@@ -240,7 +239,7 @@ async fn overlay_notify_cancelled_publishes_released() {use crate::voice::dictation_listener::subscribe_dictation_events;let mut rx = subscribe_dictation_events();let params = Map::from_iter([("state".to_string(), json!("cancelled"))]);- let result = handle_overlay_stt_notify(DispatchCtx::process_default(), params).await.expect("ok");+ let result = handle_overlay_stt_notify(params).await.expect("ok");assert_eq!(result["ok"], true);let mut saw_release = false;while let Ok(evt) = rx.try_recv() {@@ -255,7 +254,7 @@ async fn overlay_notify_cancelled_publishes_released() {#[tokio::test]async fn overlay_notify_unknown_state_errors() {let params = Map::from_iter([("state".to_string(), json!("mystery"))]);- let err = handle_overlay_stt_notify(DispatchCtx::process_default(), params).await.unwrap_err();+ let err = handle_overlay_stt_notify(params).await.unwrap_err();// The deserialize layer rejects the unknown variant with a detailed// enum message — just assert an error surfaced.assert!(!err.is_empty());@@ -263,7 +262,7 @@ async fn overlay_notify_unknown_state_errors() {#[tokio::test]async fn overlay_notify_missing_state_errors() {- let err = handle_overlay_stt_notify(DispatchCtx::process_default(), Map::new()).await.unwrap_err();+ let err = handle_overlay_stt_notify(Map::new()).await.unwrap_err();assert!(!err.is_empty());}@@ -271,7 +270,7 @@ async fn overlay_notify_missing_state_errors() {async fn server_start_handler_errors_when_local_ai_disabled() {// Without a valid config the start handler must surface an error// rather than silently succeed.- let _ = handle_voice_server_start(DispatchCtx::process_default(), Map::new()).await;+ let _ = handle_voice_server_start(Map::new()).await;}#[test]