Skip to content

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

fix(composio): handle missing backend tools in connected integrations

Steven Enamakel4e3e2d252f5e
diff --git a/crates/openhuman-core/src/integrations/composio/connected_integrations.rs b/crates/openhuman-core/src/integrations/composio/connected_integrations.rs
index 852ca020a6..14dfa2e3f2 100644
--- a/crates/openhuman-core/src/integrations/composio/connected_integrations.rs
+++ b/crates/openhuman-core/src/integrations/composio/connected_integrations.rs
@@ -2,6 +2,7 @@
//! mode-aware backend/direct [`fetch`] (whose uncached backend walk lives in
//! [`fetch_uncached`] since it is one large, sequential routine).
+mod backend_tools;
mod cache;
mod fetch;
mod fetch_uncached;
diff --git a/crates/openhuman-core/src/integrations/composio/connected_integrations/backend_tools.rs b/crates/openhuman-core/src/integrations/composio/connected_integrations/backend_tools.rs
new file mode 100644
index 0000000000..ad02dc08b4
--- /dev/null
+++ b/crates/openhuman-core/src/integrations/composio/connected_integrations/backend_tools.rs
@@ -0,0 +1,39 @@
+//! Backend tool-schema read used while the connector module is on the direct
+//! route.
+//!
+//! In direct mode the connector module holds exactly one route — the user's own
+//! key — so it cannot also ask the TinyHumans backend for its curated tool
+//! catalogue. Schemas are tenant-agnostic, and the prompt overview wants the
+//! curated ones when a backend session happens to exist, so this one
+//! authenticated GET stays on the host until the module can answer a member on
+//! a per-call route (pending a module member and release).
+
+use anyhow::Result;
+
+use super::super::types::ComposioToolsResponse;
+use crate::config::Config;
+
+/// Fetch the backend's curated schemas for `toolkits`.
+///
+/// `None` when there is no backend credential (the caller falls back to lazy
+/// resolution at delegation time); `Some(Err)` when the call itself failed.
+pub(super) async fn fetch_backend_tool_schemas(
+ config: &Config,
+ toolkits: &[String],
+) -> Option<Result<ComposioToolsResponse>> {
+ let client = crate::integrations::build_client(config)?;
+ let joined = toolkits
+ .iter()
+ .map(|t| t.trim())
+ .filter(|t| !t.is_empty())
+ .map(|t| urlencoding::encode(t).into_owned())
+ .collect::<Vec<_>>()
+ .join(",");
+ let path = if joined.is_empty() {
+ "/agent-integrations/composio/tools".to_string()
+ } else {
+ format!("/agent-integrations/composio/tools?toolkits={joined}")
+ };
+ tracing::debug!(path = %path, "[composio] backend tool schemas (direct-mode overview)");
+ Some(client.get::<ComposioToolsResponse>(&path).await)
+}
diff --git a/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch_uncached.rs b/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch_uncached.rs
index 69e17c85e7..91d9071448 100644
--- a/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch_uncached.rs
+++ b/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch_uncached.rs
@@ -234,23 +234,21 @@ pub(super) async fn fetch_connected_integrations_uncached(
// Best-effort: pull tool schemas via the backend client
// (definitional source). Failure is non-fatal — we fall
// back to empty tools and let lazy resolution handle it.
- let tools = match super::backend_tools::list_backend_tool_schemas(config, &allowlist) {
- Some(pending) => {
- match pending.await {
- Ok(resp) => {
- tracing::debug!(
- count = resp.tools.len(),
- "[composio-direct] fetch_connected_integrations: pulled tool schemas from backend (tenant-agnostic definitional source)"
- );
- resp.tools
- }
- Err(e) => {
- tracing::info!(
- "[composio-direct] fetch_connected_integrations: backend list_tools failed (will use lazy fallback at delegation time): {e:#}"
- );
- Vec::new()
- }
- }
+ let tools = match super::backend_tools::fetch_backend_tool_schemas(config, &allowlist)
+ .await
+ {
+ Some(Ok(resp)) => {
+ tracing::debug!(
+ count = resp.tools.len(),
+ "[composio-direct] fetch_connected_integrations: pulled tool schemas from backend (tenant-agnostic definitional source)"
+ );
+ resp.tools
+ }
+ Some(Err(e)) => {
+ tracing::info!(
+ "[composio-direct] fetch_connected_integrations: backend list_tools failed (will use lazy fallback at delegation time): {e:#}"
+ );
+ Vec::new()
}
None => {
tracing::info!(