Skip to content

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

test(connectors): add tests for route-unsupported error detection

Steven Enamakeld3d7cb680007
diff --git a/src/openhuman/integrations/composio/ops/toolkits.rs b/src/openhuman/integrations/composio/ops/toolkits.rs
index f21165617e..46c17c900e 100644
--- a/src/openhuman/integrations/composio/ops/toolkits.rs
+++ b/src/openhuman/integrations/composio/ops/toolkits.rs
@@ -4,7 +4,6 @@ use crate::openhuman::config::Config;
use crate::openhuman::modules::connectors::{self, methods};
use crate::rpc::RpcOutcome;
-use super::super::client::{create_composio_client, ComposioClientKind};
use super::super::providers::{agent_ready_toolkits, capability_matrix};
use super::super::types::{ComposioCapabilitiesResponse, ComposioToolkitsResponse};
use super::error_utils::{report_composio_op_error, OpResult};
diff --git a/src/openhuman/modules/connectors_tests.rs b/src/openhuman/modules/connectors_tests.rs
index 2d471734cb..abbf1b0e8d 100644
--- a/src/openhuman/modules/connectors_tests.rs
+++ b/src/openhuman/modules/connectors_tests.rs
@@ -1,6 +1,6 @@
//! Tests for the connector module client.
-use super::{methods, module_config, MODULE_ID};
+use super::{is_unsupported_by_route, methods, module_config, MODULE_ID};
use crate::openhuman::config::schema::{COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT};
use crate::openhuman::config::Config;
use crate::openhuman::modules::registry;
@@ -145,3 +145,30 @@ fn the_backend_route_needs_a_session() {
let error = module_config(&config).expect_err("no session token");
assert!(error.contains("Sign in"), "{error}");
}
+
+#[test]
+fn recognises_the_module_refusing_a_member_its_route_cannot_serve() {
+ // The two routes are not equivalent, and the module says so by name rather
+ // than returning an empty result. A host rendering its own message for that
+ // case has to tell the refusal apart from a real failure.
+ assert!(is_unsupported_by_route(
+ "ListToolkits: ListToolkits is not available over the direct route"
+ ));
+ assert!(is_unsupported_by_route(
+ "DeleteConnection is not available over the direct route"
+ ));
+}
+
+#[test]
+fn does_not_mistake_a_real_failure_for_a_route_refusal() {
+ // Getting this wrong would render "no curated allowlist" over a genuine
+ // outage, and the user would never learn their integration was broken.
+ for error in [
+ "ListToolkits: request to /agent-integrations/composio/toolkits failed: 502 bad gateway",
+ "ListToolkits: response did not match the contract",
+ "unknown module 'tinyconnectors'",
+ "the module runtime is unavailable",
+ ] {
+ assert!(!is_unsupported_by_route(error), "{error}");
+ }
+}