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
feat(composio): add direct tool execution with HTTP transport and error handling
Steven Enamakeld60e2fd9949f
diff --git a/crates/openhuman-core/src/integrations/composio/tools.rs b/crates/openhuman-core/src/integrations/composio/tools.rsindex dbd0331ca0..f4661eb6df 100644--- a/crates/openhuman-core/src/integrations/composio/tools.rs+++ b/crates/openhuman-core/src/integrations/composio/tools.rs@@ -24,8 +24,6 @@//! the right slug and supply valid arguments without a separate round//! trip.-mod direct;-mod authorize;mod connect;mod execute;@@ -43,7 +41,6 @@ mod visibility;#[path = "tools_tests.rs"]mod tests;-pub use direct::DirectComposioClient;pub use execute::ComposioExecuteTool;pub(crate) use live_config::live_composio_config;pub(crate) use redact::redact_composio_outcome;diff --git a/crates/openhuman-core/src/integrations/composio/tools/direct.rs b/crates/openhuman-core/src/integrations/composio/tools/direct.rsdeleted file mode 100644index a61acc72fb..0000000000--- a/crates/openhuman-core/src/integrations/composio/tools/direct.rs+++ /dev/null@@ -1,27 +0,0 @@-// Host-side HTTP transport for Composio's own v3 API with the user's key.-//-// What Composio's direct route sends and how it reshapes the answer is-// `tinyconnectors::client::DirectRoute` (paths, `limit=200`,-// `toolkit_versions=latest` (#3932), repeated `tags=`, blank-id filtering,-// v3-to-envelope translation). This module is only the seam the route needs-// from the host: a `Transport` that carries the key, refuses non-HTTPS bases,-// never follows redirects, and goes out through the host's proxy and TLS-// settings, plus the pre-store API-key probe's client.--#[cfg(test)]-#[path = "direct_tests.rs"]-mod tests;--mod construction;-mod http_errors;-mod transport;-mod types;--pub use types::DirectComposioClient;--// Test-only bridges: the flat `direct_tests.rs` module still expects these-// internal helpers to be reachable unqualified via `use super::*`.-#[cfg(test)]-use http_errors::{extract_api_error_message, sanitize_error_message};-#[cfg(test)]-use types::{ensure_https, is_loopback_http_url, COMPOSIO_API_BASE_V3};diff --git a/crates/openhuman-core/src/integrations/composio/tools/direct/construction.rs b/crates/openhuman-core/src/integrations/composio/tools/direct/construction.rsdeleted file mode 100644index d310c8c585..0000000000--- a/crates/openhuman-core/src/integrations/composio/tools/direct/construction.rs+++ /dev/null@@ -1,128 +0,0 @@-//! Constructors and the small per-request setup helpers (`client`,-//! `ensure_request_url`) that every other `DirectComposioClient` impl block-//! relies on.--use super::types::{- ensure_https, is_loopback_http_base, is_loopback_http_url, DirectComposioClient,- COMPOSIO_API_BASE_V3,-};-use reqwest::Client;--impl DirectComposioClient {- pub fn new(api_key: &str) -> Self {- // Production always pins the real HTTPS endpoint.- Self::new_internal(api_key, COMPOSIO_API_BASE_V3.to_string(), false)- }-- pub(crate) fn auth_key_fingerprint(&self) -> u64 {- crate::integrations::composio::direct_auth::fingerprint_api_key(&self.api_key)- }-- /// Debug-test seam for raw integration coverage: construct a direct- /// Composio client against explicit v2/v3 base URLs. Non-HTTPS URLs are- /// accepted only for loopback hosts and only in debug builds.- ///- /// The v2 root is validated for the same safety rule but not stored: no- /// remaining request path uses it.- #[cfg(debug_assertions)]- pub fn new_with_base_urls_for_loopback(- api_key: &str,- base_v2: String,- base_v3: String,- ) -> anyhow::Result<Self> {- for base in [&base_v2, &base_v3] {- if !base.starts_with("https://") && !is_loopback_http_base(base) {- anyhow::bail!("debug Composio base URL must be HTTPS or loopback HTTP");- }- }- Ok(Self::new_internal(api_key, base_v3, true))- }-- /// Construct against explicit v2/v3 API roots. Both must be HTTPS;- /// loopback HTTP is accepted only in debug builds.- pub fn new_with_base_urls(- api_key: &str,- base_v2: String,- base_v3: String,- ) -> anyhow::Result<Self> {- let allow_loopback = cfg!(debug_assertions);- for base in [&base_v2, &base_v3] {- let accepted =- base.starts_with("https://") || (allow_loopback && is_loopback_http_base(base));- if !accepted {- anyhow::bail!("Composio base URL must be HTTPS");- }- }- Ok(Self::new_internal(api_key, base_v3, allow_loopback))- }-- /// Test-only seam: construct with an explicit Composio v3 base URL so- /// unit tests can point the direct `/tools` request — including the- /// `tags` filter — at a local mock instead of `backend.composio.dev`.- ///- /// `#[cfg(test)]`-gated on purpose: the transport attaches the- /// `x-api-key` header to whatever `base_v3` holds, so the only way to- /// reach the v3 endpoint in production is [`Self::new`], which always- /// uses the HTTPS [`COMPOSIO_API_BASE_V3`] const. An injectable base must- /// never carry a non-HTTPS URL outside tests.- #[cfg(test)]- pub(crate) fn new_with_v3_base(api_key: &str, base_v3: String) -> Self {- Self::new_internal(api_key, base_v3, true)- }-- /// Shared constructor body. Private so the injectable `base_v3` cannot be- /// supplied by production callers — they go through [`Self::new`] (real- /// HTTPS const) and tests through the `#[cfg(test)]` `new_with_v3_base`.- fn new_internal(api_key: &str, base_v3: String, allow_insecure_loopback: bool) -> Self {- let trimmed = api_key.trim();- if trimmed.len() != api_key.len() {- // The key carried leading/trailing whitespace that would otherwise- // reach Composio's `x-api-key` header verbatim and trip the- // server-side "Invalid API key format" 401 (Sentry TAURI-RUST-D3).- // We trim here so the request succeeds; logging the length delta- // (never the key itself) helps trace which credential source- // produced a dirty value without leaking the secret.- tracing::debug!(- original_len = api_key.len(),- trimmed_len = trimmed.len(),- "[composio] trimmed leading/trailing whitespace from api_key"- );- }- Self {- api_key: trimmed.to_string(),- base_v3,- allow_insecure_loopback,- }- }-- pub(super) fn client(&self) -> Client {- let builder = || {- crate::config::apply_runtime_proxy_to_builder(- crate::util::tls::tls_client_builder()- .redirect(reqwest::redirect::Policy::none())- .timeout(std::time::Duration::from_secs(60))- .connect_timeout(std::time::Duration::from_secs(10)),- "tool.composio",- )- };- builder().build().unwrap_or_else(|error| {- tracing::warn!(- service_key = "tool.composio",- "Failed to build proxied Composio client: {error}"- );- crate::util::tls::tls_client_builder()- .redirect(reqwest::redirect::Policy::none())- .timeout(std::time::Duration::from_secs(60))- .connect_timeout(std::time::Duration::from_secs(10))- .build()- .unwrap_or_default()- })- }-- pub(super) fn ensure_request_url(&self, url: &str) -> anyhow::Result<()> {- if self.allow_insecure_loopback && is_loopback_http_url(url) {- return Ok(());- }- ensure_https(url)- }-}diff --git a/crates/openhuman-core/src/integrations/composio/tools/direct/http_errors.rs b/crates/openhuman-core/src/integrations/composio/tools/direct/http_errors.rsdeleted file mode 100644index fb0e935250..0000000000--- a/crates/openhuman-core/src/integrations/composio/tools/direct/http_errors.rs+++ /dev/null@@ -1,51 +0,0 @@-//! Response-parsing helper shared by every direct Composio HTTP call path:-//! turning a failed `reqwest::Response` into a redacted error string.--pub(super) async fn response_error(resp: reqwest::Response) -> String {- let status = resp.status();- let body = resp.text().await.unwrap_or_default();- if body.trim().is_empty() {- return format!("HTTP {}", status.as_u16());- }-- if let Some(api_error) = extract_api_error_message(&body) {- return format!(- "HTTP {}: {}",- status.as_u16(),- sanitize_error_message(&api_error)- );- }-- format!("HTTP {}", status.as_u16())-}--pub(super) fn sanitize_error_message(message: &str) -> String {- let mut sanitized = message.replace('\n', " ");- for marker in [- "connected_account_id",- "connectedAccountId",- "entity_id",- "entityId",- "user_id",- "userId",- ] {- sanitized = sanitized.replace(marker, "[redacted]");- }-- crate::util::truncate_with_ellipsis(&sanitized, 240)-}--pub(super) fn extract_api_error_message(body: &str) -> Option<String> {- let parsed: serde_json::Value = serde_json::from_str(body).ok()?;- parsed- .get("error")- .and_then(|v| v.get("message"))- .and_then(|v| v.as_str())- .map(ToString::to_string)- .or_else(|| {- parsed- .get("message")- .and_then(|v| v.as_str())- .map(ToString::to_string)- })-}diff --git a/crates/openhuman-core/src/integrations/composio/tools/direct/transport.rs b/crates/openhuman-core/src/integrations/composio/tools/direct/transport.rsdeleted file mode 100644index 4e350f4987..0000000000--- a/crates/openhuman-core/src/integrations/composio/tools/direct/transport.rs+++ /dev/null@@ -1,148 +0,0 @@-//! The host's [`tinyconnectors::client::Transport`] for the direct route.-//!-//! `DirectRoute` owns the paths and the response translation; this owns the-//! wire. It exists (instead of the module's own `ureq` transport) because the-//! host must keep honouring `[proxy]` runtime settings and its TLS roots for-//! Composio traffic, refuse redirects so the `x-api-key` header cannot follow-//! one, and render failures with the exact messages users and the-//! observability classifier already key on.--use std::sync::Arc;--use async_trait::async_trait;-use tinyconnectors::client::{DirectRoute, Route, Transport};-use tinyconnectors::Error as ConnectorError;--use super::http_errors::response_error;-use super::types::DirectComposioClient;-use crate::integrations::composio::types::{ComposioConnectionsResponse, ComposioToolsResponse};--/// Failure label per request path, matching the messages the host has always-/// produced (and the `[composio-direct]` observability anchors match on).-fn failure_label(path: &str) -> &'static str {- if path.starts_with("/connected_accounts") {- "Composio v3 connected_accounts failed"- } else {- "Composio v3 list_tool_schemas"- }-}--fn decode_label(path: &str) -> &'static str {- if path.starts_with("/connected_accounts") {- "Failed to decode Composio v3 connected_accounts response"- } else {- "Failed to decode Composio v3 tools response"- }-}--fn transport_error(path: &str, message: String) -> ConnectorError {- ConnectorError::Transport {- path: path.to_string(),- message,- }-}--impl DirectComposioClient {- /// The module's direct route over this client's transport.- ///- /// Built per call: the host's process-wide key gate (`direct_auth`) is what- /// persists across calls, so the route's own per-instance gate never trips- /// here by design.- pub(crate) fn route(self: &Arc<Self>) -> DirectRoute {- DirectRoute::new(self.clone(), &self.api_key, "default")- }-}--/// Collapse a route failure into the message the transport produced.-///-/// The route wraps transport failures as `request to <path> failed: <msg>`;-/// users have only ever seen `<msg>`.-fn route_error(error: ConnectorError) -> anyhow::Error {- match error {- ConnectorError::Transport { message, .. } => anyhow::anyhow!(message),- other => anyhow::anyhow!(other.to_string()),- }-}--impl DirectComposioClient {- /// `GET /connected_accounts` through the module's direct route, reshaped- /// into canonical connections.- pub(crate) async fn list_connections(- self: &Arc<Self>,- ) -> anyhow::Result<ComposioConnectionsResponse> {- let mut response = self.route().list_connections().await.map_err(route_error)?;- // Identity fields are the host's to fill (`enrich_connections_with_identity`- // from cached profile data); the route also lifts them from the v3 row.- for connection in &mut response.connections {- connection.account_email = None;- connection.workspace = None;- connection.username = None;- }- Ok(response)- }-- /// `GET /tools` through the module's direct route.- pub(crate) async fn list_tools(- self: &Arc<Self>,- toolkits: &[String],- tags: &[String],- ) -> anyhow::Result<ComposioToolsResponse> {- self.route()- .list_tools(toolkits, tags)- .await- .map_err(route_error)- }-}--#[async_trait]-impl Transport for DirectComposioClient {- async fn get(&self, path: &str) -> tinyconnectors::Result<serde_json::Value> {- let url = format!("{}{}", self.base_v3, path);- self.ensure_request_url(&url)- .map_err(|e| transport_error(path, format!("{e:#}")))?;- tracing::debug!(path = %path.split('?').next().unwrap_or(path), "[composio-direct] transport GET");-- let resp = self- .client()- .get(&url)- .header("x-api-key", &self.api_key)- .send()- .await- .map_err(|e| transport_error(path, format!("{:#}", anyhow::Error::from(e))))?;-- if !resp.status().is_success() {- let err = response_error(resp).await;- return Err(transport_error(- path,- format!("{}: {err}", failure_label(path)),- ));- }-- resp.json::<serde_json::Value>().await.map_err(|e| {- transport_error(- path,- format!("{}: {:#}", decode_label(path), anyhow::Error::from(e)),- )- })- }-- async fn post(- &self,- path: &str,- _body: &serde_json::Value,- ) -> tinyconnectors::Result<serde_json::Value> {- Err(transport_error(- path,- "the host direct transport serves reads only; writes run in the connector module"- .to_string(),- ))- }-- async fn delete(&self, path: &str) -> tinyconnectors::Result<serde_json::Value> {- Err(transport_error(- path,- "the host direct transport serves reads only; writes run in the connector module"- .to_string(),- ))- }-}diff --git a/crates/openhuman-core/src/integrations/composio/tools/direct/types.rs b/crates/openhuman-core/src/integrations/composio/tools/direct/types.rsdeleted file mode 100644index f43f75107b..0000000000--- a/crates/openhuman-core/src/integrations/composio/tools/direct/types.rs+++ /dev/null@@ -1,67 +0,0 @@-//! Core `DirectComposioClient` struct and the loopback/HTTPS URL-safety-//! helpers shared by every direct-mode Composio request path.--pub(super) const COMPOSIO_API_BASE_V3: &str = "https://backend.composio.dev/api/v3";--pub(super) fn ensure_https(url: &str) -> anyhow::Result<()> {- if !url.starts_with("https://") {- anyhow::bail!(- "Refusing to transmit sensitive data over non-HTTPS URL: URL scheme must be https"- );- }- Ok(())-}--pub(super) fn is_loopback_http_url(url: &str) -> bool {- // Parse rather than prefix-match: a raw `starts_with("http://127.0.0.1:")`- // is fooled by userinfo smuggling like- // `http://127.0.0.1:[email protected]/api/v3/tools`, which reqwest routes to the- // *parsed* host (`evil.com`). Verify the actual scheme + host and reject any- // embedded credentials so the insecure-loopback path can never leak the- // `x-api-key` header to a non-loopback host.- let Ok(parsed) = url::Url::parse(url) else {- return false;- };- if parsed.scheme() != "http" {- return false;- }- if !parsed.username().is_empty() || parsed.password().is_some() {- return false;- }- match parsed.host() {- Some(url::Host::Domain(host)) => host.eq_ignore_ascii_case("localhost"),- Some(url::Host::Ipv4(ip)) => ip.is_loopback(),- Some(url::Host::Ipv6(ip)) => ip.is_loopback(),- None => false,- }-}--pub(super) fn is_loopback_http_base(url: &str) -> bool {- is_loopback_http_url(&format!("{}/", url.trim_end_matches('/')))-}--/// Host-side HTTP transport for Composio's own v3 API with the user's key.-///-/// Composio execution, the OAuth handoff and connection management all run in-/// the `tinyconnectors` module. This client carries the direct-route reads-/// (`tinyconnectors::client::DirectRoute` over the `Transport` impl in-/// `transport.rs`) and the pre-store API-key probe through the host's proxy and-/// TLS settings.-pub struct DirectComposioClient {- pub(super) api_key: String,- /// Base URL for Composio v3 endpoints (`{base}/tools`). Production- /// always uses [`COMPOSIO_API_BASE_V3`] via [`DirectComposioClient::new`];- /// the `#[cfg(test)]` `new_with_v3_base` constructor lets unit tests point- /// the direct-mode `/tools` listing at a local axum mock.- pub(super) base_v3: String,- pub(super) allow_insecure_loopback: bool,-}--// Manual `Debug` (a `Transport` must be `Debug`): never prints the key.-impl std::fmt::Debug for DirectComposioClient {- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {- f.debug_struct("DirectComposioClient")- .field("base_v3", &self.base_v3)- .finish_non_exhaustive()- }-}diff --git a/crates/openhuman-core/src/integrations/composio/tools/direct_tests.rs b/crates/openhuman-core/src/integrations/composio/tools/direct_tests.rsdeleted file mode 100644index 1ee2a74e89..0000000000--- a/crates/openhuman-core/src/integrations/composio/tools/direct_tests.rs+++ /dev/null@@ -1,20 +0,0 @@-use super::*;--use serde_json::json;--/// Spawn a throwaway axum mock bound to an ephemeral port and return its base-/// URL. Mirrors `start_mock_backend` in `client_tests.rs` so both HTTP-level-/// direct-mode tests share one setup model.-async fn start_mock_backend(app: axum::Router) -> String {- let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();- let addr = listener.local_addr().unwrap();- tokio::spawn(async move {- axum::serve(listener, app).await.unwrap();- });- format!("http://127.0.0.1:{}", addr.port())-}--#[path = "direct_tests_constructor_and_wire_types_tests.rs"]-mod constructor_and_wire_types_tests;-#[path = "direct_tests_sanitization_and_connected_accounts_tests.rs"]-mod sanitization_and_connected_accounts_tests;diff --git a/crates/openhuman-core/src/integrations/composio/tools/direct_tests_constructor_and_wire_types_tests.rs b/crates/openhuman-core/src/integrations/composio/tools/direct_tests_constructor_and_wire_types_tests.rsdeleted file mode 100644index ea91be4703..0000000000--- a/crates/openhuman-core/src/integrations/composio/tools/direct_tests_constructor_and_wire_types_tests.rs+++ /dev/null@@ -1,238 +0,0 @@-use super::*;--use std::sync::Arc;-// ── Constructor ───────────────────────────────────────────--#[tokio::test]-async fn direct_client_does_not_forward_credentials_across_redirects() {- let redirected_request_seen = Arc::new(std::sync::atomic::AtomicBool::new(false));- let observed = redirected_request_seen.clone();- let destination = start_mock_backend(axum::Router::new().route(- "/tools",- axum::routing::get(move || {- let observed = observed.clone();- async move {- observed.store(true, std::sync::atomic::Ordering::SeqCst);- axum::Json(json!({"items": []}))- }- }),- ))- .await;- let redirect = format!("{destination}/tools");- let source = start_mock_backend(axum::Router::new().route(- "/tools",- axum::routing::get(move || {- let redirect = redirect.clone();- async move { axum::response::Redirect::temporary(&redirect) }- }),- ))- .await;-- let tool = Arc::new(DirectComposioClient::new_with_v3_base(- "ck_secret_value",- source,- ));- assert!(tool.list_tools(&[], &[]).await.is_err());- assert!(!redirected_request_seen.load(std::sync::atomic::Ordering::SeqCst));-}--// ── Execute validation ────────────────────────────────────--// ── API response parsing ──────────────────────────────────--#[test]-fn extract_api_error_message_from_common_shapes() {- let nested = r#"{"error":{"message":"tool not found"}}"#;- let flat = r#"{"message":"invalid api key"}"#;-- assert_eq!(- extract_api_error_message(nested).as_deref(),- Some("tool not found")- );- assert_eq!(- extract_api_error_message(flat).as_deref(),- Some("invalid api key")- );- assert_eq!(extract_api_error_message("not-json"), None);-}--#[test]-fn composio_api_base_url_is_v3() {- assert_eq!(COMPOSIO_API_BASE_V3, "https://backend.composio.dev/api/v3");-}--// ── list_tool_schemas_v3 query builder (direct-mode tags) ──────────────────--// ── direct list_tools over HTTP (direct-mode tags reach the wire) ───────--#[tokio::test]-async fn list_tool_schemas_v3_sends_repeated_tags_to_v3_tools_endpoint() {- use axum::{extract::RawQuery, routing::get, Json, Router};- use std::sync::Mutex;-- // Capture the raw query string the server sees. `RawQuery` (not- // `Query<HashMap>`) is required because a HashMap would collapse the- // repeated `tags=` params we specifically need to assert on.- let captured: Arc<Mutex<Option<String>>> = Arc::new(Mutex::new(None));- let sink = captured.clone();- let app = Router::new().route(- "/tools",- get(move |RawQuery(q): RawQuery| {- let sink = sink.clone();- async move {- *sink.lock().unwrap() = q;- Json(json!({- "items": [{- "slug": "GITHUB_STAR_A_REPOSITORY",- "description": "Star a repository",- "input_parameters": { "type": "object" },- "toolkit": { "slug": "github" }- }]- }))- }- }),- );- let base = start_mock_backend(app).await;-- let tool = Arc::new(DirectComposioClient::new_with_v3_base(- "ck_test_direct",- base,- ));- let items = tool- .list_tools(- &["github".to_string()],- &["stars".to_string(), "repos".to_string()],- )- .await- .expect("direct v3 /tools should succeed against the mock")- .tools;-- let query = captured- .lock()- .unwrap()- .clone()- .expect("mock server should have observed a query string");-- // tags must be REPEATED params (tags=stars&tags=repos) — the Composio v3- // contract — NOT the comma-joined form the backend proxy uses.- assert!(query.contains("tags=stars"), "query was: {query}");- assert!(query.contains("tags=repos"), "query was: {query}");- assert!(- !query.contains("stars%2Crepos") && !query.contains("stars,repos"),- "tags must not be comma-joined; query was: {query}"- );- assert!(query.contains("toolkits=github"), "query was: {query}");- assert!(query.contains("limit=200"), "query was: {query}");- // #3932: post-launch toolkits are invisible without toolkit_versions=latest.- assert!(- query.contains("toolkit_versions=latest"),- "query was: {query}"- );-- // And the v3 envelope reshapes back into schema items.- assert_eq!(items.len(), 1);- assert_eq!(items[0].function.name, "GITHUB_STAR_A_REPOSITORY");- assert_eq!(- items[0].function.description.as_deref(),- Some("Star a repository")- );-}--// ── execute_action over HTTP (correct v3 path/slug/body reach the wire) ────--// ── ensure_https ──────────────────────────────────────────────────────────--#[test]-fn ensure_https_accepts_https_url() {- assert!(ensure_https("https://backend.composio.dev/api/v3/tools").is_ok());-}--#[test]-fn ensure_https_rejects_http_url() {- let err = ensure_https("http://backend.composio.dev/api/v3/tools").unwrap_err();- assert!(err.to_string().contains("non-HTTPS"));-}--#[test]-fn ensure_https_rejects_ftp_url() {- assert!(ensure_https("ftp://example.com").is_err());-}--// ── sanitize_error_message ────────────────────────────────────────────────--#[test]-fn sanitize_error_message_replaces_sensitive_fields() {- let msg = "Invalid connected_account_id value for entity_id: user-123";- let sanitized = sanitize_error_message(msg);- assert!(!sanitized.contains("connected_account_id"));- assert!(!sanitized.contains("entity_id"));- assert!(sanitized.contains("[redacted]"));-}--#[test]-fn sanitize_error_message_replaces_newlines_with_spaces() {- let msg = "line1\nline2\nline3";- let sanitized = sanitize_error_message(msg);- assert!(!sanitized.contains('\n'));- assert!(sanitized.contains("line1"));- assert!(sanitized.contains("line2"));-}--// ── failure messages stay byte-identical to the pre-module client ─────────--#[tokio::test]-async fn http_failures_keep_their_user_facing_messages() {- use axum::{http::StatusCode, routing::get, Json, Router};- let app = Router::new()- .route(- "/connected_accounts",- get(|| async {- (- StatusCode::UNAUTHORIZED,- Json(json!({"error": {"message": "Invalid API key"}})),- )- }),- )- .route(- "/tools",- get(|| async { (StatusCode::INTERNAL_SERVER_ERROR, "") }),- );- let tool = Arc::new(DirectComposioClient::new_with_v3_base(- "ck_test_direct",- start_mock_backend(app).await,- ));-- let err = tool.list_connections().await.unwrap_err();- assert_eq!(- format!("{err:#}"),- "Composio v3 connected_accounts failed: HTTP 401: Invalid API key"- );- let err = tool.list_tools(&[], &[]).await.unwrap_err();- assert_eq!(- format!("{err:#}"),- "Composio v3 list_tool_schemas: HTTP 500"- );-}--#[tokio::test]-async fn connections_come_back_without_route_lifted_identity() {- use axum::{routing::get, Json, Router};- let app = Router::new().route(- "/connected_accounts",- get(|| async {- Json(json!({"items": [- {"id": " ca_1 ", "toolkit": "gmail", "status": "ACTIVE", "email": "[email protected]"},- {"id": " ", "toolkit": "slack", "status": "ACTIVE"}- ]}))- }),- );- let tool = Arc::new(DirectComposioClient::new_with_v3_base(- "ck_test_direct",- start_mock_backend(app).await,- ));- let connections = tool.list_connections().await.unwrap().connections;- assert_eq!(connections.len(), 1, "blank id dropped");- assert_eq!(connections[0].id, "ca_1");- // Identity is the host's to enrich from cached profiles.- assert!(connections[0].account_email.is_none());-}diff --git a/crates/openhuman-core/src/integrations/composio/tools/direct_tests_sanitization_and_connected_accounts_tests.rs b/crates/openhuman-core/src/integrations/composio/tools/direct_tests_sanitization_and_connected_accounts_tests.rsdeleted file mode 100644index ca4b60c9ad..0000000000--- a/crates/openhuman-core/src/integrations/composio/tools/direct_tests_sanitization_and_connected_accounts_tests.rs+++ /dev/null@@ -1,41 +0,0 @@-use super::*;--#[test]-fn sanitize_error_message_truncates_long_messages() {- let long_msg = "x".repeat(500);- let sanitized = sanitize_error_message(&long_msg);- assert!(- sanitized.chars().count() <= 243,- "should be at most 240 chars + '...'"- );- assert!(- sanitized.ends_with("..."),- "truncated message should end with '...'"- );-}--#[test]-fn sanitize_error_message_does_not_truncate_short_messages() {- let short = "Something went wrong";- let sanitized = sanitize_error_message(short);- assert_eq!(sanitized, short);-}--#[test]-fn sanitize_error_message_replaces_all_sensitive_variants() {- // camelCase variants- let msg = "Error for connectedAccountId and entityId and userId";- let sanitized = sanitize_error_message(msg);- assert!(- !sanitized.contains("connectedAccountId"),- "camelCase connectedAccountId should be redacted"- );- assert!(- !sanitized.contains("entityId"),- "camelCase entityId should be redacted"- );- assert!(- !sanitized.contains("userId"),- "camelCase userId should be redacted"- );-}