Skip to content

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

test(flows): add coverage for draft ids, tier gates, and credentials

Steven Enamakelc8bb2025e824
diff --git a/crates/openhuman-core/src/flows/builder_tools_draft_id_tests.rs b/crates/openhuman-core/src/flows/builder_tools_draft_id_tests.rs
index df1f3e59c1..315f900d29 100644
--- a/crates/openhuman-core/src/flows/builder_tools_draft_id_tests.rs
+++ b/crates/openhuman-core/src/flows/builder_tools_draft_id_tests.rs
@@ -148,6 +148,9 @@ async fn dry_run_workflow_by_flow_id_runs_the_saved_flow_graph() {
#[tokio::test]
async fn validate_workflow_by_draft_id_checks_the_draft_graph() {
+ // Reaches the connector module, whose route is process-wide: hold the module
+ // lock (before TEST_ENV_LOCK, the established order) for the whole test.
+ let _module = crate::integrations::composio::module_client::module_guard().await;
let tmp = TempDir::new().unwrap();
let config = test_config(&tmp);
let draft = ops::flows_draft_create(
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
index 2b1ab3b393..65109ea9c3 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
@@ -179,6 +179,9 @@ async fn composio_read_action_allowed_under_readonly_tier() {
/// reads included).
#[tokio::test]
async fn composio_read_action_does_not_prompt_under_supervised_tier() {
+ // Reaches the connector module, whose route is process-wide: hold the module
+ // lock (before TEST_ENV_LOCK, the established order) for the whole test.
+ let _module = crate::integrations::composio::module_client::module_guard().await;
use crate::security::AutonomyLevel;
let class = classify_composio_action_for_tier("TWITTER_RECENT_SEARCH").await;
diff --git a/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs b/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs
index cdbd8d7cc8..6d754b778e 100644
--- a/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs
@@ -387,6 +387,9 @@ async fn set_and_clear_api_key_credential() {
// directory the key was stored beside.
#[tokio::test]
async fn clearing_the_session_preserves_a_coexisting_api_key() {
+ // Reaches the connector module, whose route is process-wide: hold the module
+ // lock (before TEST_ENV_LOCK, the established order) for the whole test.
+ let _module = crate::integrations::composio::module_client::module_guard().await;
let _env_guard = crate::config::TEST_ENV_LOCK.lock().await;
let tmp = TempDir::new().unwrap();
std::fs::create_dir_all(tmp.path().join("workspace")).unwrap();
@@ -471,6 +474,9 @@ async fn clearing_the_session_preserves_a_coexisting_api_key() {
// let an unrelated leftover key silently become the effective one.
#[tokio::test]
async fn clearing_the_session_preserves_the_active_key_over_a_stale_destination_key() {
+ // Reaches the connector module, whose route is process-wide: hold the module
+ // lock (before TEST_ENV_LOCK, the established order) for the whole test.
+ let _module = crate::integrations::composio::module_client::module_guard().await;
let _env_guard = crate::config::TEST_ENV_LOCK.lock().await;
let tmp = TempDir::new().unwrap();
std::fs::create_dir_all(tmp.path().join("workspace")).unwrap();
@@ -559,6 +565,9 @@ async fn clearing_the_session_preserves_the_active_key_over_a_stale_destination_
// location and leave it clearable/resurrectable later.
#[tokio::test]
async fn clearing_without_a_kind_removes_a_user_scoped_api_key_at_its_source() {
+ // Reaches the connector module, whose route is process-wide: hold the module
+ // lock (before TEST_ENV_LOCK, the established order) for the whole test.
+ let _module = crate::integrations::composio::module_client::module_guard().await;
let _env_guard = crate::config::TEST_ENV_LOCK.lock().await;
let tmp = TempDir::new().unwrap();
std::fs::create_dir_all(tmp.path().join("workspace")).unwrap();