Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

test(mcp): wait for the async burst fallback

AkitaOnRails1ab58c0dc6ac
diff --git a/crates/ai-memory-mcp/tests/suite/stress_autoscope.rs b/crates/ai-memory-mcp/tests/suite/stress_autoscope.rs
index 4f0ac47b..c3e5074b 100644
--- a/crates/ai-memory-mcp/tests/suite/stress_autoscope.rs
+++ b/crates/ai-memory-mcp/tests/suite/stress_autoscope.rs
@@ -683,11 +683,17 @@ async fn burst_above_max_entries_does_not_corrupt() {
h.await.expect("burst hook join");
}
- // Settle: every spawned process_envelope must drain.
- for _ in 0..50 {
+ // The hook response is deliberately fire-and-forget: 202 can arrive before
+ // any spawned `process_envelope` publishes the shared fallback. Poll the
+ // invariant this test later relies on instead of racing a fixed sleep on
+ // slower Windows runners.
+ for _ in 0..200 {
+ if h.active_project.get().is_some() {
+ break;
+ }
tokio::task::yield_now().await;
+ tokio::time::sleep(Duration::from_millis(5)).await;
}
- tokio::time::sleep(Duration::from_millis(50)).await;
// Now BURST_SIZE parallel reads. Every read must return a JSON-RPC
// 200 — no panic, no 500. The CONTENT may be any of the projects