Skip to content

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

fix(tests): serialize composio connector module access in integration tests

Steven Enamakel752d81545f85
diff --git a/tests/raw_coverage/composio_raw_coverage_e2e.rs b/tests/raw_coverage/composio_raw_coverage_e2e.rs
index 3031ae2e99..8d4abb9641 100644
--- a/tests/raw_coverage/composio_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/composio_raw_coverage_e2e.rs
@@ -319,6 +319,7 @@ async fn composio_connected_integrations_public_helpers_handle_empty_auth_and_id
#[tokio::test]
async fn composio_ops_mode_is_local_and_trigger_history_reflects_module_archive_availability() {
+ let _module = crate::CONNECTOR_MODULE_LOCK.lock().await;
crate::tinyhumans_boot::boot();
let dir = tempdir().expect("tempdir");
let mut config = Config {
@@ -406,6 +407,7 @@ fn composio_action_tool_metadata_is_stable_without_network_execution() {
#[tokio::test]
async fn composio_action_tool_execute_reports_missing_route_without_network() {
+ let _module = crate::CONNECTOR_MODULE_LOCK.lock().await;
crate::tinyhumans_boot::boot();
let tmp = tempfile::tempdir().expect("temp config directory");
let mut config = Config::default();
@@ -1005,6 +1007,7 @@ async fn composio_call(controller: &RegisteredController, params: Value) -> Resu
#[tokio::test]
async fn composio_agent_tools_cover_metadata_missing_params_and_scope_helpers() {
+ let _module = crate::CONNECTOR_MODULE_LOCK.lock().await;
crate::tinyhumans_boot::boot();
let dir = tempdir().expect("tempdir");
let config = Config {
@@ -1141,6 +1144,7 @@ async fn composio_agent_tools_cover_metadata_missing_params_and_scope_helpers()
#[tokio::test]
async fn composio_agent_tools_direct_mode_take_local_branches_without_backend() {
+ let _module = crate::CONNECTOR_MODULE_LOCK.lock().await;
crate::tinyhumans_boot::boot();
let dir = tempdir().expect("tempdir");
let mut config = Config {
@@ -1827,6 +1831,7 @@ async fn composio_authorize_scope_merging_and_meta_cleanup_use_local_backend() {
#[tokio::test]
async fn composio_direct_tool_public_surface_handles_local_metadata_and_errors() {
+ let _module = crate::CONNECTOR_MODULE_LOCK.lock().await;
crate::tinyhumans_boot::boot();
let tool = ComposioTool::new(
" direct-api-key ",
diff --git a/tests/raw_coverage_all.rs b/tests/raw_coverage_all.rs
index 62e2b40e65..2d0c181d1c 100644
--- a/tests/raw_coverage_all.rs
+++ b/tests/raw_coverage_all.rs
@@ -33,6 +33,15 @@ use std::sync::{Mutex, OnceLock};
/// panicking test cannot wedge the whole suite.
pub static SHARED_ENV_LOCK: OnceLock<Mutex<()>> = OnceLock::new();
+/// Serializes aggregated suites that reach the Composio connector module.
+///
+/// The module is loaded once per process and holds exactly one route, so two
+/// tests that point it at different routes (backend vs direct mode) race when
+/// run concurrently: one reconfigures the module mid-call and the other sees
+/// the wrong route. The core's own unit tests serialize on `module_guard`,
+/// which is `cfg(test)`-only; this is the integration-binary equivalent.
+pub static CONNECTOR_MODULE_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());
+
/// The TinyHumans backend transport for every aggregated suite that boots the
/// core in-process and reaches the mock backend: call
/// `crate::tinyhumans_boot::boot()` from the suite's fixture (or each test).