Skip to content

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

fix(test): replace blocking lock with async lock in test helpers

Steven Enamakel39da7f09a583
diff --git a/crates/openhuman-core/src/agent/artifacts/ops_tests.rs b/crates/openhuman-core/src/agent/artifacts/ops_tests.rs
index a39ac7110a..d66413c1fd 100644
--- a/crates/openhuman-core/src/agent/artifacts/ops_tests.rs
+++ b/crates/openhuman-core/src/agent/artifacts/ops_tests.rs
@@ -321,7 +321,7 @@ struct DefaultFilesDir {
impl DefaultFilesDir {
async fn under(tmp: &TempDir) -> Self {
let lock = crate::config::TEST_ENV_LOCK
- .blocking_lock();
+ .lock().await;
let previous = std::env::var_os("OPENHUMAN_PROJECTS_DIR");
let projects = tmp.path().join("projects");
unsafe {
diff --git a/crates/openhuman-core/src/security/approval/gate_tests.rs b/crates/openhuman-core/src/security/approval/gate_tests.rs
index a0a34a4576..5f3cbaa109 100644
--- a/crates/openhuman-core/src/security/approval/gate_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_tests.rs
@@ -83,7 +83,7 @@ async fn expiry_gate() -> (ApprovalGate, TempDir, EnvVarGuard) {
// developer who exported it in their shell. effective_ttl would then
// replace EXPIRY_TEST_TTL at park time and the wait would be measuring
// their value, so clear it while the lock is held.
- let env = EnvVarGuard::locked_unset("OPENHUMAN_APPROVAL_TTL_SECS");
+ let env = EnvVarGuard::locked_unset_async("OPENHUMAN_APPROVAL_TTL_SECS").await;
let (gate, dir) = test_gate_with_ttl(EXPIRY_TEST_TTL);
(gate, dir, env)
}
diff --git a/crates/openhuman-core/src/threads/ops/live_state_tests.rs b/crates/openhuman-core/src/threads/ops/live_state_tests.rs
index c19805291b..d5aedd5ccb 100644
--- a/crates/openhuman-core/src/threads/ops/live_state_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/live_state_tests.rs
@@ -24,7 +24,7 @@ struct WorkspaceGuard {
impl WorkspaceGuard {
async fn new() -> Self {
- let lock = TEST_ENV_LOCK.blocking_lock();
+ let lock = TEST_ENV_LOCK.lock().await;
let tmp = tempfile::tempdir().expect("tempdir");
unsafe {
std::env::set_var("OPENHUMAN_WORKSPACE", tmp.path());