Skip to content

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

fix(composio): register tools in direct mode without an app session

oxoxDevd0eb34e57734
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 69b5d61d22..5ccbc0906f 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -980,27 +980,23 @@ pub fn all_tools_with_runtime(
} else {
tracing::debug!("[integrations] twilio disabled — skipping");
}
-
- // Composio — backend-proxied 1000+ OAuth integrations. Registers
- // five agent tools (list_toolkits, list_connections, authorize,
- // list_tools, execute) when the composio toggle is on. See
- // `crates/openhuman-core/src/integrations/composio/tools.rs` for per-tool details.
- let composio_tools = crate::integrations::composio::all_composio_agent_tools(root_config);
- if !composio_tools.is_empty() {
- tracing::debug!(
- count = composio_tools.len(),
- "[integrations] registered composio tools"
- );
- tools.extend(composio_tools);
- } else {
- tracing::debug!("[integrations] composio disabled — skipping");
- }
} else {
tracing::debug!(
"[integrations] build_client returned None — integration tools not registered"
);
}
+ let composio_tools = crate::integrations::composio::all_composio_agent_tools(root_config);
+ if composio_tools.is_empty() {
+ tracing::debug!("[integrations] composio unavailable — skipping");
+ } else {
+ tracing::debug!(
+ count = composio_tools.len(),
+ "[integrations] registered composio tools"
+ );
+ tools.extend(composio_tools);
+ }
+
// Coding-harness `lsp` tool (issue #1205) — capability-gated by the
// OPENHUMAN_LSP_ENABLED env var. The backend (real language-server
// bridge) is a follow-up; today the gate just controls visibility
diff --git a/crates/openhuman-core/src/tools/ops_tests.rs b/crates/openhuman-core/src/tools/ops_tests.rs
index 15ec76e1ed..9dafe78fa3 100644
--- a/crates/openhuman-core/src/tools/ops_tests.rs
+++ b/crates/openhuman-core/src/tools/ops_tests.rs
@@ -431,6 +431,8 @@ const ALWAYS_PRESENT_MEMORY_TOOLS: &[&str] = &["update_memory_md", "memory_store
mod capability_gating_tests;
#[path = "ops_tests_catalog_fixture_tests.rs"]
mod catalog_fixture_tests;
+#[path = "ops_tests_composio_registration_tests.rs"]
+mod composio_registration_tests;
#[path = "ops_tests_default_registry_tests.rs"]
mod default_registry_tests;
#[path = "ops_tests_domain_family_tests.rs"]
diff --git a/crates/openhuman-core/src/tools/ops_tests_composio_registration_tests.rs b/crates/openhuman-core/src/tools/ops_tests_composio_registration_tests.rs
new file mode 100644
index 0000000000..5710251c75
--- /dev/null
+++ b/crates/openhuman-core/src/tools/ops_tests_composio_registration_tests.rs
@@ -0,0 +1,50 @@
+use super::*;
+
+fn registry_names_for(cfg: &Config, tmp: &TempDir) -> Vec<String> {
+ let security = Arc::new(SecurityPolicy::default());
+ let tools = all_tools(
+ Arc::new(cfg.clone()),
+ &security,
+ AuditLogger::disabled(),
+ &BrowserConfig::default(),
+ &crate::config::HttpRequestConfig::default(),
+ tmp.path(),
+ &HashMap::new(),
+ cfg,
+ );
+ tool_names(&tools)
+}
+
+#[test]
+fn composio_tools_register_in_direct_mode_without_an_app_session() {
+ let tmp = TempDir::new().unwrap();
+ let mut cfg = test_config(&tmp);
+ cfg.composio.mode = crate::config::schema::COMPOSIO_MODE_DIRECT.into();
+ cfg.composio.api_key = Some("ck_direct_test".into());
+ assert!(crate::integrations::build_client(&cfg).is_none());
+
+ let names = registry_names_for(&cfg, &tmp);
+ assert_contains_all(
+ &names,
+ &[
+ "composio_list_toolkits",
+ "composio_list_connections",
+ "composio_authorize",
+ "composio_list_tools",
+ "composio_execute",
+ ],
+ );
+}
+
+#[test]
+fn composio_tools_stay_unregistered_in_backend_mode_without_an_app_session() {
+ let tmp = TempDir::new().unwrap();
+ let cfg = test_config(&tmp);
+ assert!(crate::integrations::build_client(&cfg).is_none());
+
+ let names = registry_names_for(&cfg, &tmp);
+ assert!(
+ !names.iter().any(|n| n.starts_with("composio_")),
+ "backend mode without a session must not register composio tools; got: {names:?}"
+ );
+}