fix: state_sync.py -- correct class name, constructor type, title API, connection leak#95
Merged
nesquena-hermes merged 1 commit intomasterfrom Apr 5, 2026
Merged
Conversation
…str, use set_session_title(), close() after each call Three bugs found during review: 1. Class is SessionDB not HermesState -- would silently no-op on every install 2. SessionDB.__init__ takes Path not str -- would crash with AttributeError 3. _execute_write() takes a callable not SQL+params -- wrong signature. Replaced with public set_session_title() API. 4. Each call opened a persistent SQLite connection and never closed it. Added try/finally db.close() to prevent WAL leak under sustained load.
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.
Fix three bugs in api/state_sync.py found during code review of PR #93.
The original state_sync.py referenced the wrong class name, passed the wrong type to the constructor, used a private method with the wrong call signature, and leaked SQLite connections. None of these surfaced in tests because the try/except blocks catch silently -- the feature would have been a complete no-op on every real install.
Changes:
from hermes_state import SessionDB(wasHermesState-- class does not exist)SessionDB(db_path)(wasstr(db_path)-- SessionDB.init takes Path, not str)db.set_session_title(session_id, title)(wasdb._execute_write(sql, params)-- wrong signature and private method)try/finally db.close()in both sync functions to prevent WAL connection leak424 tests pass.