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): honest trigger, per-pass item budget, pinned detail contract
Shanuda09b4675311
diff --git a/src/openhuman/integrations/composio/ops/mod.rs b/src/openhuman/integrations/composio/ops/mod.rsindex 59f81c0d63..05dd667961 100644--- a/src/openhuman/integrations/composio/ops/mod.rs+++ b/src/openhuman/integrations/composio/ops/mod.rs@@ -40,6 +40,7 @@ pub use connections::{composio_authorize, composio_delete_connection, composio_lpub use direct_mode::{composio_clear_api_key, composio_get_mode, composio_set_api_key};pub(crate) use error_utils::{report_composio_op_error, should_forward_tags};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,diff --git a/src/openhuman/integrations/composio/ops/providers_ops.rs b/src/openhuman/integrations/composio/ops/providers_ops.rsindex a3349099b1..f3685f08c9 100644--- a/src/openhuman/integrations/composio/ops/providers_ops.rs+++ b/src/openhuman/integrations/composio/ops/providers_ops.rs@@ -34,6 +34,23 @@ use tinyconnectors_bus::records::{ConnectorSyncRequest, ConnectorSyncResponse};/// Slack are both Composio records; the *toolkit* lives in the source id.const SOURCE_KIND: &str = "composio";+/// Per-pass item budget handed to the connector's `Sync` member.+///+/// One pass is one budgeted slice of the account; the pass loop in+/// `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;++/// The `completed` stage's detail string.+///+/// A parse contract, not prose: the Sources UI extracts the count with+/// `/ingested\s+(\d+)\s+item/i` and falls back to a generic "up to date"+/// when it cannot (#3295). Pinned by a unit test against that exact pattern.+pub(crate) fn completed_sync_detail(total_written: u64) -> String {+ format!("ingested {total_written} item(s)")+}+/// Aggregate result of [`composio_refresh_all_identities`].#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]pub struct RefreshIdentitiesReport {@@ -233,9 +250,10 @@ pub async fn composio_sync_for_source(let reason_for_task = reason.as_str().to_string();let source_for_task = source_id.clone();+ let trigger_for_task = reason.as_str().to_string();let publish_stage = move |stage: &str, detail: Option<String>| {crate::core::bus::BUS.publish(crate::core::events::DomainEvent::MemorySyncStageChanged {- trigger: "manual".to_string(),+ trigger: trigger_for_task.clone(),stage: stage.to_string(),provider: Some(toolkit_for_task.clone()),connection_id: Some(connection_for_task.clone()),@@ -304,10 +322,7 @@ pub async fn composio_sync_for_source(// The detail is a parse contract, not prose: the Sources UI// extracts the count with `/ingested\s+(\d+)\s+item/i` and// falls back to a generic "up to date" when it cannot (#3295).- publish_stage(- "completed",- Some(format!("ingested {total_written} item(s)")),- );+ publish_stage("completed", Some(completed_sync_detail(total_written)));}Err(error) => {report_composio_op_error("sync", &anyhow::anyhow!("{error}"));@@ -384,6 +399,11 @@ pub(crate) async fn run_sync_pass(toolkit: toolkit.to_string(),connection_id: Some(connection_id.to_string()),reason: Some(reason.to_string()),+ // One pass is one budgeted slice, not "the whole account": without+ // 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),..ConnectorSyncRequest::default()},)diff --git a/src/openhuman/integrations/composio/ops_tests_part_03_tests.rs b/src/openhuman/integrations/composio/ops_tests_part_03_tests.rsindex 577ad84ae1..82f7d263be 100644--- a/src/openhuman/integrations/composio/ops_tests_part_03_tests.rs+++ b/src/openhuman/integrations/composio/ops_tests_part_03_tests.rs@@ -637,3 +637,46 @@ async fn composio_list_connections_returns_empty_when_direct_mode_no_key() {outcome.logs);}++// ── sync stage-event contracts (#5932) ───────────────────────────────────────++/// The completed-stage detail is a parse contract with the Sources UI, which+/// extracts the count via `/ingested\s+(\d+)\s+item/i` and shows a generic+/// "up to date" when the pattern misses (#3295). This is the exact regex,+/// ported, against the exact producer.+#[test]+fn completed_sync_detail_matches_the_ui_parse_contract() {+ let re = regex::Regex::new(r"(?i)ingested\s+(\d+)\s+item").expect("ui parse regex");+ for count in [0u64, 1, 200, 25_000] {+ let detail = crate::openhuman::integrations::composio::ops::completed_sync_detail(count);+ let caps = re+ .captures(&detail)+ .unwrap_or_else(|| panic!("detail must parse: {detail}"));+ assert_eq!(+ caps[1].parse::<u64>().unwrap(),+ count,+ "count survives: {detail}"+ );+ }+}++/// Every parsed sync reason is a distinct event trigger — the stage events+/// must not collapse periodic and connection-created syncs into "manual"+/// (review finding on #5932).+#[test]+fn sync_reasons_map_to_distinct_triggers() {+ use crate::openhuman::integrations::composio::providers::SyncReason;+ let all = [+ SyncReason::Manual,+ SyncReason::Periodic,+ SyncReason::ConnectionCreated,+ ];+ let mut seen = std::collections::HashSet::new();+ for reason in all {+ assert!(+ seen.insert(reason.as_str().to_string()),+ "duplicate trigger"+ );+ }+ assert_eq!(seen.len(), 3);+}