Skip to content

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

chore(composio): reformat chained method calls for consistency

Steven Enamakelfe58685f59c9
diff --git a/crates/openhuman-core/src/integrations/composio/client/factory.rs b/crates/openhuman-core/src/integrations/composio/client/factory.rs
index d51584b71f..f57d6b5cc8 100644
--- a/crates/openhuman-core/src/integrations/composio/client/factory.rs
+++ b/crates/openhuman-core/src/integrations/composio/client/factory.rs
@@ -15,8 +15,8 @@
use std::sync::Arc;
-use crate::config::schema::{COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT};
use super::DirectCredential;
+use crate::config::schema::{COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT};
// Re-declare the mode strings as local consts so they can be used as
// pattern arms in the `match` below. `use` imports of `pub const &str`
@@ -75,10 +75,9 @@ fn direct_client(
std::env::var("OPENHUMAN_COMPOSIO_DIRECT_BASE_V3").ok(),
) {
(Some(base_v2), Some(base_v3)) => {
- DirectCredential::new_with_base_urls_for_loopback(api_key, base_v2, base_v3)
- .map_err(|e| {
- anyhow::anyhow!("invalid debug composio direct loopback base override: {e}")
- })?
+ DirectCredential::new_with_base_urls_for_loopback(api_key, base_v2, base_v3).map_err(
+ |e| anyhow::anyhow!("invalid debug composio direct loopback base override: {e}"),
+ )?
}
_ => DirectCredential::new(api_key),
};
diff --git a/crates/openhuman-core/src/integrations/composio/client/network_tests.rs b/crates/openhuman-core/src/integrations/composio/client/network_tests.rs
index 7c806ca686..34e4f283bd 100644
--- a/crates/openhuman-core/src/integrations/composio/client/network_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/client/network_tests.rs
@@ -50,10 +50,9 @@ fn an_https_destination_takes_all_proxy_first_then_https_proxy() {
);
assert_eq!(all.unwrap().proxy_url.as_deref(), Some("http://all:1"));
- let https = with_proxy(
- proxy(None, Some("http://h:2"), Some("http://s:3")),
- || module_transport(HTTPS_BASE),
- );
+ let https = with_proxy(proxy(None, Some("http://h:2"), Some("http://s:3")), || {
+ module_transport(HTTPS_BASE)
+ });
assert_eq!(https.unwrap().proxy_url.as_deref(), Some("http://s:3"));
let http_only = with_proxy(proxy(None, Some("http://h:2"), None), || {
@@ -64,10 +63,9 @@ fn an_https_destination_takes_all_proxy_first_then_https_proxy() {
#[test]
fn a_plain_http_destination_takes_http_proxy() {
- let config = with_proxy(
- proxy(None, Some("http://h:2"), Some("http://s:3")),
- || module_transport("http://127.0.0.1:9/api/v3"),
- );
+ let config = with_proxy(proxy(None, Some("http://h:2"), Some("http://s:3")), || {
+ module_transport("http://127.0.0.1:9/api/v3")
+ });
assert_eq!(config.unwrap().proxy_url.as_deref(), Some("http://h:2"));
}
@@ -123,7 +121,9 @@ fn an_unusable_proxy_url_is_ignored_like_the_hosts_own_clients_do() {
"the next usable URL is used instead"
);
- let none = with_proxy(proxy(Some(" "), None, None), || module_transport(HTTPS_BASE));
+ let none = with_proxy(proxy(Some(" "), None, None), || {
+ module_transport(HTTPS_BASE)
+ });
assert!(none.and_then(|c| c.proxy_url).is_none());
}
diff --git a/crates/openhuman-core/src/integrations/composio/client_tests.rs b/crates/openhuman-core/src/integrations/composio/client_tests.rs
index 4d8222b695..9ab9873cdb 100644
--- a/crates/openhuman-core/src/integrations/composio/client_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/client_tests.rs
@@ -52,9 +52,7 @@ fn direct_tool_for_mock_with_key(
base_v3: String,
api_key: &str,
) -> std::sync::Arc<DirectCredential> {
- std::sync::Arc::new(DirectCredential::new_with_v3_base(
- api_key, base_v3,
- ))
+ std::sync::Arc::new(DirectCredential::new_with_v3_base(api_key, base_v3))
}
/// A config that can load the connector module and names no route.
@@ -565,6 +563,13 @@ async fn direct_reads_go_through_the_hosts_runtime_proxy() {
"the first read must have been tunnelled by the proxy"
);
assert!(bypassed.is_ok());
- assert_eq!(bypassed_proxied, 0, "a no_proxy destination skips the proxy");
- assert_eq!(hits.load(Ordering::SeqCst), 2, "both reads reached Composio");
+ assert_eq!(
+ bypassed_proxied, 0,
+ "a no_proxy destination skips the proxy"
+ );
+ assert_eq!(
+ hits.load(Ordering::SeqCst),
+ 2,
+ "both reads reached Composio"
+ );
}
diff --git a/crates/openhuman-core/src/integrations/composio/module_client_tests.rs b/crates/openhuman-core/src/integrations/composio/module_client_tests.rs
index 1f7123c39e..d54f4d7215 100644
--- a/crates/openhuman-core/src/integrations/composio/module_client_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/module_client_tests.rs
@@ -158,5 +158,8 @@ fn a_failure_that_is_not_a_member_failure_is_left_alone() {
);
// Another member's failure is not ours to rewrite.
let other = "Execute: ai.tinyhumans.tinybus.Error.Failed: x";
- assert_eq!(member_failure_message("ListConnectionsDirect", other), other);
+ assert_eq!(
+ member_failure_message("ListConnectionsDirect", other),
+ other
+ );
}
diff --git a/crates/openhuman-core/src/integrations/composio/ops/connections.rs b/crates/openhuman-core/src/integrations/composio/ops/connections.rs
index f17eed31af..6e346be940 100644
--- a/crates/openhuman-core/src/integrations/composio/ops/connections.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops/connections.rs
@@ -76,10 +76,12 @@ pub async fn composio_list_connections(
else {
unreachable!("direct Composio mode must construct a direct client")
};
- direct_list_connections(config, &direct).await.map_err(|error| {
- report_composio_op_error("list_connections", &error);
- format!("[composio-direct] list_connections: {error:#}")
- })?
+ direct_list_connections(config, &direct)
+ .await
+ .map_err(|error| {
+ report_composio_op_error("list_connections", &error);
+ format!("[composio-direct] list_connections: {error:#}")
+ })?
} else {
connectors::call_bare::<ComposioConnectionsResponse>(config, methods::LIST_CONNECTIONS)
.await
diff --git a/crates/openhuman-core/src/integrations/composio/tools/list_connections.rs b/crates/openhuman-core/src/integrations/composio/tools/list_connections.rs
index 57bebe0051..497d957e4c 100644
--- a/crates/openhuman-core/src/integrations/composio/tools/list_connections.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools/list_connections.rs
@@ -100,22 +100,25 @@ impl ComposioListConnectionsTool {
}
Ok(ComposioRoute::Direct(direct)) => {
tracing::debug!("[composio-direct] list_connections.execute: direct variant");
- match direct_list_connections(&live_config, &direct).await.map_err(|e| {
- // [#1166 / Sentry TAURI-RUST-X9] Symmetric error
- // routing with `ops.rs::composio_list_connections`.
- // The agent-tool path can also fire 401s when a
- // direct-mode user has a bad API key — without this
- // hook the failure escapes the classifier and lands
- // as an unclassified Sentry event. Render WITH the
- // `[composio-direct]` anchor BEFORE reporting so the
- // classifier arm in `is_provider_user_state_message`
- // (gated on that prefix) actually fires.
- let rendered = format!(
- "[composio-direct] composio_list_connections (direct) failed: {e:#}"
- );
- let rendered = redact_and_report(&live_config, "list_connections", &rendered);
- anyhow::anyhow!("{rendered}")
- }) {
+ match direct_list_connections(&live_config, &direct)
+ .await
+ .map_err(|e| {
+ // [#1166 / Sentry TAURI-RUST-X9] Symmetric error
+ // routing with `ops.rs::composio_list_connections`.
+ // The agent-tool path can also fire 401s when a
+ // direct-mode user has a bad API key — without this
+ // hook the failure escapes the classifier and lands
+ // as an unclassified Sentry event. Render WITH the
+ // `[composio-direct]` anchor BEFORE reporting so the
+ // classifier arm in `is_provider_user_state_message`
+ // (gated on that prefix) actually fires.
+ let rendered = format!(
+ "[composio-direct] composio_list_connections (direct) failed: {e:#}"
+ );
+ let rendered =
+ redact_and_report(&live_config, "list_connections", &rendered);
+ anyhow::anyhow!("{rendered}")
+ }) {
Ok(resp) => resp,
Err(e) => return (live_config, Err(e)),
}
diff --git a/crates/openhuman-core/src/modules/memory_host.rs b/crates/openhuman-core/src/modules/memory_host.rs
index a0f85f2f68..eda45ad9d1 100644
--- a/crates/openhuman-core/src/modules/memory_host.rs
+++ b/crates/openhuman-core/src/modules/memory_host.rs
@@ -200,21 +200,24 @@ impl ComposioCallbacks {
.await
.map_err(|e| method_error(format!("list_connections (backend): {e}")))?,
ComposioRoute::Direct(direct) => {
- direct_list_connections(&config, &direct).await.map_err(|e| {
- // [#1166 / Sentry TAURI-RUST-X9] The v3 `/connected_accounts`
- // 401 shape has to reach the observability classifier, and it
- // only fires on a message carrying the `[composio-direct]`
- // anchor. Report it here rather than relying on the caller:
- // by the time this reaches the module it is wrapped in a
- // `MethodFailed` envelope, and the classifier that keys on
- // the anchor runs in this process, not that one.
- let rendered = format!("[composio-direct] list_connections (direct): {e:#}");
- crate::integrations::composio::ops::report_composio_op_error(
- "list_connections",
- &rendered,
- );
- method_error(rendered)
- })?
+ direct_list_connections(&config, &direct)
+ .await
+ .map_err(|e| {
+ // [#1166 / Sentry TAURI-RUST-X9] The v3 `/connected_accounts`
+ // 401 shape has to reach the observability classifier, and it
+ // only fires on a message carrying the `[composio-direct]`
+ // anchor. Report it here rather than relying on the caller:
+ // by the time this reaches the module it is wrapped in a
+ // `MethodFailed` envelope, and the classifier that keys on
+ // the anchor runs in this process, not that one.
+ let rendered =
+ format!("[composio-direct] list_connections (direct): {e:#}");
+ crate::integrations::composio::ops::report_composio_op_error(
+ "list_connections",
+ &rendered,
+ );
+ method_error(rendered)
+ })?
}
};
Ok(response.connections)