Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(mcp): load declared modules before dispatch tests

Steven Enamakelff798c486e20
diff --git a/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs b/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs
index 2df348d2f7..2d989d9e97 100644
--- a/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs
+++ b/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs
@@ -128,9 +128,9 @@ async fn call_tool_judges_the_policy_of_the_explicit_context_across_scopes() {
let mut allowing = crate::config::Config::default();
allowing.workspace_dir = tmp_allow.path().to_path_buf();
allowing.action_dir = tmp_allow.path().to_path_buf();
+ crate::modules::boot::load_declared_modules(&allowing).await;
let deny_core = CoreContext::for_test_with_config(DomainSet::full(), denying);
let allow_core = CoreContext::for_test_with_config(DomainSet::full(), allowing);
- crate::modules::boot::load_declared_modules(allow_core.config()).await;
let args = json!({ "agent_id": "no-such-agent", "prompt": "hello" });
// Each call runs scoped to the *other* context, so an ambient read would
diff --git a/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs b/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs
index 9c69958005..c5df67770f 100644
--- a/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs
+++ b/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs
@@ -59,6 +59,7 @@ async fn audit_write_rejection_records_failure_row() {
let mut config = Config::default();
config.workspace_dir = tmp.path().join("workspace");
std::fs::create_dir_all(&config.workspace_dir).unwrap();
+ crate::modules::boot::load_declared_modules(&config).await;
let err = ToolCallError::InvalidParams("bad write request".into());
audit_write_rejection(
@@ -159,6 +160,7 @@ async fn test_dispatch_write_tool_rpc_error_records_audit_and_returns_tool_error
let mut config = Config::default();
config.workspace_dir = tmp.path().join("workspace");
std::fs::create_dir_all(&config.workspace_dir).unwrap();
+ crate::modules::boot::load_declared_modules(&config).await;
// Omit the required `text` so the handler (or the missing registration)
// yields a failure instead of a stored item.
@@ -207,6 +209,7 @@ async fn test_audit_write_success_path() {
let mut config = Config::default();
config.workspace_dir = tmp.path().join("workspace");
std::fs::create_dir_all(&config.workspace_dir).unwrap();
+ crate::modules::boot::load_declared_modules(&config).await;
audit_write(
&config,