fix(memory): initialize provider-none lifecycle during sync

This commit is contained in:
Vincent Koc
2026-06-02 14:22:43 +02:00
parent 0b61add479
commit 0b7c94a5e1
2 changed files with 7 additions and 4 deletions
@@ -137,6 +137,11 @@ describe("memory manager FTS-only reindex", () => {
expect(createEmbeddingProviderMock).not.toHaveBeenCalled();
expect(countChunksContaining("Alpha topic")).toBeGreaterThan(0);
expect(memoryManager.status().custom?.indexIdentity).toEqual({ status: "valid" });
expect(memoryManager.status().custom?.providerState).toEqual({
mode: "fts-only",
reason: "No embedding provider available (FTS-only mode)",
attemptedProviderId: "none",
});
});
it("reports explicit provider-none probes as FTS-only without resolving providers", async () => {
+2 -4
View File
@@ -464,7 +464,7 @@ export class MemoryIndexManager extends MemoryManagerEmbeddingOps implements Mem
log.warn(`memory sync failed (search): ${String(err)}`);
},
});
if (preflight.shouldInitializeProvider && this.settings.provider !== "none") {
if (preflight.shouldInitializeProvider) {
await this.ensureProviderInitialized();
}
if (!this.provider && this.providerLifecycle.mode === "degraded") {
@@ -802,9 +802,7 @@ export class MemoryIndexManager extends MemoryManagerEmbeddingOps implements Mem
return this.syncing;
}
this.syncing = (async () => {
if (this.settings.provider !== "none") {
await this.ensureProviderInitialized();
}
await this.ensureProviderInitialized();
await this.runSyncWithReadonlyRecovery(params);
})().finally(() => {
this.syncing = null;