Skip to content

fix: ensure FTS5 initialized on every startup (#544) - #557

Merged
ajianaz merged 1 commit into
developfrom
fix/544-fts5-missing-on-startup
Jul 4, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/544-fts5-missing-on-startup

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Fresh databases skip all migrations (version stamped at CURRENT_SCHEMA_VERSION), so init_fts5() never runs. FTS5 recall returns empty results.

Add post-migration check in ensure_schema_version() that detects missing memories_fts table and initializes FTS5 + rebuilds index if memories exist.

Closes #544

@ajianaz ajianaz added bug Something isn't working scope:core Core engine work priority:critical Must fix immediately labels Jul 4, 2026
//
// init_fts5() is idempotent (CREATE IF NOT EXISTS / TRIGGER IF NOT EXISTS),
// so it's safe to call on every open.
if !self.fts5_exists()? {
@github-actions

github-actions Bot commented Jul 4, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

⚠️ Review recommended — warnings found.

🟡 Warning (1)

  • unknown:? — Cora AI review could not complete: LLM API returned status 503: ChatGPT Service Unavailable. Review was skipped; no code quality issues were found by the automated check.

Review powered by cora-cli · BYOK · MIT

Fresh databases skip all migrations (version stamped directly at
CURRENT_SCHEMA_VERSION), so migrate_v1_to_v2() — which calls
init_fts5() — never runs. Existing databases at the correct version
also skip migrations. In both cases FTS5 may be missing even though
memories exist, causing FTS5 recall to return empty results.

Add post-migration check in ensure_schema_version() that detects
missing memories_fts table, initializes FTS5, and rebuilds the index
if memories already exist. init_fts5() is idempotent so safe to call
every open.

- Update test_fts5_exists to reflect new auto-init behavior
@ajianaz
ajianaz force-pushed the fix/544-fts5-missing-on-startup branch from 027b991 to e71b140 Compare July 4, 2026 04:02
@ajianaz
ajianaz merged commit af73959 into develop Jul 4, 2026
9 checks passed
@ajianaz
ajianaz deleted the fix/544-fts5-missing-on-startup branch July 9, 2026 14:27
ajianaz added a commit that referenced this pull request Aug 13, 2026
fix: ensure FTS5 initialized on every startup (#544)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority:critical Must fix immediately scope:core Core engine work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRITICAL: Vector index not synced in real-time — new memories invisible to semantic recall

2 participants