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): redact list_connections/execute against the live config
oxoxDev1451988c1367
diff --git a/crates/openhuman-core/src/integrations/composio/tools/execute.rs b/crates/openhuman-core/src/integrations/composio/tools/execute.rsindex 5bf05341ea..ee90648ea3 100644--- a/crates/openhuman-core/src/integrations/composio/tools/execute.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/execute.rs@@ -101,13 +101,17 @@ impl Tool for ComposioExecuteTool {ToolCategory::Workflow}async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {- let outcome = Box::pin(self.execute_unredacted(args)).await;- redact_composio_outcome(&self.config, outcome)+ let (config, outcome) = Box::pin(self.execute_unredacted(args)).await;+ redact_composio_outcome(&config, outcome)}}impl ComposioExecuteTool {- async fn execute_unredacted(&self, args: Value) -> anyhow::Result<ToolResult> {+ /// Returns the config actually used for dispatch alongside the outcome,+ /// so [`Tool::execute`] redacts against the same credential that ran —+ /// not the possibly-stale snapshot captured when this tool was+ /// registered.+ async fn execute_unredacted(&self, args: Value) -> (Config, anyhow::Result<ToolResult>) {let tool = args.get("tool").and_then(|v| v.as_str())@@ -115,9 +119,12 @@ impl ComposioExecuteTool {.trim().to_string();if tool.is_empty() {- return Ok(ToolResult::error(- "composio_execute: 'tool' is required (e.g. GMAIL_SEND_EMAIL)",- ));+ return (+ self.config.as_ref().clone(),+ Ok(ToolResult::error(+ "composio_execute: 'tool' is required (e.g. GMAIL_SEND_EMAIL)",+ )),+ );}let arguments = args.get("arguments").cloned();let connection_id = args@@ -167,12 +174,15 @@ impl ComposioExecuteTool {"[composio][sandbox] execute blocked: agent is read-only, action is {}",scope.as_str());- return Ok(ToolResult::error(format!(- "composio_execute: action `{tool}` is classified `{}` and is refused \- because the calling agent is in strict read-only mode. Only `read`-scoped \- actions are available to this agent.",- scope.as_str()- )));+ return (+ self.config.as_ref().clone(),+ Ok(ToolResult::error(format!(+ "composio_execute: action `{tool}` is classified `{}` and is refused \+ because the calling agent is in strict read-only mode. Only `read`-scoped \+ actions are available to this agent.",+ scope.as_str()+ ))),+ );}}@@ -194,7 +204,7 @@ impl ComposioExecuteTool {scope = scope.as_str(),"[composio][scopes] execute blocked by user scope pref");- return Ok(ToolResult::error(msg));+ return (self.config.as_ref().clone(), Ok(ToolResult::error(msg)));}ToolDecision::NotCurated => {let toolkit = toolkit_from_slug(&tool).unwrap_or_default();@@ -203,10 +213,13 @@ impl ComposioExecuteTool {toolkit = %toolkit,"[composio][scopes] execute blocked: action not in curated whitelist");- return Ok(ToolResult::error(format!(- "composio_execute: action `{tool}` is not in the curated whitelist for \- toolkit `{toolkit}`. Use composio_list_tools to see available actions."- )));+ return (+ self.config.as_ref().clone(),+ Ok(ToolResult::error(format!(+ "composio_execute: action `{tool}` is not in the curated whitelist for \+ toolkit `{toolkit}`. Use composio_list_tools to see available actions."+ ))),+ );}}@@ -248,16 +261,22 @@ impl ComposioExecuteTool {Ok(c) => c,Err(e) => {tracing::warn!(error = %e, "[composio] tool execute.execute: load_config failed");- return Ok(ToolResult::error(format!(- "composio_execute: failed to load live config: {e}"- )));+ return (+ self.config.as_ref().clone(),+ Ok(ToolResult::error(format!(+ "composio_execute: failed to load live config: {e}"+ ))),+ );}};let kind = match create_composio_client(&live_config) {Ok(kind) => kind,Err(e) => {tracing::warn!(error = %e, "[composio] tool execute.execute: factory failed");- return Ok(ToolResult::error(format!("composio_execute failed: {e}")));+ return (+ live_config,+ Ok(ToolResult::error(format!("composio_execute failed: {e}"))),+ );}};@@ -272,7 +291,7 @@ impl ComposioExecuteTool {).await;let elapsed_ms = started.elapsed().as_millis() as u64;- match res {+ let outcome = match res {Ok(resp) => {// Authoritative task-recency enforcement: drop task rows older// than the window. No-op unless a window is installed AND the@@ -342,7 +361,8 @@ impl ComposioExecuteTool {);Ok(ToolResult::error(e))}- }+ };+ (live_config, outcome)}}diff --git a/crates/openhuman-core/src/integrations/composio/tools/list_connections.rs b/crates/openhuman-core/src/integrations/composio/tools/list_connections.rsindex 50583b410d..d80cc1b887 100644--- a/crates/openhuman-core/src/integrations/composio/tools/list_connections.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/list_connections.rs@@ -47,13 +47,17 @@ impl Tool for ComposioListConnectionsTool {ToolCategory::Workflow}async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {- let outcome = Box::pin(self.execute_unredacted(args)).await;- redact_composio_outcome(&self.config, outcome)+ let (config, outcome) = Box::pin(self.execute_unredacted(args)).await;+ redact_composio_outcome(&config, outcome)}}impl ComposioListConnectionsTool {- async fn execute_unredacted(&self, _args: Value) -> anyhow::Result<ToolResult> {+ /// Returns the config actually used for dispatch alongside the outcome,+ /// so [`Tool::execute`] redacts against the same credential that ran —+ /// not the possibly-stale snapshot captured when this tool was+ /// registered.+ async fn execute_unredacted(&self, _args: Value) -> (Config, anyhow::Result<ToolResult>) {tracing::debug!("[composio] tool list_connections.execute");// Mirror `ops::composio_list_connections`: route through the mode-aware// factory so the agent sees the correct tenant's connections in both@@ -65,43 +69,56 @@ impl ComposioListConnectionsTool {Ok(c) => c,Err(e) => {tracing::warn!(error = %e, "[composio] list_connections.execute: load_config failed");- return Ok(ToolResult::error(format!(- "composio_list_connections: failed to load live config: {e}"- )));+ return (+ self.config.as_ref().clone(),+ Ok(ToolResult::error(format!(+ "composio_list_connections: failed to load live config: {e}"+ ))),+ );}};- let mut resp = match create_composio_client(&live_config) {- Ok(ComposioClientKind::Backend(client)) => {- tracing::debug!("[composio] list_connections.execute: backend variant");- client.list_connections().await.map_err(|e| {- anyhow::anyhow!("composio_list_connections (backend) failed: {e}")- })?- }- Ok(ComposioClientKind::Direct(direct)) => {- tracing::debug!("[composio-direct] list_connections.execute: direct variant");- direct_list_connections(&direct).await.map_err(|e| {- // [#1166 / Sentry TAURI-RUST-X9] Symmetric error- // routing with `ops.rs::composio_list_connections`.- // The agent-tool path can also fire 401s when a- // direct-mode user has a bad API key — without this- // hook the failure escapes the classifier and lands- // as an unclassified Sentry event. Render WITH the- // `[composio-direct]` anchor BEFORE reporting so the- // classifier arm in `is_provider_user_state_message`- // (gated on that prefix) actually fires.- let rendered = format!(- "[composio-direct] composio_list_connections (direct) failed: {e:#}"+ let mut resp =+ match create_composio_client(&live_config) {+ Ok(ComposioClientKind::Backend(client)) => {+ tracing::debug!("[composio] list_connections.execute: backend variant");+ match client.list_connections().await.map_err(|e| {+ anyhow::anyhow!("composio_list_connections (backend) failed: {e}")+ }) {+ Ok(resp) => resp,+ Err(e) => return (live_config, Err(e)),+ }+ }+ Ok(ComposioClientKind::Direct(direct)) => {+ tracing::debug!("[composio-direct] list_connections.execute: direct variant");+ match direct_list_connections(&direct).await.map_err(|e| {+ // [#1166 / Sentry TAURI-RUST-X9] Symmetric error+ // routing with `ops.rs::composio_list_connections`.+ // The agent-tool path can also fire 401s when a+ // direct-mode user has a bad API key — without this+ // hook the failure escapes the classifier and lands+ // as an unclassified Sentry event. Render WITH the+ // `[composio-direct]` anchor BEFORE reporting so the+ // classifier arm in `is_provider_user_state_message`+ // (gated on that prefix) actually fires.+ let rendered = format!(+ "[composio-direct] composio_list_connections (direct) failed: {e:#}"+ );+ super::super::ops::report_composio_op_error("list_connections", &rendered);+ anyhow::anyhow!("{rendered}")+ }) {+ Ok(resp) => resp,+ Err(e) => return (live_config, Err(e)),+ }+ }+ Err(e) => {+ return (+ live_config,+ Ok(ToolResult::error(format!(+ "composio_list_connections failed: {e}"+ ))),);- super::super::ops::report_composio_op_error("list_connections", &rendered);- anyhow::anyhow!("{rendered}")- })?- }- Err(e) => {- return Ok(ToolResult::error(format!(- "composio_list_connections failed: {e}"- )));- }- };+ }+ };// Filter server-side-indistinguishable states — callers should only// see integrations the user can actually act on. Matches the same// ACTIVE/CONNECTED allowlist used by `fetch_connected_integrations_uncached`@@ -112,9 +129,10 @@ impl ComposioListConnectionsTool {count = resp.connections.len(),"[composio] list_connections.execute: returning active connections");- Ok(ToolResult::success(+ let result = Ok(ToolResult::success(serde_json::to_string(&resp).unwrap_or_else(|_| "{}".into()),- ))+ ));+ (live_config, result)}}