Repository navigation
fix: support current Hermes state.db and platform-aware paths - #25
Merged
Merged
Conversation
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.
Summary
state.dbfor historical session backfillSessionDB(read_only=True)while preserving explicit legacysession_*.jsonimportsget_messagesAPI supportsinclude_compactedinclude_compacted%LOCALAPPDATA%\hermesfallback on Windows whenhermes_constantsis unavailable--state-dband keep--sessions-diras a mutually exclusive legacy overrideWhy
Current Hermes persists durable session history in
<HERMES_HOME>/state.db. The previous importer only scanned~/.hermes/sessions/session_*.json, and several defaults bypassed Hermes' platform/profile-aware home resolver. As a result, modern session history was not backfilled and Windows default paths incorrectly targeted~\.hermesinstead of%LOCALAPPDATA%\hermes.After this PR's original head was published, Hermes added
get_messages(..., include_compacted=True)inf71f91a39so transcript consumers can include durable rows archived by in-place compaction. Calling the old default shape silently imports only active rows and drops earlier durable turns. The refreshed PR detects that callable capability once per backfill run, opts in when available, and keeps the old call shape for older Hermes versions.request_dump_*.jsonremains intentionally excluded because those files are debug request snapshots, not the durable session transcript contract.Safety and compatibility
state.dbis opened read-only through Hermes' existingSessionDBAPI.TypeErrorraised insideget_messages.--sessions-dirbehavior remains available for legacy exports.Verification
python -m pytest -q -p no:cacheprovider— passed on Python 3.11python3.12 -m pytest -q -p no:cacheprovider— passed on Python 3.12python -m ruff check --select F,I hermes_curator_evolver/backfill.py tests/test_backfill_sessions.py— passedpython -m compileall -q hermes_curator_evolver tests— passedpython -m pip wheel . --no-deps— builthermes_curator_evolver-0.10.0-py3-none-any.whl; a clean temporary venv installed it and rendered thebackfill-sessionsandbootstraphelp pathsa9c783f21995723c812dcb2f8ae58bc6a4323e2f: created a temporarystate.db, archived one turn through in-place compaction, reopened it read-only, and imported both archived + active turns withfiles_failed=007eb1be78566f479fcfa420005401aa623517199imported only 1 active turn from that fixture; refreshed head6c4d5c52d3d07b1b774165566f80504ee0983227imported 2 turns, including the archived turn%LOCALAPPDATA%\hermesfallback remains unit-covered; no live Windows host was used for this refreshCloses #24