fix(memory): increment retrieval_count on search results in holographic memory (#17899) - #39664
Open
dusterbloom wants to merge 1 commit into
Open
fix(memory): increment retrieval_count on search results in holographic memory (#17899)#39664dusterbloom wants to merge 1 commit into
dusterbloom wants to merge 1 commit into
Conversation
…ic memory (NousResearch#17899) FactRetriever.search() bypassed store.search_facts(), the only place that bumped retrieval_count. The counter was always 0. Fix: increment retrieval_count directly in FactRetriever.search() for returned facts, with silent error handling. Closes NousResearch#17899
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating a real current-main counter defect. FactRetriever.search() still returns results without updating retrieval_count (plugins/memory/holographic/retrieval.py:106-112), while the active provider uses that method for prefetch and fact_store(action='search') (plugins/memory/holographic/__init__.py:206-210, 284-291).
Problems
- This fixes only the keyword-search route.
probe(),related(),reason(), and_score_facts_by_vector()also return fact lists without recording retrievals (plugins/memory/holographic/retrieval.py:189, 258, 336, 479); the provider exposes the structural routes viafact_store(plugins/memory/holographic/__init__.py:293-313). The linked #55729 correctly identifies this broader sibling set. - The added direct write bypasses the shared store lock.
MemoryStoredocuments one shared connection plus one re-entrant lock for serialized access (plugins/memory/holographic/store.py:101-112), and its existing counter update is insidewith self._lock(store.py:245, 280-287).
Suggested changes
- Add a locked store helper for marking returned fact IDs, reuse it from
search_facts(), and invoke it from every retriever path that returns facts. - Add provider-level tests for keyword and structural retrieval paths, including unchanged counts for unreturned facts.
Automated hermes-sweeper review.
|
|
||
| # Increment retrieval_count for returned facts (fixes #17899) | ||
| if results: | ||
| try: |
Contributor
There was a problem hiding this comment.
Please route this through a locked MemoryStore helper rather than writing _conn directly. MemoryStore deliberately shares one SQLite connection and one _lock for serialized access (store.py:101-112); this new write bypasses that contract and duplicates the existing counter SQL in search_facts().
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.
Fixes #17899
FactRetriever.search() bypassed store.search_facts(), the only place that bumped retrieval_count. The counter was always 0.
Fix: Increment retrieval_count directly in FactRetriever.search() for returned facts, with silent error handling.
Tests: 3 tests — increments on search, accumulates across multiple searches, unrelated facts stay at 0.
This was originally part of #23221 — split into focused single-fix PRs for easier review.