Skip to content

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

test(orchestrator): add tests for composio visibility and routing

Steven Enamakelc16c7359adb1
diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs
index a6785e1551..cef737c0c2 100644
--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs
@@ -437,6 +437,19 @@ fn build_does_not_route_scope_errors_as_disconnected() {
assert!(body.contains("`composio_connect`"));
}
+#[test]
+fn composio_connect_is_not_advertised_when_the_tool_is_not_visible() {
+ let mut ctx = ctx_with(&[]);
+ // A filtered tool set without `composio_connect` (Composio disabled).
+ let hidden = ["web_fetch".to_string()].into_iter().collect();
+ ctx.visible_tool_names = &hidden;
+ assert!(!build(&ctx).unwrap().contains("composio_connect"));
+
+ let visible = ["composio_connect".to_string()].into_iter().collect();
+ ctx.visible_tool_names = &visible;
+ assert!(build(&ctx).unwrap().contains("`composio_connect`"));
+}
+
fn gmail_only() -> Vec<ConnectedIntegration> {
vec![ConnectedIntegration {
toolkit: "gmail".into(),
diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests_session_routing_tests.rs b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests_session_routing_tests.rs
index d5e4b14e14..2dcb870dca 100644
--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests_session_routing_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests_session_routing_tests.rs
@@ -227,7 +227,7 @@ fn skill_sections_name_the_hand_off_this_session_can_call() {
fn a_route_tagged_prompt_row_is_dropped_when_its_family_is_absent() {
let md = "keep me\n - Skills row<!--route:skills-->\n - MCP row<!--route:mcp-->\ntail";
- let both = strip_route_lines(md, true, true);
+ let both = strip_route_lines(md, true, true, true);
assert!(
both.contains("Skills row") && both.contains("MCP row"),
"both rows survive when both families are present: {both}"
@@ -237,7 +237,7 @@ fn a_route_tagged_prompt_row_is_dropped_when_its_family_is_absent() {
"the tag is an authoring marker and must never reach the model: {both}"
);
- let neither = strip_route_lines(md, false, false);
+ let neither = strip_route_lines(md, false, false, true);
assert!(
!neither.contains("Skills row") && !neither.contains("MCP row"),
"a row whose family is compiled out must be dropped: {neither}"
@@ -247,9 +247,19 @@ fn a_route_tagged_prompt_row_is_dropped_when_its_family_is_absent() {
"untagged prose is untouched: {neither}"
);
- let skills_only = strip_route_lines(md, true, false);
+ let skills_only = strip_route_lines(md, true, false, true);
assert!(
skills_only.contains("Skills row") && !skills_only.contains("MCP row"),
"each tag is decided on its own: {skills_only}"
);
}
+
+#[test]
+fn the_composio_connect_row_is_dropped_when_composio_is_off() {
+ let md = "keep\n- connect: `composio_connect`<!--route:composio-->\ntail";
+ let on = strip_route_lines(md, true, true, true);
+ assert!(on.contains("composio_connect") && !on.contains("<!--route:"));
+ let off = strip_route_lines(md, true, true, false);
+ assert!(!off.contains("composio_connect"), "{off}");
+ assert!(off.contains("keep") && off.contains("tail"));
+}
diff --git a/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs b/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs
index 3ef11b605c..4c2de45a60 100644
--- a/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs
@@ -300,6 +300,31 @@ fn agent_tools_skip_registration_when_no_credentials_at_all() {
);
}
+#[test]
+fn agent_tools_are_all_removed_when_composio_is_disabled_even_if_signed_in() {
+ let tmp = tempfile::tempdir().unwrap();
+ let mut config = crate::config::Config::default();
+ config.config_path = tmp.path().join("config.toml");
+ crate::security::credentials::AuthService::from_config(&config)
+ .store_provider_token(
+ crate::security::credentials::APP_SESSION_PROVIDER,
+ crate::security::credentials::DEFAULT_AUTH_PROFILE_NAME,
+ "test-token",
+ std::collections::HashMap::new(),
+ true,
+ )
+ .expect("store test session token");
+ config.composio.mode = "disabled".into();
+ let names: Vec<String> = all_composio_agent_tools(&config)
+ .iter()
+ .map(|t| t.name().to_string())
+ .collect();
+ assert!(
+ names.is_empty(),
+ "no composio tool (incl. composio_connect) may register: {names:?}"
+ );
+}
+
#[test]
fn agent_tools_register_when_backend_signed_in() {
let tmp = tempfile::tempdir().unwrap();