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
Route Composio sync through the driver, now that it can resolve a backend session
Shanu4883a9dde935
diff --git a/src/openhuman/integrations/composio/ops/providers_ops.rs b/src/openhuman/integrations/composio/ops/providers_ops.rsindex 6e3bbf3baa..acbf525181 100644--- a/src/openhuman/integrations/composio/ops/providers_ops.rs+++ b/src/openhuman/integrations/composio/ops/providers_ops.rs@@ -188,14 +188,22 @@ pub async fn composio_sync(let toolkit_for_outcome = toolkit.clone();let connection_id_for_log = connection_id.to_string();+ // Resolved before the spawn so a driver that serves no sync is an error the+ // caller sees rather than a log line in a detached task.+ let binding = crate::openhuman::memory::binding::for_config(&config_for_task)?;+tokio::spawn(async move {- match tinymemory_core::tinycortex::run_composio_connection(- &toolkit_for_outcome,- &connection_id_for_log,- &config_for_task,- )- .await- {+ let attempted = match binding.provider().as_source_sync() {+ Some(sync) => sync+ .run_connection_sync(&toolkit_for_outcome, &connection_id_for_log)+ .await+ .map_err(|error| error.to_string()),+ None => Err(format!(+ "the bound memory driver '{}' does not serve source sync",+ binding.driver_id()+ )),+ };+ match attempted {Ok(out) => {tracing::info!(toolkit = %toolkit_for_outcome,diff --git a/src/openhuman/memory/ops/sync.rs b/src/openhuman/memory/ops/sync.rsindex 44a3e901e5..131ee494d8 100644--- a/src/openhuman/memory/ops/sync.rs+++ b/src/openhuman/memory/ops/sync.rs@@ -193,6 +193,11 @@ async fn spawn_manual_sync(requested_connection: Option<String>) -> Result<(), S}}+ // Resolved BEFORE the spawn so a missing driver is an error the caller+ // sees, not a status line the spawned task emits into a channel nobody is+ // reading yet.+ let binding = crate::openhuman::memory::binding::for_config(&config)?;+tokio::spawn(async move {for target in targets {emit_sync_stage(@@ -204,13 +209,21 @@ async fn spawn_manual_sync(requested_connection: Option<String>) -> Result<(), SNone, // provider-level composio sync — not a memory-source row);- match tinymemory_core::tinycortex::run_composio_connection(- &target.toolkit,- &target.connection_id,- &config,- )- .await- {+ // Through the driver, not the engine. `run_connection_sync` drops+ // the config argument the engine call took: the driver resolves its+ // own, and its proxied branch now reaches this host for the session+ // bearer rather than reading a snapshot that has none.+ let outcome = match binding.provider().as_source_sync() {+ Some(sync) => sync+ .run_connection_sync(&target.toolkit, &target.connection_id)+ .await+ .map_err(|error| error.to_string()),+ None => Err(format!(+ "the bound memory driver '{}' does not serve source sync",+ binding.driver_id()+ )),+ };+ match outcome {Ok(outcome) => {emit_sync_stage(MemorySyncTrigger::Manual,@@ -230,7 +243,7 @@ async fn spawn_manual_sync(requested_connection: Option<String>) -> Result<(), SMemorySyncStage::Failed,Some(&target.toolkit),Some(&target.connection_id),- Some(error.to_string()),+ Some(error.clone()),None, // provider-level composio sync — not a memory-source row);tracing::warn!(diff --git a/src/openhuman/memory/sync/composio/bus.rs b/src/openhuman/memory/sync/composio/bus.rsindex fa19bc6677..7790bb2656 100644--- a/src/openhuman/memory/sync/composio/bus.rs+++ b/src/openhuman/memory/sync/composio/bus.rs@@ -713,13 +713,41 @@ impl EventHandler<DomainEvent> for ComposioConnectionCreatedSubscriber {);}- match tinymemory_core::tinycortex::run_composio_connection(- &toolkit,- &connection_id,- ctx.config.as_ref(),+ // `ctx.config` is the seam's `dyn MemoryHostConfig`; the binding+ // keys on this host's own `Config`, so it is re-read from the+ // paths the seam carries — the same move the live-config read+ // above this makes, and for the same reason.+ let host_config = match crate::openhuman::config::rpc::reload_config_from_paths(+ ctx.config.config_path(),+ ctx.config.workspace_dir(),).await{+ Ok(config) => config,+ Err(error) => {+ tracing::warn!(+ toolkit = %toolkit,+ connection_id = %connection_id,+ error = %error,+ "[composio:bus] initial sync skipped: config re-read failed"+ );+ return;+ }+ };+ let attempted = match crate::openhuman::memory::binding::for_config(&host_config) {+ Ok(binding) => match binding.provider().as_source_sync() {+ Some(sync) => sync+ .run_connection_sync(&toolkit, &connection_id)+ .await+ .map_err(|error| error.to_string()),+ None => Err(format!(+ "the bound memory driver '{}' does not serve source sync",+ binding.driver_id()+ )),+ },+ Err(error) => Err(error),+ };+ match attempted {Ok(outcome) => {tracing::info!(toolkit = %toolkit,@@ -731,13 +759,19 @@ impl EventHandler<DomainEvent> for ComposioConnectionCreatedSubscriber {// Avoid immediately re-firing from the periodic scheduler.super::periodic::record_sync_success(&toolkit, &connection_id);}+ // `actions_called` and `provider_cost_usd` are no longer+ // separate fields here. The contract has one error channel+ // and the driver folds the usage into its message, because+ // a partial-success shape is not available on an error path+ // — so the spend a failed run incurred is in the text rather+ // than in two structured fields. Logged whole rather than+ // parsed back out: re-deriving numbers from a message is how+ // a log line becomes a fragile API.Err(error) => tracing::warn!(toolkit = %toolkit,connection_id = %connection_id,error = %error,- actions_called = error.actions_called,- provider_cost_usd = error.provider_cost_usd,- "[composio:bus] tinycortex initial sync failed"+ "[composio:bus] initial sync failed"),}}diff --git a/src/openhuman/memory/sync/composio/providers/slack/rpc.rs b/src/openhuman/memory/sync/composio/providers/slack/rpc.rsindex 55e1f5e1e9..2f52d0628b 100644--- a/src/openhuman/memory/sync/composio/providers/slack/rpc.rs+++ b/src/openhuman/memory/sync/composio/providers/slack/rpc.rs@@ -91,9 +91,23 @@ pub async fn sync_trigger_rpc(let considered = candidates.len();let mut outcomes: Vec<SyncOutcome> = Vec::with_capacity(considered);+ // Resolved once, outside the loop: the binding is cached per workspace, but+ // a driver that serves no sync should refuse the whole request rather than+ // once per connection.+ let binding = crate::openhuman::memory::binding::for_config(config)?;+ let sync = binding.provider().as_source_sync().ok_or_else(|| {+ format!(+ "the bound memory driver '{}' does not serve source sync",+ binding.driver_id()+ )+ })?;+for conn in candidates {let started_at_ms = now_ms();- match tinymemory_core::tinycortex::run_composio_connection("slack", &conn.id, config).await+ match sync+ .run_connection_sync("slack", &conn.id)+ .await+ .map_err(|error| error.to_string()){Ok(outcome) => outcomes.push(SyncOutcome {toolkit: "slack".to_string(),@@ -173,6 +187,17 @@ pub async fn sync_status_rpc(// backend tenant's (#1710).let connections = list_slack_connections(config).await?;+ // The state rows come from the driver now. Resolved once for the whole+ // report rather than per connection: a driver that serves no sync has+ // nothing to say about any of them.+ let binding = crate::openhuman::memory::binding::for_config(config)?;+ let sync = binding.provider().as_source_sync().ok_or_else(|| {+ format!(+ "the bound memory driver '{}' does not serve source sync",+ binding.driver_id()+ )+ })?;+let mut rows = Vec::new();for conn in connections.connections {if conn.normalized_toolkit() != "slack" {@@ -181,23 +206,32 @@ pub async fn sync_status_rpc(if !conn.is_active() {continue;}- let state =- match tinymemory_core::tinycortex::load_composio_sync_state("slack", &conn.id).await {- Ok(s) => s,- Err(err) => {- log::warn!(- "[slack_ingest] load_state connection={} failed: {err:#}",- conn.id- );- continue;- }- };+ let state = match sync.source_sync_state("slack", &conn.id).await {+ Ok(s) => s,+ Err(err) => {+ log::warn!(+ "[slack_ingest] load_state connection={} failed: {err:#}",+ conn.id+ );+ continue;+ }+ };+ // `None` is a connection that has never synced. The engine call this+ // replaced returned a freshly defaulted state for that case, so the row+ // it produced was all zeroes and an empty cursor — which is what+ // `unwrap_or_default` reproduces exactly. Skipping the row instead+ // would drop a connected source from the report the moment it was+ // connected and before its first sync.+ let state = state.unwrap_or_default();rows.push(ConnectionStatus {connection_id: conn.id.clone(),per_channel_cursors: state.cursor.clone().unwrap_or_else(|| "{}".to_string()),- synced_ids_count: state.synced_ids.len(),- requests_used_today: state.daily_budget.requests_used,- daily_request_limit: state.daily_budget.limit,+ // The contract carries the count where the engine carried the set+ // itself. Same number, and the set was never read here for anything+ // but its length.+ synced_ids_count: usize::try_from(state.synced_item_count).unwrap_or(usize::MAX),+ requests_used_today: state.daily_requests_used,+ daily_request_limit: state.daily_request_limit,});}diff --git a/src/openhuman/modules/memory_host.rs b/src/openhuman/modules/memory_host.rsindex 24cc3b96f9..fd6c80874c 100644--- a/src/openhuman/modules/memory_host.rs+++ b/src/openhuman/modules/memory_host.rs@@ -235,6 +235,33 @@ impl ComposioCallbacks {Ok(stored.or(configured))}+ /// The app-session bearer proxied ("backend") Composio mode authenticates+ /// with.+ ///+ /// Answered from a LIVE config read rather than the install-time snapshot,+ /// and that is the whole reason this is a bus member instead of a field on+ /// `ModuleConfig`. The bearer is a session JWT this host refreshes; a value+ /// the module captured at load would work until it expired and then make+ /// every sync fail with an auth error that reads as the user being signed+ /// out. Asking per call means the module always gets the one valid now.+ ///+ /// `Ok(None)` means this host has no session to lend — a signed-out user,+ /// not a broken one. The engine turns that into a named refusal rather than+ /// treating it as "nothing to sync", which is the distinction that keeps a+ /// signed-out user from looking like a user with no connected sources.+ ///+ /// The failure is folded into `None` deliberately: a token store that+ /// errors and a store that is empty are the same fact to the caller — this+ /// process cannot authenticate a proxied call right now — and splitting+ /// them would give the module a second failure mode it cannot act on+ /// differently.+ async fn session_bearer(&self) -> tinybus::Result<Option<String>> {+ let config = self.live_config_or_installed().await;+ Ok(crate::api::jwt::get_session_token(config.as_ref())+ .ok()+ .flatten())+ }+/// Whether *some* viable Composio client resolves right now.////// Deliberately the factory probe rather than a session-token check: adiff --git a/vendor/tinymemory b/vendor/tinymemoryindex 4020ab5fe1..2920bbcaff 160000--- a/vendor/tinymemory+++ b/vendor/tinymemory@@ -1 +1 @@-Subproject commit 4020ab5fe136d6fa6af84eaa02ac0255df8a9df8+Subproject commit 2920bbcaff8392fe0dccf7e297044830cd9f4525