Skip to content

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

chore: files changed tests/agent_harness_e2e.rs,tests/json_rpc_e2e.rs,tests/mcp_registry_e2e.rs,test

Steven Enamakel8d8a59c0b984
diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rs
index 0fbbd03da1..e0206705fc 100644
--- a/tests/agent_harness_e2e.rs
+++ b/tests/agent_harness_e2e.rs
@@ -11,6 +11,8 @@
//! a false positive here — the lock IS the serialization mechanism.
#![allow(clippy::await_holding_lock)]
+#[path = "support/mcp_stub_jail.rs"]
+mod mcp_stub_jail;
#[path = "support/env_guard.rs"]
mod env_guard;
#[path = "support/linked_modules.rs"]
@@ -513,6 +515,8 @@ encrypt = false
{extra_config}
"#
);
+ // The jail the MCP stub runs in must be able to read the stub binary.
+ let cfg = cfg + &mcp_stub_jail::local_jail_toml(env!("CARGO_BIN_EXE_test-mcp-stub"));
fn write_config_file(config_dir: &Path, cfg: &str) {
std::fs::create_dir_all(config_dir).expect("mkdir openhuman");
std::fs::write(config_dir.join("config.toml"), cfg).expect("write config");
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index 8df02b6312..97c7af9b32 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -6,6 +6,8 @@
#[path = "support/tinyhumans_boot.rs"]
mod tinyhumans_boot;
+#[path = "support/mcp_stub_jail.rs"]
+mod mcp_stub_jail;
#[path = "support/env_guard.rs"]
mod env_guard;
#[path = "support/scripted_stack.rs"]
@@ -1096,6 +1098,8 @@ chat_onboarding_completed = true
encrypt = false
"#
);
+ // The jail the MCP stub runs in must be able to read the stub binary.
+ let cfg = cfg + &mcp_stub_jail::local_jail_toml(env!("CARGO_BIN_EXE_test-mcp-stub"));
fn write_config_file(config_dir: &Path, cfg: &str) {
std::fs::create_dir_all(config_dir).expect("mkdir openhuman");
let path = config_dir.join("config.toml");
diff --git a/tests/mcp_registry_e2e.rs b/tests/mcp_registry_e2e.rs
index 8a010df383..bac0690069 100644
--- a/tests/mcp_registry_e2e.rs
+++ b/tests/mcp_registry_e2e.rs
@@ -8,6 +8,9 @@
#![cfg(feature = "mcp")]
+#[path = "support/mcp_stub_jail.rs"]
+mod mcp_stub_jail;
+
use openhuman_core::config::{schema::ModuleOverride, Config};
use serde_json::{json, Map, Value};
@@ -31,6 +34,8 @@ fn fresh_workspace_config() -> (tempfile::TempDir, Config) {
},
..Config::default()
};
+ let mut cfg = cfg;
+ mcp_stub_jail::grant_stub(&mut cfg, env!("CARGO_BIN_EXE_test-mcp-stub"));
(tmp, cfg)
}
diff --git a/tests/mcp_registry_multi_server.rs b/tests/mcp_registry_multi_server.rs
index 2b3eedf12a..0b2791ef00 100644
--- a/tests/mcp_registry_multi_server.rs
+++ b/tests/mcp_registry_multi_server.rs
@@ -6,6 +6,9 @@
#![cfg(feature = "mcp")]
+#[path = "support/mcp_stub_jail.rs"]
+mod mcp_stub_jail;
+
use openhuman_core::config::{
schema::{ModuleOverride, ModulesConfig},
Config,
@@ -37,6 +40,8 @@ fn fresh_workspace_config() -> (tempfile::TempDir, Config) {
},
..Config::default()
};
+ let mut config = config;
+ mcp_stub_jail::grant_stub(&mut config, env!("CARGO_BIN_EXE_test-mcp-stub"));
(workspace, config)
}
diff --git a/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs b/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs
index 01125ac652..5ab7ecd051 100644
--- a/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs
@@ -409,10 +409,11 @@ async fn tool_registry_entries_fall_back_on_current_thread_runtime() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn tool_registry_entries_include_connected_mcp_client_tools() {
let tmp = tempdir().expect("tempdir");
- let config = Config {
+ let mut config = Config {
workspace_dir: tmp.path().to_path_buf(),
..Config::default()
};
+ crate::mcp_stub_jail::grant_stub(&mut config, env!("CARGO_BIN_EXE_test-mcp-stub"));
let server = install_test_mcp_server(&config, &test_mcp_server()).await;
openhuman_core::mcp::registry::ops::mcp_clients_set_enabled(
&config,
@@ -430,10 +431,11 @@ async fn tool_registry_entries_include_connected_mcp_client_tools() {
// test. With one workspace open, `registry_entries()` and the config-scoped
// form agree, and this case would keep passing if the forwarding regressed.
let other_tmp = tempdir().expect("second tempdir");
- let other_config = Config {
+ let mut other_config = Config {
workspace_dir: other_tmp.path().to_path_buf(),
..Config::default()
};
+ crate::mcp_stub_jail::grant_stub(&mut other_config, env!("CARGO_BIN_EXE_test-mcp-stub"));
let other_server = install_test_mcp_server(&other_config, &test_mcp_server()).await;
openhuman_core::mcp::registry::ops::mcp_clients_set_enabled(
&other_config,
diff --git a/tests/raw_coverage_all.rs b/tests/raw_coverage_all.rs
index 4d4e359629..ce3960a223 100644
--- a/tests/raw_coverage_all.rs
+++ b/tests/raw_coverage_all.rs
@@ -86,6 +86,8 @@ pub mod tinyhumans_boot;
#[path = "support/env_guard.rs"]
pub mod env_guard;
/// The RPC bearer and JSON-RPC helpers some suites share (see `support/`).
+#[path = "support/mcp_stub_jail.rs"]
+pub mod mcp_stub_jail;
#[path = "support/rpc_auth.rs"]
pub mod rpc_auth;
#[path = "support/rpc_harness.rs"]
diff --git a/tests/support/mcp_stub_jail.rs b/tests/support/mcp_stub_jail.rs
new file mode 100644
index 0000000000..07ca2869d6
--- /dev/null
+++ b/tests/support/mcp_stub_jail.rs
@@ -0,0 +1,39 @@
+//! Test-only read grant for the Cargo-built `test-mcp-stub` binary.
+//!
+//! tinymcp starts every stdio server that is not `operator_trusted` inside a
+//! TinyBox jail, and the jail denies whatever it is not granted. The stub
+//! lives under `target/`, which no default grant covers, so the tests grant
+//! its directory read-only through the product's own `[runtime.local_jail]`
+//! setting. This changes nothing about the host's policy: the sandbox, the
+//! isolation floor and the protected-path floor all stay in force.
+
+#![allow(dead_code)]
+
+use std::path::Path;
+
+/// The directory holding the stub binary at `stub`.
+pub fn stub_dir(stub: &str) -> String {
+ Path::new(stub)
+ .parent()
+ .expect("stub binary has a directory")
+ .to_string_lossy()
+ .into_owned()
+}
+
+/// A `config.toml` fragment granting the stub's directory, to append to a
+/// test config that has no `[runtime]` table of its own.
+pub fn local_jail_toml(stub: &str) -> String {
+ format!(
+ "\n[runtime.local_jail]\nextra_read_only = [{:?}]\n",
+ stub_dir(stub)
+ )
+}
+
+/// Grants the stub's directory on an in-memory config.
+pub fn grant_stub(config: &mut openhuman_core::config::Config, stub: &str) {
+ config
+ .runtime
+ .local_jail
+ .extra_read_only
+ .push(stub_dir(stub));
+}