From 2131da5101aad6ca1079cb100821f64c436b9cea Mon Sep 17 00:00:00 2001 From: kartik-mem0 Date: Thu, 19 Mar 2026 10:45:22 +0530 Subject: [PATCH] test: add wait for search index in integration helpers --- mem0-ts/src/client/tests/integration/helpers.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mem0-ts/src/client/tests/integration/helpers.ts b/mem0-ts/src/client/tests/integration/helpers.ts index 4bb3a5fc2..df77d7220 100644 --- a/mem0-ts/src/client/tests/integration/helpers.ts +++ b/mem0-ts/src/client/tests/integration/helpers.ts @@ -104,8 +104,17 @@ export async function seedTestMemories( { user_id: userId }, ); - // Wait for async processing + // Wait for async processing (listing index) const memories = await waitForMemories(client, userId, 1); + + // Also wait for search index — it can lag behind getAll under load (e.g. CI) + const start = Date.now(); + while (Date.now() - start < 60_000) { + const results = await client.search("favorite color", { user_id: userId }); + if (Array.isArray(results) && results.length > 0) break; + await new Promise((r) => setTimeout(r, 3_000)); + } + return memories.map((m) => m.id); }