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(memory): canonicalize Composio toolkit slugs in memory sources
M3gA-Mind20da1872b317
diff --git a/crates/openhuman-core/src/integrations/composio/tools.rs b/crates/openhuman-core/src/integrations/composio/tools.rsindex f4661eb6df..5883e00838 100644--- a/crates/openhuman-core/src/integrations/composio/tools.rs+++ b/crates/openhuman-core/src/integrations/composio/tools.rs@@ -51,13 +51,14 @@ pub use registry::all_composio_agent_tools;// — can still reach these via a plain `use super::*;`, exactly as when// this was one un-split file. See each item's `pub(super)` in its owning// submodule.+pub(crate) use connect::canonicalize_toolkit_slug;pub(crate) use visibility::{action_mutates_external_state, resolve_action_scope};pub use authorize::ComposioAuthorizeTool;#[cfg(test)]use connect::{- canonicalize_toolkit_slug, connection_is_active, parse_composio_connect_timeout,- ComposioConnectTool, DEFAULT_COMPOSIO_CONNECT_TIMEOUT_SECS,+ connection_is_active, parse_composio_connect_timeout, ComposioConnectTool,+ DEFAULT_COMPOSIO_CONNECT_TIMEOUT_SECS,};pub use list_connections::ComposioListConnectionsTool;pub use list_toolkits::ComposioListToolkitsTool;diff --git a/crates/openhuman-core/src/integrations/composio/tools/connect.rs b/crates/openhuman-core/src/integrations/composio/tools/connect.rsindex 0214186a68..c449568988 100644--- a/crates/openhuman-core/src/integrations/composio/tools/connect.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/connect.rs@@ -25,7 +25,7 @@ use super::super::types::{ComposioConnectionsResponse, ComposioToolkitsResponse}/// The agent frequently guesses `google_drive` where Composio uses/// `googledrive` (#3993); without this the OAuth handoff fails with an opaque/// error.-pub(super) fn canonicalize_toolkit_slug(slug: &str) -> String {+pub(crate) fn canonicalize_toolkit_slug(slug: &str) -> String {let key = slug.trim().to_ascii_lowercase();match key.as_str() {"feishu" | "lark" => "larksuite".to_string(),diff --git a/crates/openhuman-core/src/memory/sources/composio.rs b/crates/openhuman-core/src/memory/sources/composio.rsindex caa8c05b94..133f653647 100644--- a/crates/openhuman-core/src/memory/sources/composio.rs+++ b/crates/openhuman-core/src/memory/sources/composio.rs@@ -142,14 +142,15 @@ pub async fn sync_toolkit(/// `composio:<toolkit>`.#[must_use]pub fn source_id_for_toolkit(config: &Config, toolkit: &str) -> String {- let toolkit = toolkit.to_ascii_lowercase();+ use crate::integrations::composio::tools::canonicalize_toolkit_slug;+ let toolkit = canonicalize_toolkit_slug(toolkit);config.memory.sources.iter().find(|source| {source.kind == crate::config::schema::MemorySourceKind::Composio- && source.target == toolkit+ && canonicalize_toolkit_slug(&source.target) == toolkit}).map_or_else(|| format!("composio:{toolkit}"), |source| source.id.clone())}diff --git a/crates/openhuman-core/src/memory/sources/composio_tests.rs b/crates/openhuman-core/src/memory/sources/composio_tests.rsindex 94b630e8e2..37f0af3139 100644--- a/crates/openhuman-core/src/memory/sources/composio_tests.rs+++ b/crates/openhuman-core/src/memory/sources/composio_tests.rs@@ -168,6 +168,22 @@ fn source_id_for_toolkit_prefers_the_configured_source() {});assert_eq!(source_id_for_toolkit(&config, "GMAIL"), "src-gmail");assert_eq!(source_id_for_toolkit(&config, "notion"), "composio:notion");++ // A source saved before targets were canonicalized still matches the+ // slug Composio reports for its connections.+ config+ .memory+ .sources+ .push(crate::config::schema::MemorySourceConfig {+ id: "src-drive".into(),+ kind: MemorySourceKind::Composio,+ target: "google_drive".into(),+ label: "Drive".into(),+ schedule_mins: None,+ namespace: None,+ });+ assert_eq!(source_id_for_toolkit(&config, "googledrive"), "src-drive");+ assert_eq!(source_id_for_toolkit(&config, "google_drive"), "src-drive");}#[tokio::test]diff --git a/crates/openhuman-core/src/memory/sources/mod.rs b/crates/openhuman-core/src/memory/sources/mod.rsindex cff09b3e2a..fa5a212046 100644--- a/crates/openhuman-core/src/memory/sources/mod.rs+++ b/crates/openhuman-core/src/memory/sources/mod.rs@@ -86,7 +86,7 @@ pub fn normalize_target(kind: MemorySourceKind, target: &str) -> MemoryResult<St.chars().all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-'){- Ok(target.to_ascii_lowercase())+ Ok(crate::integrations::composio::tools::canonicalize_toolkit_slug(target))} else {Err(MemoryError::invalid("a Composio target is a toolkit slug"))}diff --git a/crates/openhuman-core/src/memory/sources/mod_tests.rs b/crates/openhuman-core/src/memory/sources/mod_tests.rsindex 6de7006935..9b8168110e 100644--- a/crates/openhuman-core/src/memory/sources/mod_tests.rs+++ b/crates/openhuman-core/src/memory/sources/mod_tests.rs@@ -55,6 +55,10 @@ fn normalize_target_accepts_each_kinds_shape() {normalize_target(MemorySourceKind::Composio, "GMail").unwrap(),"gmail");+ assert_eq!(+ normalize_target(MemorySourceKind::Composio, "Google_Drive").unwrap(),+ "googledrive"+ );}#[test]