Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/retriever.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ export class MemoryRetriever {
async retrieve(context: RetrievalContext): Promise<RetrievalResult[]> {
const { query, limit, scopeFilter, category, source } = context;
const safeLimit = clampInt(limit, 1, 20);
// Ensure store is fully initialized before routing decision (hybrid vs vector-only).
// Without this, hasFtsSupport may be false on first call if FTS index creation is still in flight.
await this.store.ensureInitialized();
this.lastDiagnostics = null;
const diagnostics: RetrievalDiagnostics = {
source,
Expand Down
3 changes: 2 additions & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ export class MemoryStore {
return this.config.dbPath;
}

private async ensureInitialized(): Promise<void> {
/** Ensure the store is fully initialized (FTS index created, table opened, etc.). Safe to call multiple times. */
public async ensureInitialized(): Promise<void> {
if (this.table) {
return;
}
Expand Down
Loading