fix(memory): increment retrieval_count in retrieval.search() (#17899) - #17910
Closed
luyao618 wants to merge 1 commit into
Closed
fix(memory): increment retrieval_count in retrieval.search() (#17899)#17910luyao618 wants to merge 1 commit into
luyao618 wants to merge 1 commit into
Conversation
…earch#17899) retrieval.search() — the code path used by both prefetch() and fact_store(action='search') — never incremented the retrieval_count column, making it permanently 0 for every fact. This broke downstream consumers like fact-store-dreaming that rely on usage metrics. Add the UPDATE statement after results are collected, matching what store.search_facts() already does. Wrapped in try/except so a counter failure never blocks a search. Closes NousResearch#17899
luyao618
force-pushed
the
fix/holographic-retrieval-count-never-incremented
branch
from
May 5, 2026 10:40
7bacf06 to
6bcc5be
Compare
Contributor
Author
|
Closing: this PR has been open for 1-2 weeks with no maintainer review and the codebase continues to evolve. Will re-submit if the fix is still relevant. |
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
retrieval.search()— the code path used by bothprefetch()andfact_store(action='search')— never incremented theretrieval_countcolumn in thefactstable. The column stayed at 0 for every fact, breaking downstream consumers likefact-store-dreamingthat rely on usage metrics to identify orphan/stale facts.Root Cause
Two search paths exist:
store.search_facts()(store.py) — correctly incrementsretrieval_count, but nothing calls itretrieval.search()(retrieval.py) — the actual path used everywhere, goes through_fts_candidates()with direct SQL and never increments the counterChanges
plugins/memory/holographic/retrieval.py: AddedUPDATE facts SET retrieval_count = retrieval_count + 1aftersearch()collects results, wrapped in try/except so counter failures never block searchestests/plugins/memory/test_holographic_retrieval_count.py: New test verifyingretrieval_countincrements on eachsearch()callTesting
Closes #17899