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): keep a host-pinned agent's config at tool call time
oxoxDev565c32539e1f
diff --git a/crates/openhuman-core/src/integrations/composio/action_tool.rs b/crates/openhuman-core/src/integrations/composio/action_tool.rsindex 2a8cac0485..efcccdc36c 100644--- a/crates/openhuman-core/src/integrations/composio/action_tool.rs+++ b/crates/openhuman-core/src/integrations/composio/action_tool.rs@@ -169,7 +169,7 @@ impl ComposioActionTool {/// snapshot when there is one, else the core's read path.async fn live_config(&self) -> Result<Config, String> {match self.config.as_deref() {- Some(snapshot) => config_rpc::reload_config_snapshot_with_timeout(snapshot).await,+ Some(snapshot) => super::tools::live_composio_config(snapshot).await,None => config_rpc::load_config_with_timeout().await,}}diff --git a/crates/openhuman-core/src/integrations/composio/tools.rs b/crates/openhuman-core/src/integrations/composio/tools.rsindex abdfc4fe56..58f0dab3d3 100644--- a/crates/openhuman-core/src/integrations/composio/tools.rs+++ b/crates/openhuman-core/src/integrations/composio/tools.rs@@ -32,6 +32,7 @@ mod execute;mod list_connections;mod list_toolkits;mod list_tools;+mod live_config;mod registry;mod visibility;@@ -44,6 +45,7 @@ mod tests;pub use direct::{ComposioAction, ComposioConnectedAccount, ComposioTool};pub use execute::ComposioExecuteTool;pub use registry::all_composio_agent_tools;+pub(crate) use live_config::live_composio_config;// Brought into this module's own namespace (private `use`, not `pub use`)// so `tools_tests.rs` — declared as a direct child module of `tools` abovediff --git a/crates/openhuman-core/src/integrations/composio/tools/authorize.rs b/crates/openhuman-core/src/integrations/composio/tools/authorize.rsindex b0bf853041..466091560f 100644--- a/crates/openhuman-core/src/integrations/composio/tools/authorize.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/authorize.rs@@ -5,7 +5,7 @@ use std::sync::Arc;use async_trait::async_trait;use serde_json::{json, Value};-use crate::config::rpc as config_rpc;+use super::live_config::live_composio_config;use crate::config::Config;use tinytools::{PermissionLevel, Tool, ToolCategory, ToolResult};@@ -72,13 +72,8 @@ impl Tool for ComposioAuthorizeTool {// the backend's `/agent-integrations/composio/authorize`// route, so we refuse this verb explicitly instead of// silently routing through the wrong tenant.- // [#1710 Wave 4] Reload config fresh per execute so a mid-session- // `composio.mode` toggle takes effect at the very next tool call.- // Anchor the reload to this tool's original config path rather- // than re-resolving process-global `OPENHUMAN_WORKSPACE`; the- // tool is scoped to the user/workspace it was created for.let live_config =- match config_rpc::reload_config_snapshot_with_timeout(self.config.as_ref()).await {+ match live_composio_config(self.config.as_ref()).await {Ok(c) => c,Err(e) => {tracing::warn!(error = %e, "[composio] tool: load_config failed");diff --git a/crates/openhuman-core/src/integrations/composio/tools/connect.rs b/crates/openhuman-core/src/integrations/composio/tools/connect.rsindex bfd17b201c..96cec69440 100644--- a/crates/openhuman-core/src/integrations/composio/tools/connect.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/connect.rs@@ -8,7 +8,7 @@ use std::sync::Arc;use async_trait::async_trait;use serde_json::{json, Value};-use crate::config::rpc as config_rpc;+use super::live_config::live_composio_config;use crate::config::Config;use tinytools::{PermissionLevel, Tool, ToolCategory, ToolResult};@@ -191,12 +191,9 @@ impl Tool for ComposioConnectTool {)));}- // Reload config per call so a mid-session `composio.mode` toggle is- // honoured (#1710), then skip the card entirely if the toolkit is- // already connected — avoids a flash of a Connect card that would- // immediately resolve.+ // Skip the card when the toolkit is already connected.let live_config =- match config_rpc::reload_config_snapshot_with_timeout(self.config.as_ref()).await {+ match live_composio_config(self.config.as_ref()).await {Ok(c) => c,Err(e) => {tracing::warn!(error = %e, "[composio] connect.execute: load_config failed");diff --git a/crates/openhuman-core/src/integrations/composio/tools/execute.rs b/crates/openhuman-core/src/integrations/composio/tools/execute.rsindex fbc82d5ea5..657db7d007 100644--- a/crates/openhuman-core/src/integrations/composio/tools/execute.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/execute.rs@@ -10,7 +10,7 @@ use serde_json::{json, Value};use crate::agent::harness::current_sandbox_mode;use crate::agent::harness::current_task_recency_window;use crate::agent::harness::definition::SandboxMode;-use crate::config::rpc as config_rpc;+use super::live_config::live_composio_config;use crate::config::Config;use tinytools::{PermissionLevel, Tool, ToolCategory, ToolResult};@@ -236,16 +236,7 @@ impl Tool for ComposioExecuteTool {// (#1710). The pre-baked-client variant of this code routed all// executions through the backend tinyhumans tenant regardless// of mode — silently breaking direct mode for tool execution.- // [#1710 Wave 4] Reload config fresh per execute so a mid-session- // `composio.mode` toggle takes effect at the very next tool call.- // Anchor the reload to this tool's original config path rather- // than re-resolving process-global `OPENHUMAN_WORKSPACE`; the- // tool is scoped to the user/workspace it was created for.- let live_config = match config_rpc::reload_config_snapshot_with_timeout(- self.config.as_ref(),- )- .await- {+ let live_config = match live_composio_config(self.config.as_ref()).await {Ok(c) => c,Err(e) => {tracing::warn!(error = %e, "[composio] tool execute.execute: load_config failed");diff --git a/crates/openhuman-core/src/integrations/composio/tools/list_connections.rs b/crates/openhuman-core/src/integrations/composio/tools/list_connections.rsindex 815c0e50fa..19e67427de 100644--- a/crates/openhuman-core/src/integrations/composio/tools/list_connections.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/list_connections.rs@@ -5,7 +5,7 @@ use std::sync::Arc;use async_trait::async_trait;use serde_json::{json, Value};-use crate::config::rpc as config_rpc;+use super::live_config::live_composio_config;use crate::config::Config;use tinytools::{PermissionLevel, Tool, ToolCategory, ToolResult};@@ -53,16 +53,7 @@ impl Tool for ComposioListConnectionsTool {// empty list regardless of the user's actual Composio connections,// which caused the agent to incorrectly conclude that no integrations// were linked and prompt unnecessary re-authorization (#1710).- // [#1710 Wave 4] Reload config fresh per execute so a mid-session- // `composio.mode` toggle takes effect at the very next tool call.- // Anchor the reload to this tool's original config path rather- // than re-resolving process-global `OPENHUMAN_WORKSPACE`; the- // tool is scoped to the user/workspace it was created for.- let live_config = match config_rpc::reload_config_snapshot_with_timeout(- self.config.as_ref(),- )- .await- {+ let live_config = match live_composio_config(self.config.as_ref()).await {Ok(c) => c,Err(e) => {tracing::warn!(error = %e, "[composio] list_connections.execute: load_config failed");diff --git a/crates/openhuman-core/src/integrations/composio/tools/list_toolkits.rs b/crates/openhuman-core/src/integrations/composio/tools/list_toolkits.rsindex 0e06605c28..864ba5a8b1 100644--- a/crates/openhuman-core/src/integrations/composio/tools/list_toolkits.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/list_toolkits.rs@@ -5,7 +5,7 @@ use std::sync::Arc;use async_trait::async_trait;use serde_json::{json, Value};-use crate::config::rpc as config_rpc;+use super::live_config::live_composio_config;use crate::config::Config;use tinytools::{PermissionLevel, Tool, ToolCategory, ToolResult};@@ -55,13 +55,8 @@ impl Tool for ComposioListToolkitsTool {// governs availability, so we return an empty toolkits list// with an explanatory log instead of silently routing through// the backend tinyhumans tenant (#1710).- // [#1710 Wave 4] Reload config fresh per execute so a mid-session- // `composio.mode` toggle takes effect at the very next tool call.- // Anchor the reload to this tool's original config path rather- // than re-resolving process-global `OPENHUMAN_WORKSPACE`; the- // tool is scoped to the user/workspace it was created for.let live_config =- match config_rpc::reload_config_snapshot_with_timeout(self.config.as_ref()).await {+ match live_composio_config(self.config.as_ref()).await {Ok(c) => c,Err(e) => {tracing::warn!(error = %e, "[composio] tool: load_config failed");diff --git a/crates/openhuman-core/src/integrations/composio/tools/list_tools.rs b/crates/openhuman-core/src/integrations/composio/tools/list_tools.rsindex bbd474a249..57dd631adb 100644--- a/crates/openhuman-core/src/integrations/composio/tools/list_tools.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/list_tools.rs@@ -6,7 +6,7 @@ use std::sync::Arc;use async_trait::async_trait;use serde_json::{json, Value};-use crate::config::rpc as config_rpc;+use super::live_config::live_composio_config;use crate::config::Config;use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolCategory, ToolResult};@@ -130,13 +130,8 @@ impl Tool for ComposioListToolsTool {// pattern. Surfacing the empty list explicitly is correct// fail-mode: the alternative — falling through to the backend// path — is exactly the bug we're closing (#1710).- // [#1710 Wave 4] Reload config fresh per execute so a mid-session- // `composio.mode` toggle takes effect at the very next tool call.- // Anchor the reload to this tool's original config path rather- // than re-resolving process-global `OPENHUMAN_WORKSPACE`; the- // tool is scoped to the user/workspace it was created for.let live_config =- match config_rpc::reload_config_snapshot_with_timeout(self.config.as_ref()).await {+ match live_composio_config(self.config.as_ref()).await {Ok(c) => c,Err(e) => {tracing::warn!(error = %e, "[composio] tool: load_config failed");diff --git a/crates/openhuman-core/src/integrations/composio/tools/live_config.rs b/crates/openhuman-core/src/integrations/composio/tools/live_config.rsnew file mode 100644index 0000000000..4f054f166a--- /dev/null+++ b/crates/openhuman-core/src/integrations/composio/tools/live_config.rs@@ -0,0 +1,19 @@+//! [`live_composio_config`]: the config a Composio tool resolves its client+//! from on each call.++use crate::config::rpc as config_rpc;+use crate::config::Config;++/// The config one Composio tool call runs under.+///+/// A host-pinned credential makes the tool's own snapshot authoritative, so+/// an embedded agent keeps its own key, mode and entity. Otherwise the+/// snapshot's `config_path` is reloaded so a live `composio.mode` toggle takes+/// effect on the next call.+pub(crate) async fn live_composio_config(snapshot: &Config) -> Result<Config, String> {+ if snapshot.composio.host_credential.is_some() {+ tracing::debug!("[composio] host-pinned credential — using the agent's config");+ return Ok(snapshot.clone());+ }+ config_rpc::reload_config_snapshot_with_timeout(snapshot).await+}