Skip to content

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

test(memory): add settle call to avoid race in migration and e2e tests

Steven Enamakel122dcaaddfd4
diff --git a/crates/openhuman-core/src/config/migration_helpers/ops_tests.rs b/crates/openhuman-core/src/config/migration_helpers/ops_tests.rs
index 539e600fde..808e305972 100644
--- a/crates/openhuman-core/src/config/migration_helpers/ops_tests.rs
+++ b/crates/openhuman-core/src/config/migration_helpers/ops_tests.rs
@@ -50,6 +50,9 @@ async fn migrate_openclaw_dry_run_on_empty_source_returns_report() {
#[cfg(feature = "modules")]
#[tokio::test]
async fn migrate_openclaw_apply_imports_markdown_entries_into_target_workspace() {
+ // Apply writes through the memory module: wait out its load first (see
+ // `migrate_hermes_apply_imports_markdown_entries`).
+ crate::memory::test_support::settle_memory_module().await;
// Regression for #1440: prior to this PR the Apply path
// (`dry_run = false`) bailed at `create_memory_for_migration`
// because the unified namespace memory core hard-disabled it.
diff --git a/tests/memory_sources_e2e.rs b/tests/memory_sources_e2e.rs
index 724edec49a..ff3ee506e3 100644
--- a/tests/memory_sources_e2e.rs
+++ b/tests/memory_sources_e2e.rs
@@ -6,6 +6,9 @@
//!
//! Run with: `cargo test --test memory_sources_e2e`
+#[path = "support/memory_module.rs"]
+mod memory_module;
+
use std::path::Path;
use std::sync::{Arc, Mutex, OnceLock};
use std::time::Duration;
@@ -113,6 +116,9 @@ embedding_strict = false
async fn serve() -> (String, tokio::task::JoinHandle<Result<(), std::io::Error>>) {
ensure_memory_seams();
ensure_rpc_auth();
+ // Every flow here reaches the memory module; wait out its load so a test
+ // running in its own process does not race it (tests/support/memory_module.rs).
+ memory_module::settle().await;
let listener = tokio::net::TcpListener::bind("127.0.0.1:0")
.await
.expect("bind");