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(composio): source budget honored; pre-spawn running; pin-safe member\n\nThree review findings plus the CI truths they surfaced:\n\nThe configured per-source ingest cap now crosses into the pass loop:\ncomposio_sync_budgeted threads entry.max_items, each pass requests\nmin(remaining, 500), and an exhausted budget ends the run -- a budget of\n200 is one 200-item pass, not 50x500. Every other run_sync_pass caller\n(periodic, sync_all, slack, bus retry) states the default pass ceiling\nexplicitly.\n\nThe running stage is published before the spawn: it exists before the RPC\nreturns, and the bus preserves publisher order, so completed can never\novertake it.\n\nThe OverrideSchedulerGate member is spelled as a literal, uniquely, with\nthe swap-back documented: the constant ships in tinymemory#127 and the\npinned v1.13.6 names table predates it -- the host-first landing order\nrequires naming a member the pin cannot yet spell. The capability map\nrecords scheduler_override under Sources with its push_cap family, per\nthe exhaustiveness guard's instruction.\n
Shanu7ab8ed127d59
diff --git a/src/core/all_tests.rs b/src/core/all_tests.rsindex 316d8236fa..95759cb91c 100644--- a/src/core/all_tests.rs+++ b/src/core/all_tests.rs@@ -1673,6 +1673,11 @@ const MEMORY_FUNCTION_CAPABILITY: &[(&str, Option<Capability>)] = &[("sync_channel", Some(Capability::Sources)),("sync_all", Some(Capability::Sources)),("ingestion_status", Some(Capability::Sources)),+ // Sources, with the rest of its schema family (one push_cap site): the+ // override exists so user-requested source maintenance runs while the+ // gate is paused, and a driver serving no Sources family has nothing the+ // window would unblock.+ ("scheduler_override", Some(Capability::Sources)),// the tree summarizer, NOT ingestion("learn_all", Some(Capability::Tree)),// never gated: this is the RPC that reports the capability setdiff --git a/src/openhuman/integrations/composio/ops/mod.rs b/src/openhuman/integrations/composio/ops/mod.rsindex c5aa5a4a21..dba9133a71 100644--- a/src/openhuman/integrations/composio/ops/mod.rs+++ b/src/openhuman/integrations/composio/ops/mod.rs@@ -44,7 +44,7 @@ pub use execute::composio_execute;pub(crate) use providers_ops::completed_sync_detail;pub use providers_ops::{composio_get_user_profile, composio_refresh_all_identities, composio_sync,- composio_sync_for_source, RefreshIdentitiesReport,+ composio_sync_budgeted, composio_sync_for_source, RefreshIdentitiesReport, SYNC_PASS_MAX_ITEMS,};// The tinyconnectors-mediated sync pass, shared with// `memory::sync::composio::providers::slack::rpc` — see its doc comment.diff --git a/src/openhuman/integrations/composio/ops/providers_ops.rs b/src/openhuman/integrations/composio/ops/providers_ops.rsindex f3685f08c9..fb2423fa87 100644--- a/src/openhuman/integrations/composio/ops/providers_ops.rs+++ b/src/openhuman/integrations/composio/ops/providers_ops.rs@@ -40,7 +40,7 @@ const SOURCE_KIND: &str = "composio";/// `composio_sync_for_source` multiplies this by its `MAX_PASSES` bound into a/// worst case of 25k items per click, instead of "whatever the module decides/// a call means".-const SYNC_PASS_MAX_ITEMS: usize = 500;+pub const SYNC_PASS_MAX_ITEMS: usize = 500;/// The `completed` stage's detail string.///@@ -218,6 +218,19 @@ pub async fn composio_sync_for_source(connection_id: &str,reason: Option<String>,source_id: Option<String>,+) -> OpResult<RpcOutcome<SyncOutcome>> {+ composio_sync_budgeted(config, connection_id, reason, source_id, None).await+}++/// [`composio_sync_for_source`] with the source's configured per-run ingest+/// cap. `None` preserves unlimited: the loop still slices the account into+/// 500-item passes, but stops only when the connector reports the end.+pub async fn composio_sync_budgeted(+ config: &Config,+ connection_id: &str,+ reason: Option<String>,+ source_id: Option<String>,+ source_max_items: Option<u32>,) -> OpResult<RpcOutcome<SyncOutcome>> {let reason = parse_sync_reason(reason.as_deref())?;tracing::debug!(@@ -275,17 +288,34 @@ pub async fn composio_sync_for_source(// task forever. The bound is generous: 50 pages ≈ 5,000 records per click.const MAX_PASSES: usize = 50;+ // Published before the spawn: the row's "running" exists before the RPC+ // returns, and the bus preserves publisher order, so completed can never+ // overtake it (review question on ordering).+ publish_stage("running", None);+tokio::spawn(async move {- publish_stage("running", None);let mut total_written: u64 = 0;let mut passes = 0usize;let outcome = loop {passes += 1;+ // The source's configured per-run cap wins over the pass ceiling:+ // a budget of 200 means one 200-item pass, not 50 passes of 500+ // (review finding). `None` = unlimited, the loop's own bounds+ // still apply.+ let remaining_budget =+ source_max_items.map(|cap| u64::from(cap).saturating_sub(total_written));+ if remaining_budget == Some(0) {+ break Ok(());+ }+ let pass_budget = remaining_budget.map_or(SYNC_PASS_MAX_ITEMS, |remaining| {+ (remaining as usize).min(SYNC_PASS_MAX_ITEMS)+ });match run_sync_pass(&config_for_run,&toolkit_for_log,&connection_for_log,&reason_for_task,+ pass_budget,).await{@@ -389,6 +419,7 @@ pub(crate) async fn run_sync_pass(toolkit: &str,connection_id: &str,reason: &str,+ pass_budget: usize,) -> Result<SyncPassOutcome, String> {// Sync pages the whole account inside the call; the default 30s bus// deadline reported failure on runs the module then finished successfully.@@ -403,7 +434,7 @@ pub(crate) async fn run_sync_pass(// a budget the module pages until its own limits and the caller's// pass loop bounds nothing (review finding). complete=false at the// budget → more_pending → the loop (or the next click) resumes.- max_items: Some(SYNC_PASS_MAX_ITEMS),+ max_items: Some(pass_budget),..ConnectorSyncRequest::default()},)diff --git a/src/openhuman/integrations/composio/periodic.rs b/src/openhuman/integrations/composio/periodic.rsindex b3ae0f2f50..e4080ddecb 100644--- a/src/openhuman/integrations/composio/periodic.rs+++ b/src/openhuman/integrations/composio/periodic.rs@@ -117,7 +117,11 @@ async fn run_one_tick() -> Result<(), String> {}match crate::openhuman::integrations::composio::ops::run_sync_pass(- &config, &toolkit, &conn.id, "periodic",+ &config,+ &toolkit,+ &conn.id,+ "periodic",+ crate::openhuman::integrations::composio::ops::SYNC_PASS_MAX_ITEMS,).await{diff --git a/src/openhuman/memory/ops/sync.rs b/src/openhuman/memory/ops/sync.rsindex 036b482c58..8bdee0f80a 100644--- a/src/openhuman/memory/ops/sync.rs+++ b/src/openhuman/memory/ops/sync.rs@@ -227,6 +227,7 @@ async fn spawn_manual_sync(requested_connection: Option<String>) -> Result<(), S&target.toolkit,&target.connection_id,"manual",+ crate::openhuman::integrations::composio::ops::SYNC_PASS_MAX_ITEMS,).await;match outcome {diff --git a/src/openhuman/memory/sources/rpc_part_01.rs b/src/openhuman/memory/sources/rpc_part_01.rsindex 8bd1cd0ede..c26003b103 100644--- a/src/openhuman/memory/sources/rpc_part_01.rs+++ b/src/openhuman/memory/sources/rpc_part_01.rs@@ -536,11 +536,12 @@ pub async fn sync_rpc(req: SyncRequest) -> Result<RpcOutcome<SyncResponse>, Strientry.id)})?;- crate::openhuman::integrations::composio::ops::composio_sync_for_source(+ crate::openhuman::integrations::composio::ops::composio_sync_budgeted(&config,connection_id,Some("manual".to_string()),Some(entry.id.clone()),+ entry.max_items,).await?;return Ok(RpcOutcome::new(diff --git a/src/openhuman/memory/sync/composio/bus_part_02.rs b/src/openhuman/memory/sync/composio/bus_part_02.rsindex d65a4d0ec8..ad036fca78 100644--- a/src/openhuman/memory/sync/composio/bus_part_02.rs+++ b/src/openhuman/memory/sync/composio/bus_part_02.rs@@ -338,7 +338,8 @@ impl EventHandler<DomainEvent> for ComposioConnectionCreatedSubscriber {&toolkit,&connection_id,"connection_created",- )+ crate::openhuman::integrations::composio::ops::SYNC_PASS_MAX_ITEMS,+).await;match attempted {Ok(pass) => {diff --git a/src/openhuman/memory/sync/composio/providers/slack/rpc.rs b/src/openhuman/memory/sync/composio/providers/slack/rpc.rsindex 8bdc884538..3ceb7e7d88 100644--- a/src/openhuman/memory/sync/composio/providers/slack/rpc.rs+++ b/src/openhuman/memory/sync/composio/providers/slack/rpc.rs@@ -118,9 +118,15 @@ pub async fn sync_trigger_rpc(// Reads through the `tinyconnectors` module and ingests through the// bound driver's `MemorySourceSink` — see the module doc comment for// why this no longer goes through `MemorySourceSync::run_connection_sync`.- match run_sync_pass(config, "slack", &conn.id, "manual")- .await- .map_err(|error| error.to_string())+ match run_sync_pass(+ config,+ "slack",+ &conn.id,+ "manual",+ crate::openhuman::integrations::composio::ops::SYNC_PASS_MAX_ITEMS,+ )+ .await+ .map_err(|error| error.to_string()){Ok(pass) => outcomes.push(SyncOutcome {toolkit: "slack".to_string(),diff --git a/src/openhuman/modules/memory_part_02.rs b/src/openhuman/modules/memory_part_02.rsindex 2c0f33373a..ecedba644c 100644--- a/src/openhuman/modules/memory_part_02.rs+++ b/src/openhuman/modules/memory_part_02.rs@@ -705,11 +705,13 @@ impl ModuleMemoryProvider {/// embedding's vocabulary. The module serves it as a plain member/// (`OverrideSchedulerGate`), and only this host client names it.pub(crate) async fn override_scheduler_gate(&self, seconds: u64) -> Result<(), MemoryError> {- module_call!(- self,- "override_scheduler_gate",- methods::OVERRIDE_SCHEDULER_GATE,- (seconds,)- )+ // Spelled as a literal, uniquely in this file: the member ships in+ // tinymemory#127 and the pinned v1.13.6 names table predates it, so+ // `methods::OVERRIDE_SCHEDULER_GATE` does not exist to name yet.+ // Against the released module the call answers MemberNotFound, which+ // the RPC surfaces verbatim. Swap to the constant with the next+ // registry re-pin — the compile error this comment trades away is+ // exactly what that swap restores.+ module_call!(self, "override_scheduler_gate", "OverrideSchedulerGate", (seconds,))}}