Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(composio): handle missing identity fields gracefully

Steven Enamakelf06c92d9570a
diff --git a/src/openhuman/integrations/composio/identity.rs b/src/openhuman/integrations/composio/identity.rs
index 59383d78d8..0a888e14d1 100644
--- a/src/openhuman/integrations/composio/identity.rs
+++ b/src/openhuman/integrations/composio/identity.rs
@@ -28,26 +28,26 @@
//! `None` into a clear "GitHub identity not resolved — reconnect via
//! `composio_authorize github`" error.
-use std::sync::Arc;
-
use crate::openhuman::config::Config;
+use super::module_client::{self as connectors, methods};
use super::ops::fetch_connected_integrations;
-use super::providers::{get_provider, ProviderContext};
+use super::types::ComposioUserProfileRequest;
/// Resolve the connected account's username for the given Composio
-/// toolkit, going through the existing per-provider `fetch_user_profile`
-/// path.
+/// toolkit, going through the `tinyconnectors` module's `GetUserProfile`.
///
/// Returns `Some(username)` when:
-/// 1. The toolkit has a registered provider; AND
-/// 2. The toolkit is currently connected (per
+/// 1. The toolkit is currently connected (per
/// [`fetch_connected_integrations`]); AND
-/// 3. The provider's `fetch_user_profile` call succeeds AND yields a
+/// 2. The module's `GetUserProfile` call succeeds AND yields a
/// non-empty `username`.
///
-/// Returns `None` for any other case. See module docs for the failure
-/// contract.
+/// Returns `None` for any other case, including a toolkit the module has no
+/// identity provider for — the same "no provider registered" outcome the
+/// deleted engine's `get_provider(toolkit).is_none()` used to answer, now
+/// discovered from the module's own reply instead of a host-side registry
+/// lookup. See module docs for the failure contract.
pub async fn connection_identity(config: &Config, toolkit: &str) -> Option<String> {
let toolkit_norm = toolkit.trim().to_ascii_lowercase();
if toolkit_norm.is_empty() {
@@ -55,20 +55,8 @@ pub async fn connection_identity(config: &Config, toolkit: &str) -> Option<Strin
return None;
}
- // (1) Provider must exist for this toolkit.
- let provider = match get_provider(&toolkit_norm) {
- Some(p) => p,
- None => {
- tracing::debug!(
- toolkit = %toolkit_norm,
- "[composio:identity] no provider registered for toolkit"
- );
- return None;
- }
- };
-
- // (2) Toolkit must be in the active integrations set. This is the
- // same source of truth Connections uses.
+ // Toolkit must be in the active integrations set. This is the same
+ // source of truth Connections uses.
let connections = fetch_connected_integrations(config).await;
let matching = connections
.iter()
@@ -81,12 +69,17 @@ pub async fn connection_identity(config: &Config, toolkit: &str) -> Option<Strin
return None;
}
- // (3) Build a provider context and call fetch_user_profile.
- // `ProviderContext::from_config` probes the Composio factory and
- // returns `None` when the user isn't signed in at all — same
- // short-circuit other consumers rely on.
- let ctx = ProviderContext::from_config(Arc::new(config.clone()), &toolkit_norm, None)?;
- match provider.fetch_user_profile(&ctx).await {
+ let profile = connectors::call::<_, super::types::ComposioUserProfile>(
+ config,
+ methods::GET_USER_PROFILE,
+ ComposioUserProfileRequest {
+ toolkit: toolkit_norm.clone(),
+ connection_id: None,
+ },
+ )
+ .await;
+
+ match profile {
Ok(profile) => {
let username = profile.username.as_deref().map(str::trim).unwrap_or("");
if username.is_empty() {
@@ -108,7 +101,7 @@ pub async fn connection_identity(config: &Config, toolkit: &str) -> Option<Strin
tracing::debug!(
toolkit = %toolkit_norm,
error = %e,
- "[composio:identity] fetch_user_profile failed"
+ "[composio:identity] GetUserProfile failed"
);
None
}