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
refactor(composio): reformat builder tools and flow backend
Steven Enamakel5d6e36a2e00b
diff --git a/crates/openhuman-core/src/flows/builder_tools_reads_and_catalog_tests.rs b/crates/openhuman-core/src/flows/builder_tools_reads_and_catalog_tests.rsindex ff1d529c0e..4ac4410de0 100644--- a/crates/openhuman-core/src/flows/builder_tools_reads_and_catalog_tests.rs+++ b/crates/openhuman-core/src/flows/builder_tools_reads_and_catalog_tests.rs@@ -1,7 +1,7 @@use super::*;-use crate::integrations::composio::builder_tools::catalog_search::search_catalog;use crate::flows::builder_tools_connection_reads::flow_connection_to_json;+use crate::integrations::composio::builder_tools::catalog_search::search_catalog;// ── revise_workflow ──────────────────────────────────────────────────────────#[tokio::test]@@ -177,4 +177,3 @@ fn list_flow_connections_json_surfaces_platform_user_id() {let json = flow_connection_to_json(&without_identity);assert!(json["platform_user_id"].is_null());}-diff --git a/crates/openhuman-core/src/flows/registration.rs b/crates/openhuman-core/src/flows/registration.rsindex c22206c44f..f7baa67387 100644--- a/crates/openhuman-core/src/flows/registration.rs+++ b/crates/openhuman-core/src/flows/registration.rs@@ -1,14 +1,14 @@//! Registration of the flow authoring, execution, discovery, and memory tools.use super::builder_host::{FlowsHost, OverlayNodeKinds};-use crate::integrations::composio::builder_tools::{- GetToolContractTool, GetToolOutputSampleTool, ListConnectableToolkitsTool,- ListFlowConnectionsTool, SearchToolCatalogTool,-};use super::builder_tools_connection_reads::FlowsConnectionProvider;use super::memory_tools::{FlowMemoryRecallTool, FlowMemoryRememberTool};use super::tools::{ProposeWorkflowTool, RunFlowTool};use crate::config::Config;+use crate::integrations::composio::builder_tools::{+ GetToolContractTool, GetToolOutputSampleTool, ListConnectableToolkitsTool,+ ListFlowConnectionsTool, SearchToolCatalogTool,+};use crate::security::SecurityPolicy;use std::sync::Arc;use tinyflows_copilot::tools::{diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs b/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rsindex 8d142307bd..5873efa995 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs@@ -1,14 +1,14 @@//! Thin `tinyflows` adapter for the Composio-owned flow backend.-use async_trait::async_trait;-use serde_json::Value;-use tinyflows::error::{EngineError, Result};use super::{ToolBackend, ToolCallCtx};use crate::config::Config;-use crate::integrations::composio::flow_backend::{self, FlowCallPolicy, FlowToolCallCtx};-use crate::security::{GateDecision, SecurityPolicy};use crate::core::runtime::DispatchCtx;+use crate::integrations::composio::flow_backend::{self, FlowCallPolicy, FlowToolCallCtx};use crate::security::approval::ApprovalTurnContext;+use crate::security::{GateDecision, SecurityPolicy};+use async_trait::async_trait;+use serde_json::Value;+use tinyflows::error::{EngineError, Result};pub(crate) struct ComposioToolBackend;@@ -16,16 +16,34 @@ struct FlowPolicy;#[async_trait]impl FlowCallPolicy for FlowPolicy {- async fn tier_decision(&self, dispatch: &DispatchCtx, captured: &Config, live: &Config, security: &SecurityPolicy, class: tinybox_bus::CommandClass) -> std::result::Result<GateDecision, String> {- let policy = super::super::tier_policy_from_config(dispatch, captured, Some(live), security)- .map_err(capability_payload)?;+ async fn tier_decision(+ &self,+ dispatch: &DispatchCtx,+ captured: &Config,+ live: &Config,+ security: &SecurityPolicy,+ class: tinybox_bus::CommandClass,+ ) -> std::result::Result<GateDecision, String> {+ let policy =+ super::super::tier_policy_from_config(dispatch, captured, Some(live), security)+ .map_err(capability_payload)?;super::super::enforce_node_tier_gate(&policy, class, "tool_call").map_err(capability_payload)}- async fn approve(&self, dispatch: &DispatchCtx, approval: &ApprovalTurnContext, decision: GateDecision, slug: &str, args: &Value) -> std::result::Result<Option<String>, String> {+ async fn approve(+ &self,+ dispatch: &DispatchCtx,+ approval: &ApprovalTurnContext,+ decision: GateDecision,+ slug: &str,+ args: &Value,+ ) -> std::result::Result<Option<String>, String> {let summary = crate::security::approval::summarize_action(slug, args);let redacted = crate::security::approval::redact_args(args);- let (outcome, audit_id) = super::super::gate_call_for_tier(dispatch, approval, decision, slug, &summary, redacted).await;+ let (outcome, audit_id) = super::super::gate_call_for_tier(+ dispatch, approval, decision, slug, &summary, redacted,+ )+ .await;match outcome {crate::security::approval::GateOutcome::Allow => Ok(audit_id),crate::security::approval::GateOutcome::Deny { reason } => Err(reason),@@ -33,7 +51,11 @@ impl FlowCallPolicy for FlowPolicy {}fn record(&self, audit_id: &str, result: &std::result::Result<Value, String>) {if let Some(gate) = crate::security::approval::ApprovalGate::try_global() {- let outcome = if result.is_ok() { crate::security::approval::ExecutionOutcome::Success } else { crate::security::approval::ExecutionOutcome::Failure };+ let outcome = if result.is_ok() {+ crate::security::approval::ExecutionOutcome::Success+ } else {+ crate::security::approval::ExecutionOutcome::Failure+ };let display_error = result.as_ref().err()@@ -52,15 +74,34 @@ fn capability_payload(error: EngineError) -> String {#[async_trait]impl ToolBackend for ComposioToolBackend {- fn name(&self) -> &'static str { "composio" }- fn prefix(&self) -> &'static str { "" }+ fn name(&self) -> &'static str {+ "composio"+ }+ fn prefix(&self) -> &'static str {+ ""+ }async fn preflight(&self, config: &Config, slug: &str, args: &Value) -> Result<()> {- flow_backend::preflight(config, slug, args).await.map_err(EngineError::Capability)+ flow_backend::preflight(config, slug, args)+ .await+ .map_err(EngineError::Capability)}- async fn invoke(&self, ctx: &ToolCallCtx<'_>, slug: &str, args: Value, conn: Option<&str>) -> Result<Value> {+ async fn invoke(+ &self,+ ctx: &ToolCallCtx<'_>,+ slug: &str,+ args: Value,+ conn: Option<&str>,+ ) -> Result<Value> {let policy = FlowPolicy;- let owner_ctx = FlowToolCallCtx { dispatch: ctx.dispatch, config: ctx.config, security: ctx.security, approval: ctx.approval, policy: &policy };- flow_backend::invoke(&owner_ctx, slug, args, conn).await.map_err(EngineError::Capability)+ let owner_ctx = FlowToolCallCtx {+ dispatch: ctx.dispatch,+ config: ctx.config,+ security: ctx.security,+ approval: ctx.approval,+ policy: &policy,+ };+ flow_backend::invoke(&owner_ctx, slug, args, conn)+ .await+ .map_err(EngineError::Capability)}}-diff --git a/crates/openhuman-core/src/integrations/composio/builder_tools/catalog_search.rs b/crates/openhuman-core/src/integrations/composio/builder_tools/catalog_search.rsindex 38f358f5cb..af159b646b 100644--- a/crates/openhuman-core/src/integrations/composio/builder_tools/catalog_search.rs+++ b/crates/openhuman-core/src/integrations/composio/builder_tools/catalog_search.rs@@ -99,7 +99,8 @@ impl Tool for SearchToolCatalogTool {toolkit = toolkit.unwrap_or("(any)"),"[flows] search_tool_catalog: searching the FULL LIVE Composio catalog (read-only)");- let outcome = search_catalog(&self.config, &query, toolkit, ranking::MAX_CATALOG_RESULTS).await;+ let outcome =+ search_catalog(&self.config, &query, toolkit, ranking::MAX_CATALOG_RESULTS).await;// Build with `note` first so an agent reading top-down sees the// near-miss / keyword-based advisory before the (possibly zero) rows.// `count` is always the number of returned rows, never a stand-in fordiff --git a/crates/openhuman-core/src/integrations/composio/builder_tools/catalog_search/ranking.rs b/crates/openhuman-core/src/integrations/composio/builder_tools/catalog_search/ranking.rsindex e1d28d39c2..52a8d5c46e 100644--- a/crates/openhuman-core/src/integrations/composio/builder_tools/catalog_search/ranking.rs+++ b/crates/openhuman-core/src/integrations/composio/builder_tools/catalog_search/ranking.rs@@ -1,7 +1,7 @@//! Query matching, stable curation ranking, and fallback scoring for live catalog search.-use serde_json::{json, Value};use crate::config::Config;+use serde_json::{json, Value};/// Cap on returned matches so a broad query can't flood the agent's context.pub(super) const MAX_CATALOG_RESULTS: usize = 40;@@ -289,4 +289,3 @@ pub(crate) async fn search_catalog()),}}-diff --git a/crates/openhuman-core/src/integrations/composio/builder_tools/connection_reads.rs b/crates/openhuman-core/src/integrations/composio/builder_tools/connection_reads.rsindex fc384d625c..324bbb64ee 100644--- a/crates/openhuman-core/src/integrations/composio/builder_tools/connection_reads.rs+++ b/crates/openhuman-core/src/integrations/composio/builder_tools/connection_reads.rs@@ -50,7 +50,9 @@ impl ListFlowConnectionsTool {#[async_trait]impl Tool for ListFlowConnectionsTool {- fn name(&self) -> &str { "list_flow_connections" }+ fn name(&self) -> &str {+ "list_flow_connections"+ }fn description(&self) -> &str {"List the connection sources a flow node's `connection_ref` can attach to: \Composio connected accounts and named HTTP credentials. Read-only; \@@ -66,10 +68,15 @@ impl Tool for ListFlowConnectionsTool {fn parameters_schema(&self) -> Value {json!({ "type": "object", "properties": {}, "additionalProperties": false })}- fn permission_level(&self) -> PermissionLevel { PermissionLevel::None }- fn external_effect(&self) -> bool { false }+ fn permission_level(&self) -> PermissionLevel {+ PermissionLevel::None+ }+ fn external_effect(&self) -> bool {+ false+ }async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {- self.execute_with_context(args, ToolCallOptions::default(), None).await+ self.execute_with_context(args, ToolCallOptions::default(), None)+ .await}async fn execute_with_context(&self,@@ -77,7 +84,8 @@ impl Tool for ListFlowConnectionsTool {_options: ToolCallOptions,tool_context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {- let dispatch = crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(tool_context);+ let dispatch =+ crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(tool_context);tracing::debug!(target: "flows", "[flows] list_flow_connections: enumerating connection refs (read-only)");match self.provider.list(&dispatch, &self.config).await {Ok(connections) => Ok(ToolResult::success(serde_json::to_string_pretty(@@ -150,4 +158,3 @@ impl Tool for ListConnectableToolkitsTool {)?))}}-diff --git a/crates/openhuman-core/src/integrations/composio/builder_tools/mod.rs b/crates/openhuman-core/src/integrations/composio/builder_tools/mod.rsindex 79b3ab5334..19648ddca2 100644--- a/crates/openhuman-core/src/integrations/composio/builder_tools/mod.rs+++ b/crates/openhuman-core/src/integrations/composio/builder_tools/mod.rs@@ -14,7 +14,10 @@ mod tool_contract;pub(crate) use catalog_search::search_live_catalog;pub use catalog_search::SearchToolCatalogTool;-pub use connection_reads::{ConnectableToolkitProvider, FlowConnectionProvider, ListConnectableToolkitsTool, ListFlowConnectionsTool};+pub use connection_reads::{+ ConnectableToolkitProvider, FlowConnectionProvider, ListConnectableToolkitsTool,+ ListFlowConnectionsTool,+};pub use tool_contract::{GetToolContractTool, GetToolOutputSampleTool};#[cfg(test)]diff --git a/crates/openhuman-core/src/integrations/composio/builder_tools/owner_tools_tests.rs b/crates/openhuman-core/src/integrations/composio/builder_tools/owner_tools_tests.rsindex c54c7fbc41..ac28dbd296 100644--- a/crates/openhuman-core/src/integrations/composio/builder_tools/owner_tools_tests.rs+++ b/crates/openhuman-core/src/integrations/composio/builder_tools/owner_tools_tests.rs@@ -1,12 +1,14 @@use super::*;-use std::sync::Arc;-use serde_json::{json, Value};use super::catalog_search::search_catalog;+use crate::config::Config;+use crate::integrations::composio::catalog::{+ seed_live_catalog_cache, seed_probe_cache, ProbedOutputSample, ToolContract,+};+use serde_json::{json, Value};+use std::sync::Arc;use tempfile::TempDir;use tinytools::{PermissionLevel, Tool};-use crate::config::Config;-use crate::integrations::composio::catalog::{seed_live_catalog_cache, seed_probe_cache, ProbedOutputSample, ToolContract};struct EmptyConnectableProvider;@@ -24,33 +26,82 @@ impl ConnectableToolkitProvider for EmptyConnectableProvider {#[tokio::test]async fn connectable_toolkits_uses_the_injected_host_snapshot_and_fails_closed_empty() {let tmp = TempDir::new().unwrap();- let tool = ListConnectableToolkitsTool::new(- test_config(&tmp),- Arc::new(EmptyConnectableProvider),- );+ let tool =+ ListConnectableToolkitsTool::new(test_config(&tmp), Arc::new(EmptyConnectableProvider));let result = tool.execute(json!({})).await.unwrap();assert!(!result.is_error, "{}", result.output());let value: Value = serde_json::from_str(&result.output()).unwrap();- assert!(value["toolkits"].as_array().unwrap().iter().all(|item| item["connected"] == false));+ assert!(value["toolkits"]+ .as_array()+ .unwrap()+ .iter()+ .all(|item| item["connected"] == false));}fn test_config(tmp: &TempDir) -> Arc<Config> {- let config = Config { workspace_dir: tmp.path().join("workspace"), action_dir: tmp.path().join("workspace"), config_path: tmp.path().join("config.toml"), ..Config::default() };+ let config = Config {+ workspace_dir: tmp.path().join("workspace"),+ action_dir: tmp.path().join("workspace"),+ config_path: tmp.path().join("config.toml"),+ ..Config::default()+ };std::fs::create_dir_all(&config.workspace_dir).unwrap();Arc::new(config)}fn seeded_gmail_send_contract() -> ToolContract {- ToolContract { slug: "GMAIL_SEND_EMAIL".into(), toolkit: "gmail".into(), description: Some("Send an email".into()), required_args: vec!["to".into(), "body".into()], input_schema: Some(json!({"type":"object","required":["to","body"]})), output_fields: vec!["id".into(),"threadId".into()], output_schema: Some(json!({"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"}}})), primary_array_path: None, is_curated: true }+ ToolContract {+ slug: "GMAIL_SEND_EMAIL".into(),+ toolkit: "gmail".into(),+ description: Some("Send an email".into()),+ required_args: vec!["to".into(), "body".into()],+ input_schema: Some(json!({"type":"object","required":["to","body"]})),+ output_fields: vec!["id".into(), "threadId".into()],+ output_schema: Some(+ json!({"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"}}}),+ ),+ primary_array_path: None,+ is_curated: true,+ }}fn spotify_curated_action() -> ToolContract {- ToolContract { slug: "SPOTIFY_START_PLAYBACK".into(), toolkit: "spotify".into(), description: Some("Start playback".into()), required_args: vec![], input_schema: Some(json!({"type":"object"})), output_fields: vec![], output_schema: None, primary_array_path: None, is_curated: true }+ ToolContract {+ slug: "SPOTIFY_START_PLAYBACK".into(),+ toolkit: "spotify".into(),+ description: Some("Start playback".into()),+ required_args: vec![],+ input_schema: Some(json!({"type":"object"})),+ output_fields: vec![],+ output_schema: None,+ primary_array_path: None,+ is_curated: true,+ }}fn twt_lookup() -> ToolContract {- ToolContract { slug: "TWTFALLBACKTEST_TWEET_LOOKUP".into(), toolkit: "twtfallbacktest".into(), description: Some("Look up a tweet".into()), required_args: vec!["id".into()], input_schema: None, output_fields: vec!["text".into()], output_schema: None, primary_array_path: None, is_curated: true }+ ToolContract {+ slug: "TWTFALLBACKTEST_TWEET_LOOKUP".into(),+ toolkit: "twtfallbacktest".into(),+ description: Some("Look up a tweet".into()),+ required_args: vec!["id".into()],+ input_schema: None,+ output_fields: vec!["text".into()],+ output_schema: None,+ primary_array_path: None,+ is_curated: true,+ }}fn twt_replies() -> ToolContract {- ToolContract { slug: "TWTFALLBACKTEST_LIST_REPLIES".into(), toolkit: "twtfallbacktest".into(), description: Some("List replies to a tweet".into()), required_args: vec!["tweet_id".into()], input_schema: None, output_fields: vec!["replies".into()], output_schema: None, primary_array_path: None, is_curated: true }+ ToolContract {+ slug: "TWTFALLBACKTEST_LIST_REPLIES".into(),+ toolkit: "twtfallbacktest".into(),+ description: Some("List replies to a tweet".into()),+ required_args: vec!["tweet_id".into()],+ input_schema: None,+ output_fields: vec!["replies".into()],+ output_schema: None,+ primary_array_path: None,+ is_curated: true,+ }}#[tokio::test]diff --git a/crates/openhuman-core/src/integrations/composio/builder_tools/tool_contract.rs b/crates/openhuman-core/src/integrations/composio/builder_tools/tool_contract.rsindex ee15d7928a..95cd2b9a55 100644--- a/crates/openhuman-core/src/integrations/composio/builder_tools/tool_contract.rs+++ b/crates/openhuman-core/src/integrations/composio/builder_tools/tool_contract.rs@@ -122,23 +122,28 @@ impl Tool for GetToolContractTool {&contract,)?))}- Err(crate::integrations::composio::catalog::ContractLookupError::InvalidSlug { slug }) => Ok(ToolResult::error(format!(+ Err(crate::integrations::composio::catalog::ContractLookupError::InvalidSlug {+ slug,+ }) => Ok(ToolResult::error(format!("Could not extract a toolkit from slug '{slug}' — it must look like \'<TOOLKIT>_<ACTION>' (e.g. 'GMAIL_SEND_EMAIL')."))),- Err(crate::integrations::composio::catalog::ContractLookupError::CatalogUnavailable { toolkit }) => {- Ok(ToolResult::error(format!(- "Could not fetch the live Composio catalog for toolkit '{toolkit}' (no backend \+ Err(+ crate::integrations::composio::catalog::ContractLookupError::CatalogUnavailable {+ toolkit,+ },+ ) => Ok(ToolResult::error(format!(+ "Could not fetch the live Composio catalog for toolkit '{toolkit}' (no backend \session, or a transient failure) — try again, or use search_tool_catalog to \confirm the toolkit is reachable."- )))- }- Err(crate::integrations::composio::catalog::ContractLookupError::ActionNotFound { slug, toolkit }) => {- Ok(ToolResult::error(format!(- "'{slug}' is not a real action in the '{toolkit}' toolkit's live catalog — use \+ ))),+ Err(crate::integrations::composio::catalog::ContractLookupError::ActionNotFound {+ slug,+ toolkit,+ }) => Ok(ToolResult::error(format!(+ "'{slug}' is not a real action in the '{toolkit}' toolkit's live catalog — use \search_tool_catalog to find a real slug."- )))- }+ ))),}}}diff --git a/crates/openhuman-core/src/integrations/composio/flow_backend.rs b/crates/openhuman-core/src/integrations/composio/flow_backend.rsindex 2661012741..adebcd3426 100644--- a/crates/openhuman-core/src/integrations/composio/flow_backend.rs+++ b/crates/openhuman-core/src/integrations/composio/flow_backend.rs@@ -2,10 +2,14 @@//! and approval decisions through `FlowCallPolicy`; Composio owns gate order,//! curation, preflight, account resolution, and dispatch.+use crate::security::approval::ApprovalTurnContext;+use crate::{+ config::Config,+ core::runtime::DispatchCtx,+ security::{GateDecision, SecurityPolicy},+};use async_trait::async_trait;use serde_json::Value;-use crate::{config::Config, core::runtime::DispatchCtx, security::{GateDecision, SecurityPolicy}};-use crate::security::approval::ApprovalTurnContext;pub(crate) async fn execute_for_connection(config: &Config,@@ -13,7 +17,10 @@ pub(crate) async fn execute_for_connection(args: Option<Value>,connection_id: Option<&str>,) -> Result<crate::integrations::composio::ComposioExecuteResponse, String> {- crate::integrations::composio::module_client::call::<_, crate::integrations::composio::ComposioExecuteResponse>(+ crate::integrations::composio::module_client::call::<+ _,+ crate::integrations::composio::ComposioExecuteResponse,+ >(config,tinyconnectors_bus::names::methods::EXECUTE,crate::integrations::composio::types::ComposioExecuteRequest {@@ -68,40 +75,76 @@ pub(crate) async fn invoke(let live = crate::config::ops::reload_config_snapshot_with_timeout(ctx.config).await.map_err(|_| policy_refresh_error())?;- if live.recovered_from_corruption { return Err(policy_refresh_error()); }+ if live.recovered_from_corruption {+ return Err(policy_refresh_error());+ }// Keep the privacy-sensitive tier decision before curation so a read-only// caller cannot probe which actions are in scope.let class = crate::integrations::composio::flow_gate::classify_composio_action_for_tier(slug);- let decision = ctx.policy.tier_decision(ctx.dispatch, ctx.config, &live, ctx.security, class).await?;- if !crate::integrations::composio::flow_gate::is_curated_flow_tool(ctx.dispatch, &live, slug).await {+ let decision = ctx+ .policy+ .tier_decision(ctx.dispatch, ctx.config, &live, ctx.security, class)+ .await?;+ if !crate::integrations::composio::flow_gate::is_curated_flow_tool(ctx.dispatch, &live, slug)+ .await+ {return Err(format!("tool not permitted: {slug}"));}preflight(&live, slug, &args).await?;- let audit_id = if decision == GateDecision::Allow { None } else {- ctx.policy.approve(ctx.dispatch, ctx.approval, decision, slug, &args).await?+ let audit_id = if decision == GateDecision::Allow {+ None+ } else {+ ctx.policy+ .approve(ctx.dispatch, ctx.approval, decision, slug, &args)+ .await?};- let connection_id = conn.and_then(crate::integrations::composio::flow_gate::composio_connection_id);+ let connection_id =+ conn.and_then(crate::integrations::composio::flow_gate::composio_connection_id);let resolved_account = match connection_id {- Some(id) => Some((id, crate::integrations::composio::flow_gate::resolve_composio_account(&live, id).await)),+ Some(id) => Some((+ id,+ crate::integrations::composio::flow_gate::resolve_composio_account(&live, id).await,+ )),None => None,};match &resolved_account {- Some((id, Some((toolkit, _)))) => tracing::info!(target: "flows", %slug, connection_id = %id, %toolkit, mode = live.composio.mode.as_str(), "[flows] tool_call: executing against the resolved connected account"),- Some((id, None)) => tracing::warn!(target: "flows", %slug, connection_id = %id, mode = live.composio.mode.as_str(), "[flows] tool_call: connection_ref connection_id not found among the user's live connected accounts (stale cache or foreign id) — forwarding the exact id so the provider can reject it rather than falling back to an ambient account"),- None => tracing::debug!(target: "flows", %slug, mode = live.composio.mode.as_str(), "[flows] tool_call: no connection_ref — using the ambient signed-in account"),+ Some((id, Some((toolkit, _)))) => {+ tracing::info!(target: "flows", %slug, connection_id = %id, %toolkit, mode = live.composio.mode.as_str(), "[flows] tool_call: executing against the resolved connected account")+ }+ Some((id, None)) => {+ tracing::warn!(target: "flows", %slug, connection_id = %id, mode = live.composio.mode.as_str(), "[flows] tool_call: connection_ref connection_id not found among the user's live connected accounts (stale cache or foreign id) — forwarding the exact id so the provider can reject it rather than falling back to an ambient account")+ }+ None => {+ tracing::debug!(target: "flows", %slug, mode = live.composio.mode.as_str(), "[flows] tool_call: no connection_ref — using the ambient signed-in account")+ }+ }+ let response = execute_for_connection(+ &live,+ slug,+ (!args.is_null()).then_some(args),+ connection_id,+ )+ .await+ .and_then(|result| {+ crate::integrations::composio::flow_gate::reject_unsuccessful_composio_response(+ slug, result,+ )+ .map_err(|error| error.to_string())+ })+ .and_then(|result| serde_json::to_value(result).map_err(|error| error.to_string()));+ if let Some(audit_id) = audit_id {+ ctx.policy.record(&audit_id, &response);}- let response = execute_for_connection(&live, slug, (!args.is_null()).then_some(args), connection_id)- .await- .and_then(|result| crate::integrations::composio::flow_gate::reject_unsuccessful_composio_response(slug, result).map_err(|error| error.to_string()))- .and_then(|result| serde_json::to_value(result).map_err(|error| error.to_string()));- if let Some(audit_id) = audit_id { ctx.policy.record(&audit_id, &response); }response}fn policy_refresh_error() -> String {- format!("{} flows autonomy and Composio settings could not be refreshed; refusing the node", tinytools::status::POLICY_BLOCKED_MARKER)+ format!(+ "{} flows autonomy and Composio settings could not be refreshed; refusing the node",+ tinytools::status::POLICY_BLOCKED_MARKER+ )}#[cfg(test)]diff --git a/crates/openhuman-core/src/integrations/composio/flow_backend_tests.rs b/crates/openhuman-core/src/integrations/composio/flow_backend_tests.rsindex 823953dbc6..f973b390f0 100644--- a/crates/openhuman-core/src/integrations/composio/flow_backend_tests.rs+++ b/crates/openhuman-core/src/integrations/composio/flow_backend_tests.rs@@ -2,9 +2,9 @@ use super::*;use axum::{routing::post, Json, Router};use serde_json::{json, Value};-use crate::integrations::composio::module_client::module_guard;-use crate::integrations::composio::flow_backend::execute_for_connection;use crate::config::Config;+use crate::integrations::composio::flow_backend::execute_for_connection;+use crate::integrations::composio::module_client::module_guard;/// Regression for #5751: the flow adapter used to parse and log the chosen/// account, then call `execute_tool` without it. The request therefore randiff --git a/crates/openhuman-core/src/integrations/composio/mod.rs b/crates/openhuman-core/src/integrations/composio/mod.rsindex f1b0f11a4a..0485448649 100644--- a/crates/openhuman-core/src/integrations/composio/mod.rs+++ b/crates/openhuman-core/src/integrations/composio/mod.rs@@ -38,8 +38,8 @@//! crate::core::events::DomainEvent::ComposioTriggerReceivedpub mod action_tool;-pub mod bus;pub(crate) mod builder_tools;+pub mod bus;pub mod catalog;pub mod client;pub mod connected_integrations;@@ -49,8 +49,8 @@ pub(crate) mod direct_auth;pub mod execute_dispatch;pub(crate) mod file_store;mod file_store_documents;-pub mod flow_gate;pub(crate) mod flow_backend;+pub mod flow_gate;pub mod googlecalendar_args;pub mod identity;pub mod identity_store;