Skip to content

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

test(search): run the native module contract in its own process

Steven Enamakel10e9dca90a39
diff --git a/Cargo.lock b/Cargo.lock
index f23a884dcb..7cc9152952 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4802,6 +4802,7 @@ dependencies = [
"tinyinference-voice",
"tinymcp",
"tinymcp-bus",
+ "tinysearch-bus",
"tinytools",
"tinytools-agent",
"tokio",
diff --git a/crates/openhuman-cli/Cargo.toml b/crates/openhuman-cli/Cargo.toml
index 284c0a9623..28fff4e031 100644
--- a/crates/openhuman-cli/Cargo.toml
+++ b/crates/openhuman-cli/Cargo.toml
@@ -74,6 +74,11 @@ required-features = ["http-server", "bin-tools"]
# files. #5021 is still the right fix for symbols named in the middle of an
# otherwise gate-free target — required-features is the blunt instrument, and
# it costs the whole target when the gate is off.
+[[test]]
+name = "tinysearch_module_e2e"
+path = "../../tests/tinysearch_module_e2e.rs"
+required-features = ["modules"]
+
[[test]]
# Reproduction of the removed spend cap: needs its own process because the
# global CostTracker is a `OnceCell`, so a shared `--lib` process makes the
@@ -328,6 +333,7 @@ tar = "0.4"
tinyagents-graph = { path = "../../vendor/tinyagents/crates/tinyagents-graph", features = ["sqlite", "storage-drivers"] }
tinyagents-harness = { path = "../../vendor/tinyagents/crates/tinyagents-harness", features = ["sqlite", "multimodal"] }
tinyagents-session = { path = "../../vendor/tinyagents/crates/tinyagents-session" }
+tinysearch-bus = { path = "../../vendor/tinysearch/crates/tinysearch-bus" }
tinybus = { path = "../../vendor/tinybus/crates/tinybus", default-features = false, features = ["macros", "uds"] }
tinychannels = { version = "0.1", features = ["relay-websocket"] }
tinyinference-core = { path = "../../vendor/tinyagents/vendor/tinyinference/crates/tinyinference-core" }
diff --git a/crates/openhuman-core/src/modules/search/proxy_tests.rs b/crates/openhuman-core/src/modules/search/proxy_tests.rs
index 6caacbbb1b..50e9716ba2 100644
--- a/crates/openhuman-core/src/modules/search/proxy_tests.rs
+++ b/crates/openhuman-core/src/modules/search/proxy_tests.rs
@@ -147,56 +147,3 @@ fn the_execute_tool_deadline_follows_a_raised_tool_budget() {
);
assert_eq!(execute_tool_timeout_for(10), EXECUTE_TOOL_TIMEOUT);
}
-
-#[tokio::test]
-#[ignore = "requires TINYSEARCH_TEST_MODULE pointing to the byte-verified release artifact"]
-async fn released_search_artifact_serves_host_contract_and_rejects_disabled_execution() {
- use tinybus::{broker::Broker, module::ModuleHost, transport::memory::MemoryBus};
- let file = std::env::var_os("TINYSEARCH_TEST_MODULE").expect("released artifact path");
- let bus = MemoryBus::new();
- let broker = Broker::new();
- let broker_task = broker.spawn(bus.clone());
- let host = ModuleHost::new(broker);
- let config = tinysearch_bus::SearchConfig {
- enabled: false,
- ..Default::default()
- };
- let info = host
- .load_file_with_config(
- std::path::PathBuf::from(file),
- serde_json::to_value(config).unwrap(),
- )
- .expect("published artifact is admitted by the host loader");
- assert_eq!(info.name, "tinysearch");
- assert_eq!(info.version, "0.4.1");
- let client = tinybus::Connection::connect(bus.connect().await.unwrap())
- .await
- .unwrap();
- tokio::time::timeout(std::time::Duration::from_secs(5), async {
- while !client
- .list_names()
- .await
- .unwrap()
- .iter()
- .any(|name| name.as_str() == names::INTERFACE)
- {
- tokio::task::yield_now().await;
- }
- })
- .await
- .expect("module claims its contract interface");
- let proxy = client
- .proxy(names::INTERFACE, names::OBJECT_PATH, names::INTERFACE)
- .unwrap();
- let tools: ListToolsResponse = proxy.call(names::methods::LIST_TOOLS, ()).await.unwrap();
- assert!(tools.tools.is_empty());
- let failure = call_execute_tool::<ExecuteToolResponse>(proxy, web_answer_request())
- .await
- .expect_err("disabled module refuses execution without contacting providers");
- assert!(
- failure.to_string().contains("search is disabled"),
- "{failure}"
- );
- host.shutdown(std::time::Duration::from_secs(5)).await;
- broker_task.abort();
-}
diff --git a/tests/tinysearch_module_e2e.rs b/tests/tinysearch_module_e2e.rs
new file mode 100644
index 0000000000..e1a2436d1e
--- /dev/null
+++ b/tests/tinysearch_module_e2e.rs
@@ -0,0 +1,61 @@
+//! Real TinySearch module admission and wire contract, isolated from other runtimes.
+use tinysearch_bus::{names, ExecuteToolRequest, ExecuteToolResponse, ListToolsResponse};
+
+#[tokio::test]
+async fn pinned_search_module_serves_host_contract_and_rejects_disabled_execution() {
+ use tinybus::{broker::Broker, module::ModuleHost, transport::memory::MemoryBus};
+ let file = std::env::var_os("TINYSEARCH_TEST_MODULE").expect("released artifact path");
+ let bus = MemoryBus::new();
+ let broker = Broker::new();
+ let broker_task = broker.spawn(bus.clone());
+ let host = ModuleHost::new(broker);
+ let config = tinysearch_bus::SearchConfig {
+ enabled: false,
+ ..Default::default()
+ };
+ let info = host
+ .load_file_with_config(
+ std::path::PathBuf::from(file),
+ serde_json::to_value(config).unwrap(),
+ )
+ .expect("published artifact is admitted by the host loader");
+ assert_eq!(info.name, "tinysearch");
+ assert_eq!(info.version, "0.4.1");
+ let client = tinybus::Connection::connect(bus.connect().await.unwrap())
+ .await
+ .unwrap();
+ tokio::time::timeout(std::time::Duration::from_secs(5), async {
+ while !client
+ .list_names()
+ .await
+ .unwrap()
+ .iter()
+ .any(|name| name.as_str() == names::INTERFACE)
+ {
+ tokio::task::yield_now().await;
+ }
+ })
+ .await
+ .expect("module claims its contract interface");
+ let proxy = client
+ .proxy(names::INTERFACE, names::OBJECT_PATH, names::INTERFACE)
+ .unwrap();
+ let tools: ListToolsResponse = proxy.call(names::methods::LIST_TOOLS, ()).await.unwrap();
+ assert!(tools.tools.is_empty());
+ let failure = proxy
+ .call::<ExecuteToolResponse>(
+ names::methods::EXECUTE_TOOL,
+ (ExecuteToolRequest {
+ name: "web_answer_tool".into(),
+ arguments: serde_json::json!({ "query": "q" }),
+ },),
+ )
+ .await
+ .expect_err("disabled module refuses execution without contacting providers");
+ assert!(
+ failure.to_string().contains("search is disabled"),
+ "{failure}"
+ );
+ host.shutdown(std::time::Duration::from_secs(5)).await;
+ broker_task.abort();
+}