Skip to content

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

test(storage): scope sync backend entry signal to workspace

Steven Enamakele2793e4b499b
diff --git a/crates/openhuman-core/src/storage/local.rs b/crates/openhuman-core/src/storage/local.rs
index 6d27965953..2d0698bcbd 100644
--- a/crates/openhuman-core/src/storage/local.rs
+++ b/crates/openhuman-core/src/storage/local.rs
@@ -96,6 +96,19 @@ pub(super) fn arm_test_sync_backend_entry_signal(
});
}
+#[cfg(test)]
+pub(super) fn clear_test_sync_backend_entry_signal(workspace_dir: &Path) {
+ let mut signal = SYNC_BACKEND_ENTRY_TEST_SIGNAL
+ .lock()
+ .unwrap_or_else(PoisonError::into_inner);
+ if signal
+ .as_ref()
+ .is_some_and(|signal| signal.workspace_dir == workspace_dir)
+ {
+ signal.take();
+ }
+}
+
#[cfg(test)]
async fn await_test_backend_open_gate() {
let gate = BACKEND_OPEN_TEST_GATE
diff --git a/crates/openhuman-core/src/storage/local_tests.rs b/crates/openhuman-core/src/storage/local_tests.rs
index 6f0d6de96a..d5d3a87686 100644
--- a/crates/openhuman-core/src/storage/local_tests.rs
+++ b/crates/openhuman-core/src/storage/local_tests.rs
@@ -93,9 +93,10 @@ async fn warm_sync_open_reuses_the_backend_without_entering_the_blocking_bridge(
let dir = tempfile::tempdir().unwrap();
let warmed = backend_for_async(dir.path()).await.unwrap();
let (entered_tx, entered_rx) = std::sync::mpsc::channel();
- super::arm_test_sync_backend_entry_signal(entered_tx);
+ super::arm_test_sync_backend_entry_signal(dir.path(), entered_tx);
let synchronous = backend_for(dir.path()).unwrap();
+ super::clear_test_sync_backend_entry_signal(dir.path());
assert!(Arc::ptr_eq(&warmed, &synchronous));
assert_eq!(
@@ -164,7 +165,7 @@ fn current_thread_sync_fallback_does_not_deadlock_on_async_backend_initializatio
.expect("async initialization claimed the workspace cell");
let (sync_entry_tx, sync_entry_rx) = std::sync::mpsc::channel();
- super::arm_test_sync_backend_entry_signal(sync_entry_tx);
+ super::arm_test_sync_backend_entry_signal(dir.path(), sync_entry_tx);
let releaser = std::thread::spawn(move || {
sync_entry_rx
.recv_timeout(std::time::Duration::from_secs(30))
diff --git a/crates/openhuman-embed/tests/harness_embed.rs b/crates/openhuman-embed/tests/harness_embed.rs
index 19003fb469..5ff9767062 100644
--- a/crates/openhuman-embed/tests/harness_embed.rs
+++ b/crates/openhuman-embed/tests/harness_embed.rs
@@ -108,6 +108,7 @@ fn a_harness_runs_a_turn_against_the_provider_it_was_given() {
// with no timeout, so a test that is meant to be offline waited on the
// network (24 s here) and could wait forever behind a firewall.
let mut config = offline_config();
+ config.mcp_client.enabled = false;
config.modules.allow_download = false;
runtime.block_on(async move {
// `Runtime::block_on` polls its root future on this test thread, whose