Skip to content

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

test(composio): tolerate module archive initialization order

Steven Enamakeld7f5451fd327
diff --git a/tests/raw_coverage/composio_tools_ops_state_raw_coverage_e2e.rs b/tests/raw_coverage/composio_tools_ops_state_raw_coverage_e2e.rs
index 56a790b3b7..bee6c8cc1c 100644
--- a/tests/raw_coverage/composio_tools_ops_state_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/composio_tools_ops_state_raw_coverage_e2e.rs
@@ -310,21 +310,15 @@ async fn round17_ops_trigger_history_app_state_and_profiles_cover_local_edges()
let harness = setup(&base).await;
store_app_session_token(&harness.config, "round17-session-token");
- // Trigger history is process-global. The aggregated raw-coverage target
- // also exercises it from other Composio modules, so cover the unavailable
- // branch only when this test is first and otherwise use the existing
- // module-owned store.
- let store = if let Some(store) = global_composio_trigger_history() {
- store
- } else {
- let missing_history = composio_list_trigger_history(&harness.config, Some(5))
- .await
- .expect_err("history not initialized");
- assert!(missing_history.contains("archive store is not initialized"));
-
+ // The loaded TinyConnectors module owns its process-global archive. An
+ // earlier raw-coverage test may have loaded it without a state directory,
+ // which is terminal until process exit; the host-side archive below cannot
+ // retrofit one. Exercise either valid module outcome instead of assuming
+ // suite order gives this test the first load.
+ let store = global_composio_trigger_history().unwrap_or_else(|| {
init_composio_trigger_history(harness.workspace.clone()).expect("init history");
global_composio_trigger_history().expect("global history store")
- };
+ });
let marker_prefix = format!("round17-{}", uuid::Uuid::new_v4());
for idx in 0..3 {
@@ -338,19 +332,18 @@ async fn round17_ops_trigger_history_app_state_and_profiles_cover_local_edges()
)
.expect("record trigger");
}
- let clamped = composio_list_trigger_history(&harness.config, Some(9999))
- .await
- .expect("list initialized history")
- .value;
- assert!(clamped.entries.len() >= 3);
- assert!(clamped
- .entries
- .iter()
- .filter(|entry| entry.metadata_id.starts_with(&marker_prefix))
- .count()
- >= 3);
- assert!(clamped.archive_dir.ends_with("/state/triggers"));
- assert!(clamped.current_day_file.ends_with(".jsonl"));
+ match composio_list_trigger_history(&harness.config, Some(9999)).await {
+ Ok(history) => {
+ let history = history.value;
+ assert!(history.entries.len() <= 500);
+ assert!(history.archive_dir.ends_with("/state/triggers"));
+ assert!(history.current_day_file.ends_with(".jsonl"));
+ }
+ Err(error) => {
+ assert!(error.contains("list_trigger_history failed"), "{error}");
+ assert!(error.contains("state_dir"), "{error}");
+ }
+ }
let state_dir = harness.workspace.join("state");
std::fs::create_dir_all(&state_dir).expect("state dir");