Skip to content

fix(session-search): read anchored views through the storage interface on Hermes v0.23.3 - #34

Merged
xraysight merged 1 commit into
xraysight:mainfrom
Bjorgz:fix/source-search-storage-interface
Nov 21, 2026
Merged

xraysight merged 1 commit into
xraysight:mainfrom
Bjorgz:fix/source-search-storage-interface

Conversation

@Bjorgz

@Bjorgz Bjorgz commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Problem

On Hermes v0.23.3 a memory search with a source filter returns no results. _source_filtered_session_search calls SessionDB.get_anchored_view. In v0.23.3 hermes_state.SessionDB is a compatibility class without that method, so each hit fails inside the loop, and the loop skips it. The module says that Hermes v0.27.0 removes it.

Change (dashboard/plugin_api.py, +39/−2)

If persistence_assembly imports, the search opens open_persistence_reader(profile_scope().profile_dir) and reads the anchored view with store.messages.read_anchored_view, mapped to the dict shape of the old call. It also hands the store to _session_lineage_root, because v0.23.3's _resolve_to_parent walks the lineage on the store. With the compatibility SessionDB it finds no parent. If the import fails (older Hermes), the old path runs unchanged.

Tests

Hermes 8783054ef6 wrote a small database. I ran plugin v0.7.1, stock and patched, on that file under 8783054ef6, and on a copy that v0.23.3 converted under v0.23.3. I drove the dashboard app through a test client and compared each answer with the answer of the stock file on 8783054ef6.

plugin file Hermes source-filtered calls that differ
stock v0.7.1 v0.23.3 78 of 198
patched v0.7.1 v0.23.3 6 of 198
patched v0.7.1 8783054ef6 0 of 198

78 of the 198 calls return results on 8783054ef6. On v0.23.3 the stock file returns no result for any of them. The 6 calls that still differ with the patch show the known limit below. The 32 calls without a source filter give the same answers in all runs. 8783054ef6 has no persistence_assembly, so its row runs the old path.

On main with the versions of ci.yml (Python 3.12, pytest 9.1.1, pyyaml 6.0.3) the suite gives 102 passed and 2 skipped before the change, and 103 passed and 2 skipped with it. The 2 skipped tests need a Hermes host. This pull request changes tests/test_plugin_api.py in two places:

  • load_plugin_api now sets persistence_assembly to None in sys.modules, as it does for hindsight_embed. Without that line, four source-search tests fail where persistence_assembly is importable, because they fake only hermes_state.
  • One new test covers the new path with a fake store. It fails with the stock plugin_api.py.

Known limit on v0.23.3

A tool_calls cell that holds one JSON object, not a list, comes back as the list of its key names. Hermes v0.23.3 builds each message record with tuple(...) of that cell (persistence/sqlite/conversation/messages.py), so the values are gone before the plugin sees the record. I ran the object shape only. From the code, a JSON string would come back as its characters, and a nonzero number or true would drop the hit. My own databases hold none of these shapes.

Not changed

search_messages and get_session still go through hermes_state. The v0.23.3 compatibility class has both. They need the store when v0.27.0 removes the module; a comment in the code says so.

On both Hermes versions _resolve_to_parent returns the pair (root_id, has_compression_hop), and _session_lineage_root returns that pair unchanged. A result of a source-filtered search then has a null title, and its parent_session_id is a two-item list. The stock file gives the same output on 8783054ef6, and this pull request keeps it. The two tests that fake _resolve_to_parent, the new one included, return a plain id. I can send a separate fix if you want one.

I found and fixed this with an AI coding assistant (Claude). The tests ran on my own machines.

🤖 Generated with Claude Code

…e on Hermes v0.23.3

On Hermes v0.23.3 hermes_state.SessionDB is a compatibility class without
get_anchored_view, so a source-filtered session search drops every hit.
Where persistence_assembly imports, read the anchored view from the store
and hand the store to the lineage lookup. Older Hermes keeps the old path.

Tests: the load helper pins the old path, and one new test covers the new
path with a fake store.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@xraysight xraysight left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that this restores source-filtered session search on Hermes v0.23.3 for both default and named profiles. Unfiltered search and behavior on the older Hermes revision are unchanged. All 105 local tests passed. Thanks for catching and fixing this, @Bjorgz!

@xraysight
xraysight merged commit c5a9f1f into xraysight:main Nov 21, 2026
1 check passed
@xraysight

Copy link
Copy Markdown
Owner

Hi @Bjorgz , thanks again and indeed I would appreciate another PR for the issue with parent id you mentioned if you find some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants