fix(hermes_state): gracefully degrade when SQLite build lacks FTS5#13222
Closed
hclsys wants to merge 1 commit into
Closed
fix(hermes_state): gracefully degrade when SQLite build lacks FTS5#13222hclsys wants to merge 1 commit into
hclsys wants to merge 1 commit into
Conversation
Some SQLite builds (Python 3.11 on macOS via certain Homebrew and pyenv installations) compile sqlite3 without the FTS5 module. When FTS5 is missing, CREATE VIRTUAL TABLE ... USING fts5(...) throws "no such module: fts5", which killed every SQLite-backed feature because SessionDB init never completed: sessions list, insights, external Scarf readers all failed while the JSONL fallback kept the primary flow working and hid the failure. Detect the FTS5-missing OperationalError during init, record the state in self._fts5_available, and log a one-time warning. In search_messages, skip the MATCH query when FTS5 is unavailable and route through the existing LIKE fallback that was already used for CJK queries. Non-search features (session list, history, insights primary path) keep working unchanged. Fixes NousResearch#13029
Author
|
Closing for queue hygiene — crossed the 20h inherited ceiling with zero maintainer engagement. The SessionDB FTS5 graceful-degradation fix for #13029 remains clean and re-submittable — Python 3.11/macOS users hitting the 'no such module: fts5' crash still benefit from the fallback path. |
Collaborator
|
Likely duplicate of #10972 — same fix: graceful FTS5 degradation in SessionDB with LIKE fallback. |
2 similar comments
Collaborator
|
Likely duplicate of #10972 — same fix: graceful FTS5 degradation in SessionDB with LIKE fallback. |
Collaborator
|
Likely duplicate of #10972 — same fix: graceful FTS5 degradation in SessionDB with LIKE fallback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Some SQLite builds (Python 3.11 on macOS via certain Homebrew and pyenv formulae) compile `sqlite3` without the FTS5 module. When FTS5 is missing, `CREATE VIRTUAL TABLE ... USING fts5(...)` throws `sqlite3.OperationalError: no such module: fts5`.
Before this patch, that error killed `SessionDB` init completely — every SQLite-backed feature (`hermes sessions list`, `hermes insights`, external tools like Scarf reading `state.db`) failed silently while the JSONL fallback kept the primary WhatsApp/CLI chat flow working. Reported by @chillprakash in #13029 with clear repro on macOS ARM64 + Python 3.11.13.
Fix
Init path (`hermes_state.py:343-378`): catch the `OperationalError` when the message matches `no such module / fts5`, log a one-time warning with a remediation hint (switch to Python 3.12/3.13/3.14 with FTS5 built in, or rebuild SQLite with FTS5 enabled), and set `self._fts5_available = False`. Other `OperationalError`s are still re-raised so legitimate schema bugs aren't swallowed.
Search path (`search_messages`): when `_fts5_available` is `False`, skip the `MATCH` branch entirely and route into the existing LIKE fallback that already handles CJK queries. No new fallback code — just extending the existing condition.
Pre-implement audit
Testing
Fixes #13029