Skip to content

Commit 974fb8c

Browse files
[AI] fix(memory): gate hasSemanticChunks scan to missing-identity path only
Only compute hasOnlyFtsChunks when identity is missing, chunks exist, and the provider is unavailable. This avoids scanning the chunks table for model classification on every ordinary sync.
1 parent 7621e7d commit 974fb8c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

extensions/memory-core/src/memory/manager-sync-ops.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2084,7 +2084,16 @@ export abstract class MemoryManagerSyncOps {
20842084
// Wait for the configured provider before replacing them with a rebuilt index,
20852085
// unless every existing chunk is FTS-only — in that case rebuilding as
20862086
// FTS-only is safe even without a provider because no semantic data is lost.
2087-
const hasOnlyFtsChunks = this.hasIndexedChunks() && !this.hasSemanticChunks();
2087+
// Gate the chunk-model scan: only compute when identity is missing,
2088+
// chunks exist, and the provider is unavailable (no target session files
2089+
// is already checked by needsMissingIdentityReindex below).
2090+
const needsFtsOnlyClassification =
2091+
indexIdentity.status === "missing" &&
2092+
hasIndexedChunks &&
2093+
this.provider === null &&
2094+
this.settings.provider &&
2095+
this.settings.provider !== "none";
2096+
const hasOnlyFtsChunks = needsFtsOnlyClassification && !this.hasSemanticChunks();
20882097
const canRebuildMissingIdentity =
20892098
this.provider !== null ||
20902099
!this.settings.provider ||

0 commit comments

Comments
 (0)