Skip to content

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

fix(test): migrate synchronous test guards to async

Steven Enamakelcb0f09e2a499
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_steering_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_steering_tests.rs
index 4b52ec859c..bd5ae50cd1 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_steering_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_steering_tests.rs
@@ -2,7 +2,7 @@ use super::*;
#[tokio::test]
async fn steer_pushes_into_the_subagent_queue() {
- let _guard = test_guard();
+ let _guard = test_guard_async().await;
let rq = run_queue();
let tx = register_test("task-steer", "session-A", rq.clone());
@@ -38,7 +38,7 @@ async fn steer_pushes_into_the_subagent_queue() {
#[tokio::test]
async fn steer_prefers_registered_tinyagents_handle() {
- let _guard = test_guard();
+ let _guard = test_guard_async().await;
let rq = run_queue();
let tx = register_test("task-registered-steer", "session-A", rq.clone());
let handle = SteeringHandle::allow_all();
@@ -75,7 +75,7 @@ async fn steer_prefers_registered_tinyagents_handle() {
#[tokio::test]
async fn steer_rejects_cross_parent_and_unknown() {
- let _guard = test_guard();
+ let _guard = test_guard_async().await;
let rq = run_queue();
let _tx = register_test("task-owned", "session-owner", rq);
@@ -104,7 +104,7 @@ async fn steer_rejects_cross_parent_and_unknown() {
#[tokio::test]
async fn steer_after_terminal_is_rejected() {
- let _guard = test_guard();
+ let _guard = test_guard_async().await;
let rq = run_queue();
let tx = register_test("task-term", "session-A", rq);
let _ = tx.send(DetachedSubagentStatus::Failed {
@@ -120,7 +120,7 @@ async fn steer_after_terminal_is_rejected() {
#[tokio::test]
async fn detached_subagent_rejects_followup_lane() {
- let _guard = test_guard();
+ let _guard = test_guard_async().await;
let rq = run_queue();
let _tx = register_test("task-no-followup", "session-A", rq.clone());
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_wire_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_wire_tests.rs
index f5dde69d16..9a25452aca 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_wire_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_wire_tests.rs
@@ -30,7 +30,7 @@ fn spec(id: &str, parent: &str, session: Option<&str>) -> OrchestrationTaskSpec
#[tokio::test]
async fn roster_status_labels_are_literal() {
- let _guard = super::test_guard();
+ let _guard = super::test_guard_async().await;
let mut senders = Vec::new();
for id in ["wire-run", "wire-done", "wire-await", "wire-fail"] {
let (tx, rx) = status_channel();
@@ -159,7 +159,7 @@ async fn durable_fallback_maps_every_store_status_to_literal_wait_outcome() {
#[tokio::test]
async fn spawn_ledger_record_has_literal_persisted_shape() {
- let _guard = super::test_guard();
+ let _guard = super::test_guard_async().await;
let ws = tempfile::tempdir().unwrap();
let (_tx, rx) = status_channel();
register(
diff --git a/crates/openhuman-core/src/integrations/composio/ops_fetch_integrations_and_triggers_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_fetch_integrations_and_triggers_tests.rs
index b0825253a9..2185f93fcc 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_fetch_integrations_and_triggers_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_fetch_integrations_and_triggers_tests.rs
@@ -2,7 +2,7 @@ use super::*;
#[tokio::test]
async fn offline_local_session_never_fetches_hosted_integrations() {
- let _guard = cache_guard();
+ let _guard = cache_guard_async().await;
let tmp = tempfile::tempdir().unwrap();
let mut config = Config::default();
config.workspace_dir = tmp.path().join("workspace");
@@ -27,7 +27,7 @@ async fn offline_local_session_never_fetches_hosted_integrations() {
#[tokio::test]
async fn fetch_connected_integrations_via_mock_aggregates_tools() {
- let _guard = cache_guard();
+ let _guard = cache_guard_async().await;
// Connections: gmail + notion. Tools: filtered to those toolkits
// and prefixed with the uppercased slug. The toolkits route
// backs the `list_toolkits()` allowlist gate that
@@ -90,7 +90,7 @@ async fn fetch_connected_integrations_via_mock_aggregates_tools() {
#[tokio::test]
async fn fetch_connected_integrations_treats_slack_and_telegram_status_like_ui() {
- let _guard = cache_guard();
+ let _guard = cache_guard_async().await;
let app = Router::new()
.route(
"/agent-integrations/composio/toolkits",
@@ -161,7 +161,7 @@ async fn fetch_connected_integrations_treats_slack_and_telegram_status_like_ui()
#[tokio::test]
async fn fetch_connected_integrations_via_mock_returns_empty_with_no_active() {
- let _guard = cache_guard();
+ let _guard = cache_guard_async().await;
let app = Router::new().route(
"/agent-integrations/composio/connections",
get(|| async {
@@ -302,7 +302,7 @@ fn sync_cache_treats_connected_status_equivalent_to_active() {
#[tokio::test]
async fn cache_entries_survive_idle_time_until_connection_change() {
- let _guard = cache_guard();
+ let _guard = cache_guard_async().await;
let tmp = tempfile::TempDir::new().unwrap();
let config = test_config(&tmp);
let key = crate::integrations::composio::connected_integrations::cache_key(&config);
@@ -555,7 +555,7 @@ async fn composio_list_toolkits_returns_empty_in_direct_mode() {
#[tokio::test]
async fn composio_list_connections_routes_through_direct_mode() {
let _serialised = module_guard().await;
- let _guard = cache_guard();
+ let _guard = cache_guard_async().await;
let tmp = tempfile::tempdir().unwrap();
let config = direct_mode_config(&tmp);
// [composio-direct] After commit 2 of #1710, direct mode actually
diff --git a/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs
index 96c4c9853f..885e1c1c5d 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs
@@ -235,7 +235,7 @@ fn cache_key_is_based_on_config_path_string() {
#[tokio::test]
async fn fetch_connected_integrations_returns_empty_without_auth() {
- let _guard = cache_guard();
+ let _guard = cache_guard_async().await;
let tmp = tempfile::tempdir().unwrap();
let config = test_config(&tmp);
let integrations = fetch_connected_integrations(&config).await;
diff --git a/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
index a571390011..92e63cbf84 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
@@ -8,7 +8,7 @@ async fn composio_get_user_profile_via_mock_returns_provider_profile() {
// `Once`-guarded, so a test that omits it passes only while some
// earlier test in the same binary happened to run first.
use crate::config::TEST_ENV_LOCK;
- let _cache_guard = cache_guard();
+ let _cache_guard = cache_guard_async().await;
let _env_guard = TEST_ENV_LOCK.lock().await;
// This test mutates BACKEND_URL below via EnvVarGuard, which races with
// openhuman_tinyhumans::backend::url / core::cli_tests tests