fix(openviking): synchronous prefetch with current turn's query - #49889
Closed
wgd753 wants to merge 1 commit into
Closed
fix(openviking): synchronous prefetch with current turn's query#49889wgd753 wants to merge 1 commit into
wgd753 wants to merge 1 commit into
Conversation
prefetch() now performs a synchronous OV search with the current query instead of returning stale background-thread results from the previous turn. This fixes the stale-context problem where automatic memory injection was always about the wrong topic. - Drain stale background cache (discard previous turn's results) - Sync search with current query via POST /api/v1/search/find - Add _PREFETCH_TIMEOUT (1.5s) to prevent blocking the turn loop - Add _PREFETCH_MIN_SCORE (0.35) noise filter queue_prefetch() is unchanged — it still fires background searches at turn-end for pre-warming, but prefetch() no longer consumes its output. Closes: NousResearch#5820
Collaborator
|
Duplicate of #33260 — same fix: making OpenViking |
Contributor
Author
|
Agreed, this is a duplicate of #33260 — same core fix (sync prefetch with current query, score threshold 0.35, drain stale cache). One difference our version has that #33260 doesn't: a |
This was referenced Jul 28, 2026
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.
Problem
The OpenViking memory provider's
prefetch()method returns stale results from a background thread that fired at the end of the previous turn. The current turn'squeryparameter is completely ignored, meaning automatic memory context is always about the wrong topic.First turn gets zero context. Every subsequent turn gets stale context from the previous topic.
Root Cause
plugins/memory/openviking/__init__.py—prefetch()currently ignores its query parameter and returns whatever the background thread cached from the previous turn's topic.Fix
prefetch()now performs a synchronousPOST /api/v1/search/findusing the current turn'squeryparameter — matching Claude Code's plugin behavior._PREFETCH_MIN_SCORE = 0.35, filters noise_PREFETCH_TIMEOUT = 1.5sprevents slow OV from blocking the turn loopqueue_prefetch()is unchanged — it still fires background searches at turn-end for pre-warming, butprefetch()no longer consumes its output.Related