From ae7121d534b525904d1ac2552247fa7bc6bc5209 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 13 Mar 2026 19:01:49 +0000 Subject: [PATCH] refactor: share memory concurrency config --- src/memory/manager.get-concurrency.test.ts | 25 +++++++--------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/memory/manager.get-concurrency.test.ts b/src/memory/manager.get-concurrency.test.ts index 67b10768fc3..515a9d8226d 100644 --- a/src/memory/manager.get-concurrency.test.ts +++ b/src/memory/manager.get-concurrency.test.ts @@ -49,9 +49,8 @@ describe("memory manager cache hydration", () => { await fs.rm(workspaceDir, { recursive: true, force: true }); }); - it("deduplicates concurrent manager creation for the same cache key", async () => { - const indexPath = path.join(workspaceDir, "index.sqlite"); - const cfg = { + function createMemoryConcurrencyConfig(indexPath: string): OpenClawConfig { + return { agents: { defaults: { workspace: workspaceDir, @@ -65,6 +64,11 @@ describe("memory manager cache hydration", () => { list: [{ id: "main", default: true }], }, } as OpenClawConfig; + } + + it("deduplicates concurrent manager creation for the same cache key", async () => { + const indexPath = path.join(workspaceDir, "index.sqlite"); + const cfg = createMemoryConcurrencyConfig(indexPath); const results = await Promise.all( Array.from( @@ -85,20 +89,7 @@ describe("memory manager cache hydration", () => { it("drains in-flight manager creation during global teardown", async () => { const indexPath = path.join(workspaceDir, "index.sqlite"); - const cfg = { - agents: { - defaults: { - workspace: workspaceDir, - memorySearch: { - provider: "openai", - model: "mock-embed", - store: { path: indexPath, vector: { enabled: false } }, - sync: { watch: false, onSessionStart: false, onSearch: false }, - }, - }, - list: [{ id: "main", default: true }], - }, - } as OpenClawConfig; + const cfg = createMemoryConcurrencyConfig(indexPath); hoisted.providerDelayMs = 100;