The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(composio): handle empty toolkits response in authorize flow
Steven Enamakeld3bdc87eda06
diff --git a/crates/openhuman-core/src/integrations/composio/tools/authorize.rs b/crates/openhuman-core/src/integrations/composio/tools/authorize.rsindex bdf94bcb36..1384587c0a 100644--- a/crates/openhuman-core/src/integrations/composio/tools/authorize.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/authorize.rs@@ -10,10 +10,12 @@ use super::redact::redact_composio_outcome;use crate::config::Config;use tinytools::{PermissionLevel, Tool, ToolCategory, ToolResult};-use super::super::client::{create_composio_client, ComposioClientKind};+use super::super::client::{resolve_composio_route, ComposioRoute};+use super::super::module_client::{self as connectors, methods};+use super::super::types::{ComposioAuthorizeRequest, ComposioAuthorizeResponse};pub struct ComposioAuthorizeTool {- /// Held instead of a pre-baked `ComposioClient` so the+ /// Held instead of a pre-resolved route so the/// [`crate::config::ComposioConfig::mode`] toggle is/// honoured on every call (#1710).config: Arc<Config>,@@ -89,12 +91,11 @@ impl ComposioAuthorizeTool {)));}};- let client = match create_composio_client(&live_config) {- Ok(ComposioClientKind::Backend(client)) => {+ match resolve_composio_route(&live_config) {+ Ok(ComposioRoute::Backend) => {tracing::debug!("[composio] authorize.execute: backend variant");- client}- Ok(ComposioClientKind::Direct(_)) => {+ Ok(ComposioRoute::Direct(_)) => {tracing::info!(toolkit = %toolkit,"[composio-direct] authorize.execute: direct mode active — \@@ -111,7 +112,17 @@ impl ComposioAuthorizeTool {return Ok(ToolResult::error(format!("composio_authorize failed: {e}")));}};- match client.authorize(&toolkit, None).await {+ let request = ComposioAuthorizeRequest {+ toolkit: toolkit.clone(),+ extra_params: None,+ };+ match connectors::call::<_, ComposioAuthorizeResponse>(+ &live_config,+ methods::AUTHORIZE,+ request,+ )+ .await+ {Ok(resp) => {crate::core::bus::BUS.publish(crate::core::events::DomainEvent::ComposioConnectionCreated {diff --git a/crates/openhuman-core/src/integrations/composio/tools/list_toolkits.rs b/crates/openhuman-core/src/integrations/composio/tools/list_toolkits.rsindex 41025914df..771b60c523 100644--- a/crates/openhuman-core/src/integrations/composio/tools/list_toolkits.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/list_toolkits.rs@@ -10,10 +10,12 @@ use super::redact::redact_composio_outcome;use crate::config::Config;use tinytools::{PermissionLevel, Tool, ToolCategory, ToolResult};-use super::super::client::{create_composio_client, ComposioClientKind};+use super::super::client::{resolve_composio_route, ComposioRoute};+use super::super::module_client::{self as connectors, methods};+use super::super::types::ComposioToolkitsResponse;pub struct ComposioListToolkitsTool {- /// Held instead of a pre-baked `ComposioClient` so the+ /// Held instead of a pre-resolved route so the/// [`crate::config::ComposioConfig::mode`] toggle is/// honoured on every call (see [`ComposioExecuteTool`] doc for the/// bug this guards against — #1710).@@ -84,18 +86,17 @@ impl ComposioListToolkitsTool {);}};- let client = match create_composio_client(&live_config) {- Ok(ComposioClientKind::Backend(client)) => {+ match resolve_composio_route(&live_config) {+ Ok(ComposioRoute::Backend) => {tracing::debug!("[composio] list_toolkits.execute: backend variant");- client}- Ok(ComposioClientKind::Direct(_)) => {+ Ok(ComposioRoute::Direct(_)) => {tracing::info!("[composio-direct] list_toolkits.execute: direct mode active — \returning empty toolkits list. Users manage available toolkits \via app.composio.dev.");- let resp = super::super::types::ComposioToolkitsResponse::default();+ let resp = ComposioToolkitsResponse::default();return (live_config,Ok(ToolResult::success(@@ -112,7 +113,12 @@ impl ComposioListToolkitsTool {);}};- let outcome = match client.list_toolkits().await {+ let outcome = match connectors::call_bare::<ComposioToolkitsResponse>(+ &live_config,+ methods::LIST_TOOLKITS,+ )+ .await+ {Ok(resp) => Ok(ToolResult::success(serde_json::to_string(&resp).unwrap_or_else(|_| "{}".into()),)),