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 missing connected integrations gracefully
Steven Enamakel4259ce1b3227
diff --git a/crates/openhuman-core/src/integrations/composio/client/factory.rs b/crates/openhuman-core/src/integrations/composio/client/factory.rsindex 69fd535e1a..1688d71529 100644--- a/crates/openhuman-core/src/integrations/composio/client/factory.rs+++ b/crates/openhuman-core/src/integrations/composio/client/factory.rs@@ -23,11 +23,10 @@ use super::connections::ComposioClient;/// surface.////// Composio is **always enabled** — there are no configuration flags-/// gating it. The backend URL and auth token come from the shared-/// core defaults (`config.api_url` plus the app-session JWT) via-/// [`crate::integrations::build_client`]. The only reason-/// this returns `None` is that the user isn't signed in to the backend-/// (no JWT). Direct-mode availability is orthogonal — see+/// gating it. The backend URL and credential come from the shared+/// core defaults (`config.api_url` plus the TinyHumans API key or the+/// app-session JWT) via [`crate::integrations::build_client`]. The only+/// reason this returns `None` is that there is no backend credential. Direct-mode availability is orthogonal — see/// [`create_composio_client`].pub(crate) fn build_composio_client(config: &crate::config::Config) -> Option<ComposioClient> {let inner = crate::integrations::build_client(config)?;@@ -163,7 +162,7 @@ pub fn create_composio_client(let client = build_composio_client(config).ok_or_else(|| {anyhow::anyhow!("composio backend mode unavailable: no backend session token. \- Sign in first (auth_store_session)."+ Sign in or set a TinyHumans API key.")})?;tracing::debug!("[composio-factory] resolved backend variant");diff --git a/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs b/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rsindex 96271e355f..f0be3477fd 100644--- a/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs+++ b/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs@@ -71,7 +71,10 @@ pub async fn fetch_connected_integrations_status(// credential. Asking the hosted integrations endpoint with it yields 401,// can race the scheduler gate into signed-out state, and cannot discover a// real connection. An authoritative empty set keeps this session local.+ // A stored API key outranks the local session (`resolve_backend_credential`),+ // so it still reaches the backend.if config.composio.mode.trim() != crate::config::schema::COMPOSIO_MODE_DIRECT+ && !crate::security::credentials::api_key::has_api_key(config)&& crate::security::credentials::session_support::get_session_token(config).ok().flatten()diff --git a/crates/openhuman-core/src/integrations/composio/ops/error_utils.rs b/crates/openhuman-core/src/integrations/composio/ops/error_utils.rsindex 334a1c4f2b..5145345577 100644--- a/crates/openhuman-core/src/integrations/composio/ops/error_utils.rs+++ b/crates/openhuman-core/src/integrations/composio/ops/error_utils.rs@@ -30,13 +30,13 @@ pub(crate) fn should_forward_tags(toolkits: Option<&[String]>) -> bool {/// Result alias used by every `composio_*` op in this module.pub(super) type OpResult<T> = std::result::Result<T, String>;-/// The answer every backend-mode member gives while there is no app-session-/// JWT. Shared so the members agree on the wording, and because the wording is+/// The answer every backend-mode member gives while there is no backend+/// credential (neither an app-session JWT nor a TinyHumans API key). Shared so the members agree on the wording, and because the wording is/// load-bearing: `is_session_expired_message` recognises "no backend session/// token", so the JSON-RPC boundary demotes this to an expected user-state/// error instead of paging Sentry.pub(crate) const COMPOSIO_NO_SESSION: &str =- "composio unavailable: no backend session token. Sign in first (auth_store_session).";+ "composio unavailable: no backend session token. Sign in or set a TinyHumans API key.";/// Resolve a backend-mode [`ComposioClient`] from the root config, or/// return an error string that the caller can surface over RPC.@@ -79,7 +79,8 @@ pub(crate) fn direct_mode_without_key(config: &Config) -> OpResult<bool> {}/// True when the user is in Composio **backend** mode (the default) but has no-/// app-session JWT yet — a fresh install before sign-in, or signed out.+/// backend credential yet — a fresh install before sign-in, or signed out, and+/// no TinyHumans API key stored.////// Like [`direct_mode_without_key`], this is a valid *setup* state, not an/// operation failure. Without a session there is no proxy route to give the@@ -96,11 +97,11 @@ pub(crate) fn direct_mode_without_key(config: &Config) -> OpResult<bool> {/// `flows::validate_connection_refs` rely on `Err` meaning "unknown" (fail/// open) rather than "none".///-/// Session presence MUST mirror the module route's own resolution:-/// `module_config` calls `integrations::build_client`, whose only token source-/// is the app-session JWT (`crate::api::jwt::get_session_token`). Read that-/// same source — not `build_client` itself, which logs a warning per call and-/// would recreate the noise this guard removes.+/// Credential presence MUST mirror the module route's own resolution:+/// `module_config` calls `integrations::build_client`, which takes the stored+/// API key first and the app-session JWT otherwise. Read those same sources —+/// not `build_client` itself, which logs per call and would recreate the noise+/// this guard removes.////// A *failed* token lookup (store unreadable) deliberately returns `false`:/// that is a real fault, and it must keep surfacing through the normal error@@ -110,6 +111,9 @@ pub(crate) fn backend_mode_without_session(config: &Config) -> bool {if !(mode.is_empty() || mode == crate::config::schema::COMPOSIO_MODE_BACKEND) {return false;}+ if crate::security::credentials::api_key::has_api_key(config) {+ return false;+ }match crate::api::jwt::get_session_token(config) {Ok(token) => token.as_deref().map(str::trim).is_none_or(|token| {token.is_empty()