Skip to content

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

chore(composio): reformat long method chains and reorder imports

Steven Enamakelecac4f59fe78
diff --git a/crates/openhuman-core/src/channels/README.md b/crates/openhuman-core/src/channels/README.md
index b616571e75..69a5627ca0 100644
--- a/crates/openhuman-core/src/channels/README.md
+++ b/crates/openhuman-core/src/channels/README.md
@@ -37,7 +37,7 @@ Flat files: `bus.rs` (`ChannelInboundSubscriber`, handles `DomainEvent::ChannelI
- `crates/openhuman-core/src/security/credentials/` — `AuthService` lookups for connect/disconnect and for secret hydration at startup (email password, Yuanbao app secret).
- `crates/openhuman-core/src/security/approval/` — `ApprovalGate` for the approval-reply intercept and `ApprovalChatContext` scoping of turns on every provider with the `chat_approvals` capability.
- `crates/openhuman-core/src/config/` — `Config` / `ChannelsConfig` (schema types come from `tinychannels_bus::config` via `config/schema/channels.rs`).
-- `crates/openhuman-core/src/memory/conversations/` and `memory/guard` — conversation history persistence and the active memory guard.
+- `crates/openhuman-core/src/memory/conversations/` — memory v2 conversation ingestion (from the session host's `ConversationTurnCommitted` event; channel turns do no per-turn recall or autosave) and `forget_channel`, which `disconnect_channel` with `clear_memory` uses to forget a channel's `channel:<name>`-tagged conversations.
- `crates/openhuman-core/src/backend/client.rs` — `BackendClient` for controller messaging ops and Telegram/Discord link flows.
- `crates/openhuman-core/src/web_chat/` — web-channel event publishing, session invalidation (`/new`), and the web surface subscribers registered at startup.
- `crates/openhuman-core/src/voice/` — STT/TTS behind the `host/` adapters.
@@ -55,7 +55,7 @@ Flat files: `bus.rs` (`ChannelInboundSubscriber`, handles `DomainEvent::ChannelI
## Tests
- Unit, flat files: `bus_tests.rs`, `bus_inbound_thread_id_tests_tests.rs`, `commands_tests.rs`, `context_tests.rs`, `proactive_tests.rs`, `routes_tests.rs`, `traits_tests.rs` (`bus/`'s `delivery.rs`, `subscriber.rs` and `thread_id.rs` are source submodules, not tests; `bus_test_support_tests.rs` is a debug-build helper module). Progressive delivery, remote control, approvals, relay registry, health checks, the CLI channel and connect-form parsing are tested upstream in `vendor/tinychannels`.
-- Cross-channel integration suite (`tests/`, see its module doc): `common.rs` fixtures plus `discord_integration`, `health`, `identity`, `memory`, `prompt`, `runtime_dispatch`, `runtime_tool_calls`, `telegram_integration`.
+- Cross-channel integration suite (`tests/`, see its module doc): `common.rs` fixtures plus `discord_integration`, `health`, `identity`, `prompt`, `runtime_dispatch`, `runtime_tool_calls`, `telegram_integration`.
- Host adapters: `host/host_tests.rs`, `host/channel_events_tests.rs`.
- Controllers: `controllers/{backend_tests,ops_tests,schemas_tests}.rs` (+ `ops_connect_status_tests.rs`/`ops_yuanbao_email_tests.rs`).
- Runtime: `runtime/{startup_tests,startup_email_secret_tests_tests,startup_yuanbao_secret_tests_tests,supervision_tests,dispatch_tests}.rs`, `runtime/dispatch/{mod_scoping_tests_tests,mod_approval_surface_gating_tests_tests,routing_connected_fallback_tests_tests}.rs`.
diff --git a/crates/openhuman-core/src/channels/controllers/README.md b/crates/openhuman-core/src/channels/controllers/README.md
index 22a1de9bd2..61842b0551 100644
--- a/crates/openhuman-core/src/channels/controllers/README.md
+++ b/crates/openhuman-core/src/channels/controllers/README.md
@@ -19,7 +19,7 @@ Owns the `channels.*` RPC namespace: provider metadata, connect/disconnect lifec
| Path | Purpose |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `connect.rs` (+ `connect/`: `connect_channel.rs`, `disconnect.rs`, `email.rs`, `memory.rs`, `shared.rs`, `status.rs`, `test_channel.rs`) | `connect_channel`, `disconnect_channel`, `channel_status`, `test_channel`, `get_default_channel`/`set_default_channel`, email config persistence (`email.rs`; building and verifying email and Yuanbao configs is `tinychannels::controllers::build_email_config`, `tinychannels::providers::verify_email_credentials` and `tinychannels::providers::yuanbao::connect`), `connected_channel_slugs`, `merge_listener_health` (`pub(crate)`, re-exported from `ops/mod.rs` under `#[cfg(test)]`) |
+| `connect.rs` (+ `connect/`: `connect_channel.rs`, `disconnect.rs`, `email.rs`, `memory.rs`, `shared.rs`, `status.rs`, `test_channel.rs`) | `connect_channel`, `disconnect_channel`, `channel_status`, `test_channel`, `get_default_channel`/`set_default_channel`, clearing a disconnected channel's stored conversations through `memory::conversations::forget_channel` (`memory.rs`), email config persistence (`email.rs`; building and verifying email and Yuanbao configs is `tinychannels::controllers::build_email_config`, `tinychannels::providers::verify_email_credentials` and `tinychannels::providers::yuanbao::connect`), `connected_channel_slugs`, `merge_listener_health` (`pub(crate)`, re-exported from `ops/mod.rs` under `#[cfg(test)]`) |
| `discord.rs` | Discord OAuth link flow and guild/channel/permission listing |
| `messaging.rs` | `channel_send_message`, `channel_send_reaction`, `channel_create_thread`, `channel_update_thread`, `channel_list_threads` — all call the TinyHumans backend REST API (`crate::backend::BackendClient`); the only path that reaches the relay transport registry (`tinychannels::relay::runtime`) is `OpenHumanChannelBackend::send_outbound_intent` in `backend.rs` |
| `types.rs` | Re-exports of `tinychannels::controllers` result/snapshot types used by the ops layer |
diff --git a/crates/openhuman-core/src/integrations/composio/bus.rs b/crates/openhuman-core/src/integrations/composio/bus.rs
index 30a7190ad3..ec89ae99de 100644
--- a/crates/openhuman-core/src/integrations/composio/bus.rs
+++ b/crates/openhuman-core/src/integrations/composio/bus.rs
@@ -45,9 +45,8 @@ fn publish_integrations_changed(entries: &[crate::agent::prompts::types::Connect
active_toolkits = ?toolkits,
"[composio:bus] publishing integrations changed"
);
- crate::core::bus::BUS.publish(crate::core::events::DomainEvent::ComposioIntegrationsChanged {
- toolkits,
- });
+ crate::core::bus::BUS
+ .publish(crate::core::events::DomainEvent::ComposioIntegrationsChanged { toolkits });
}
#[cfg(test)]
diff --git a/crates/openhuman-core/src/integrations/composio/bus/connection_created_subscriber.rs b/crates/openhuman-core/src/integrations/composio/bus/connection_created_subscriber.rs
index fba731c46a..1dac998ad4 100644
--- a/crates/openhuman-core/src/integrations/composio/bus/connection_created_subscriber.rs
+++ b/crates/openhuman-core/src/integrations/composio/bus/connection_created_subscriber.rs
@@ -32,9 +32,12 @@ const CONNECTION_READY_MAX_BACKOFF: Duration = Duration::from_secs(4);
/// than taken from the snapshot: the OAuth completion being reacted to may
/// have written credentials since.
async fn backend_composio_config(config: &Config, toolkit: &str) -> anyhow::Result<Config> {
- let live_config = config_rpc::reload_config_from_paths(&config.config_path, &config.workspace_dir)
- .await
- .map_err(|e| anyhow::anyhow!("composio backend client: failed to reload live config: {e}"))?;
+ let live_config =
+ config_rpc::reload_config_from_paths(&config.config_path, &config.workspace_dir)
+ .await
+ .map_err(|e| {
+ anyhow::anyhow!("composio backend client: failed to reload live config: {e}")
+ })?;
match resolve_composio_route(&live_config)? {
ComposioRoute::Backend => Ok(live_config),
ComposioRoute::Direct(_) => Err(anyhow::anyhow!(
@@ -220,12 +223,20 @@ pub(super) enum WaitError {
/// Polls `ListConnections` until `connection_id` is active, or until
/// [`CONNECTION_READY_TIMEOUT`]. Returns the observed status.
-async fn wait_for_connection_active(config: &Config, connection_id: &str) -> Result<String, WaitError> {
+async fn wait_for_connection_active(
+ config: &Config,
+ connection_id: &str,
+) -> Result<String, WaitError> {
let started = std::time::Instant::now();
let mut backoff = CONNECTION_READY_INITIAL_BACKOFF;
let mut last_status: Option<String> = None;
loop {
- match connectors::call_bare::<ComposioConnectionsResponse>(config, methods::LIST_CONNECTIONS).await {
+ match connectors::call_bare::<ComposioConnectionsResponse>(
+ config,
+ methods::LIST_CONNECTIONS,
+ )
+ .await
+ {
Ok(resp) => {
if let Some(conn) = resp.connections.into_iter().find(|c| c.id == connection_id) {
if conn.is_active() {
@@ -244,7 +255,10 @@ async fn wait_for_connection_active(config: &Config, connection_id: &str) -> Res
}
}
if started.elapsed() >= CONNECTION_READY_TIMEOUT {
- if let Some(status) = last_status.as_ref().filter(|s| s.starts_with("lookup_error:")) {
+ if let Some(status) = last_status
+ .as_ref()
+ .filter(|s| s.starts_with("lookup_error:"))
+ {
return Err(WaitError::Lookup {
error: status.clone(),
});
diff --git a/crates/openhuman-core/src/integrations/composio/contract/catalogs/mod_tests.rs b/crates/openhuman-core/src/integrations/composio/contract/catalogs/mod_tests.rs
index 0a7f69e460..b5b5dc19e4 100644
--- a/crates/openhuman-core/src/integrations/composio/contract/catalogs/mod_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/contract/catalogs/mod_tests.rs
@@ -38,7 +38,6 @@ const CAPABILITY_TOOLKITS: &[&str] = &[
"todoist",
];
-
#[test]
fn catalog_for_toolkit_resolves_every_capability_toolkit() {
// Every toolkit the capability surface reports on must have a catalog —
diff --git a/crates/openhuman-core/src/integrations/composio/file_store.rs b/crates/openhuman-core/src/integrations/composio/file_store.rs
index aee730b668..1c8a5e6136 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store.rs
@@ -54,8 +54,12 @@ where
))
}
};
- serde_json::from_slice(&bytes)
- .map_err(|error| format!("[composio:store] parsing {} failed: {error}", path.display()))
+ serde_json::from_slice(&bytes).map_err(|error| {
+ format!(
+ "[composio:store] parsing {} failed: {error}",
+ path.display()
+ )
+ })
}
/// Writes `value` to `path` atomically (temp file, then rename).
@@ -71,7 +75,10 @@ where
.map_err(|error| format!("[composio:store] serializing failed: {error}"))?;
if let Some(dir) = path.parent() {
tokio::fs::create_dir_all(dir).await.map_err(|error| {
- format!("[composio:store] creating {} failed: {error}", dir.display())
+ format!(
+ "[composio:store] creating {} failed: {error}",
+ dir.display()
+ )
})?;
}
let tmp = path.with_extension("json.tmp");
diff --git a/crates/openhuman-core/src/integrations/composio/mod.rs b/crates/openhuman-core/src/integrations/composio/mod.rs
index 60199b1d0d..a2ba74135d 100644
--- a/crates/openhuman-core/src/integrations/composio/mod.rs
+++ b/crates/openhuman-core/src/integrations/composio/mod.rs
@@ -66,11 +66,11 @@ pub mod types;
pub use crate::agent::prompts::types::ConnectedIntegration;
pub use crate::integrations::composio::providers::{ProviderUserProfile, SyncOutcome, SyncReason};
+pub use action_tool::ComposioActionTool;
pub use bus::{
register_composio_trigger_subscriber, ComposioConfigChangedSubscriber,
ComposioConnectionCreatedSubscriber, ComposioTriggerSubscriber,
};
-pub use action_tool::ComposioActionTool;
pub use identity::connection_identity;
pub use ops::{
cached_active_integrations, cached_active_integrations_including_expired, connected_set_hash,
diff --git a/crates/openhuman-core/src/integrations/composio/ops/connections.rs b/crates/openhuman-core/src/integrations/composio/ops/connections.rs
index 8a08b22750..fb14e24dad 100644
--- a/crates/openhuman-core/src/integrations/composio/ops/connections.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops/connections.rs
@@ -157,7 +157,9 @@ pub async fn composio_delete_connection(
// The toolkit names the identity facets and the PROFILE.md bullet to drop;
// forgetting memory needs only the connection id (its records carry a
// `connection:<id>` tag), so an unresolvable toolkit skips the former only.
- let toolkit = resolve_toolkit_for_connection(config, connection_id).await.ok();
+ let toolkit = resolve_toolkit_for_connection(config, connection_id)
+ .await
+ .ok();
// Only the Composio-side removal crosses the bus. Everything around it —
// the synced memory, the identity facets, PROFILE.md — is this host's own
// bookkeeping about a connection it no longer has.
diff --git a/crates/openhuman-core/src/integrations/composio/ops/sync.rs b/crates/openhuman-core/src/integrations/composio/ops/sync.rs
index 5d7c3b23e1..43de4bc94d 100644
--- a/crates/openhuman-core/src/integrations/composio/ops/sync.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops/sync.rs
@@ -239,14 +239,15 @@ pub async fn run_sync_pass(
let written = if records_read == 0 {
0
} else {
- store_records(bound, toolkit, connection_id, source_id, &response.batch.records)
- .await
- .map_err(|error| {
- format!(
- "storing {toolkit} records failed: {}",
- String::from(error)
- )
- })?
+ store_records(
+ bound,
+ toolkit,
+ connection_id,
+ source_id,
+ &response.batch.records,
+ )
+ .await
+ .map_err(|error| format!("storing {toolkit} records failed: {}", String::from(error)))?
};
if more_pending {
diff --git a/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs
index f18fe7e5c6..810ca1ae66 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs
@@ -486,8 +486,8 @@ async fn enrich_skips_connection_already_having_identity() {
async fn enrich_leaves_unmatched_connection_unchanged() {
// Connection whose id has no cached profile row is returned with all
// identity fields as None — the UI falls back to "toolkit · connection_id".
- use crate::integrations::composio::identity_store::persist_provider_profile;
use crate::integrations::composio::contract::ProviderUserProfile;
+ use crate::integrations::composio::identity_store::persist_provider_profile;
let tmp = tempfile::tempdir().unwrap();
let config = test_config(&tmp);