From 44bbb4ddf42d4c420b60bd814cf6ea79fc76112d Mon Sep 17 00:00:00 2001 From: Vignesh Natarajan Date: Sat, 14 Feb 2026 18:48:39 -0800 Subject: [PATCH] chore (memory): add status dirty rebound regression test --- src/memory/index.test.ts | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/memory/index.test.ts b/src/memory/index.test.ts index 8d4a08a49d..4e8d5a8471 100644 --- a/src/memory/index.test.ts +++ b/src/memory/index.test.ts @@ -161,6 +161,51 @@ describe("memory index", () => { ); }); + it("keeps dirty false in status-only manager after prior indexing", async () => { + const indexStatusPath = path.join(workspaceDir, "index-status.sqlite"); + await fs.rm(indexStatusPath, { force: true }); + await fs.rm(`${indexStatusPath}-shm`, { force: true }); + await fs.rm(`${indexStatusPath}-wal`, { force: true }); + + const cfg = { + agents: { + defaults: { + workspace: workspaceDir, + memorySearch: { + provider: "openai", + model: "mock-embed", + store: { path: indexStatusPath, vector: { enabled: false } }, + sync: { watch: false, onSessionStart: false, onSearch: true }, + query: { minScore: 0, hybrid: { enabled: false } }, + }, + }, + list: [{ id: "main", default: true }], + }, + }; + + const first = await getMemorySearchManager({ cfg, agentId: "main" }); + expect(first.manager).not.toBeNull(); + if (!first.manager) { + throw new Error("manager missing"); + } + await first.manager.sync?.({ reason: "test" }); + await first.manager.close?.(); + + const statusOnly = await getMemorySearchManager({ + cfg, + agentId: "main", + purpose: "status", + }); + expect(statusOnly.manager).not.toBeNull(); + if (!statusOnly.manager) { + throw new Error("status manager missing"); + } + + const status = statusOnly.manager.status(); + expect(status.dirty).toBe(false); + await statusOnly.manager.close?.(); + }); + it("reindexes when the embedding model changes", async () => { const indexModelPath = path.join(workspaceDir, "index-model-change.sqlite"); await fs.rm(indexModelPath, { force: true });