feat(openviking): add full recall prefetch policy - #48927
Closed
ehz0ah wants to merge 5 commits into
Closed
Conversation
ehz0ah
marked this pull request as ready for review
June 19, 2026 08:28
ehz0ah
force-pushed
the
fix/openviking-session-aware-prefetch
branch
from
June 19, 2026 08:54
2069e80 to
6c4d091
Compare
ehz0ah
marked this pull request as draft
June 22, 2026 02:26
Use OpenViking's session-aware search endpoint for background prefetch when a session id is available, with fallback to non-session find if the session-aware request fails. Include skill hits in prefetch output and recover bounded snippets for empty-abstract hits through content/read while keeping the result size capped.
(cherry picked from commit 764fb28)
ehz0ah
force-pushed
the
fix/openviking-session-aware-prefetch
branch
from
June 23, 2026 07:23
05f4d1e to
c982d94
Compare
ehz0ah
marked this pull request as ready for review
June 23, 2026 08:26
Collaborator
|
Merged via #51898. Your full consolidation of the OpenViking recall work was salvaged onto current main with authorship preserved. Salvage follow-up fixes: (1) re-exposed the 8 recall config knobs in get_config_schema() which had been removed, (2) lowered default timeout 8s→4s and full_read_limit 3→2 to reduce per-turn blocking latency. Thanks for the thorough work. |
kshitijk4poor
added a commit
that referenced
this pull request
Jun 24, 2026
Salvage of PR #48927 by @ehz0ah, which consolidates OpenViking recall work from #41706 (@huangxun375-stack), #33260, #49975, and #32444. Replaces stale background post-turn prefetch warming with synchronous current-query recall. The old queue_prefetch warmed the PREVIOUS user message while turn-start recall consumed the CURRENT one, so injected context was always about the wrong topic. Changes: - prefetch() now does session-aware /api/v1/search/search with the current query, falls back to /api/v1/search/find on failure - Contract-safe payloads: limit, score_threshold, context_type, session_id — no top_k, no search-body mode, no target_uri - L2 content reads for items with level=2 or empty abstracts, capped at full_read_limit (default 2) - Local ranking (score + query-token overlap + leaf boost), dedup, score threshold, and injected-char budget - queue_prefetch() is now a no-op (background warming removed) - Additive batched viking_read: uris param accepts up to 3 URIs - Per-request timeout support on _VikingClient.get/post/delete - Removes stale _prefetch_result/_prefetch_thread/_prefetch_generation state and _invalidate_prefetch_state() - Strengthened system_prompt_block guidance Salvage follow-up fixes: - Expose all 8 recall config knobs in get_config_schema() (PR #48927 had removed them; #41706 correctly exposed them). Env vars remain as internal mechanism but are now visible in setup wizard. - Lower default timeout 8s→4s, request_timeout 6s→3s, full_read_limit 3→2 to reduce per-turn blocking latency. Co-authored-by: Hao Zhe <haozhe4547@gmail.com> Co-authored-by: Eurekaxun <eurekaxun@163.com>
kshitijk4poor
added a commit
that referenced
this pull request
Jun 24, 2026
…l-48927 feat(openviking): add full recall prefetch policy (salvage #48927)
pai-scaffolde
pushed a commit
to pai-scaffolde/hermes-agent
that referenced
this pull request
Jun 28, 2026
Salvage of PR NousResearch#48927 by @ehz0ah, which consolidates OpenViking recall work from NousResearch#41706 (@huangxun375-stack), NousResearch#33260, NousResearch#49975, and NousResearch#32444. Replaces stale background post-turn prefetch warming with synchronous current-query recall. The old queue_prefetch warmed the PREVIOUS user message while turn-start recall consumed the CURRENT one, so injected context was always about the wrong topic. Changes: - prefetch() now does session-aware /api/v1/search/search with the current query, falls back to /api/v1/search/find on failure - Contract-safe payloads: limit, score_threshold, context_type, session_id — no top_k, no search-body mode, no target_uri - L2 content reads for items with level=2 or empty abstracts, capped at full_read_limit (default 2) - Local ranking (score + query-token overlap + leaf boost), dedup, score threshold, and injected-char budget - queue_prefetch() is now a no-op (background warming removed) - Additive batched viking_read: uris param accepts up to 3 URIs - Per-request timeout support on _VikingClient.get/post/delete - Removes stale _prefetch_result/_prefetch_thread/_prefetch_generation state and _invalidate_prefetch_state() - Strengthened system_prompt_block guidance Salvage follow-up fixes: - Expose all 8 recall config knobs in get_config_schema() (PR NousResearch#48927 had removed them; NousResearch#41706 correctly exposed them). Env vars remain as internal mechanism but are now visible in setup wizard. - Lower default timeout 8s→4s, request_timeout 6s→3s, full_read_limit 3→2 to reduce per-turn blocking latency. Co-authored-by: Hao Zhe <haozhe4547@gmail.com> Co-authored-by: Eurekaxun <eurekaxun@163.com>
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
Salvage of PR NousResearch#48927 by @ehz0ah, which consolidates OpenViking recall work from NousResearch#41706 (@huangxun375-stack), NousResearch#33260, NousResearch#49975, and NousResearch#32444. Replaces stale background post-turn prefetch warming with synchronous current-query recall. The old queue_prefetch warmed the PREVIOUS user message while turn-start recall consumed the CURRENT one, so injected context was always about the wrong topic. Changes: - prefetch() now does session-aware /api/v1/search/search with the current query, falls back to /api/v1/search/find on failure - Contract-safe payloads: limit, score_threshold, context_type, session_id — no top_k, no search-body mode, no target_uri - L2 content reads for items with level=2 or empty abstracts, capped at full_read_limit (default 2) - Local ranking (score + query-token overlap + leaf boost), dedup, score threshold, and injected-char budget - queue_prefetch() is now a no-op (background warming removed) - Additive batched viking_read: uris param accepts up to 3 URIs - Per-request timeout support on _VikingClient.get/post/delete - Removes stale _prefetch_result/_prefetch_thread/_prefetch_generation state and _invalidate_prefetch_state() - Strengthened system_prompt_block guidance Salvage follow-up fixes: - Expose all 8 recall config knobs in get_config_schema() (PR NousResearch#48927 had removed them; NousResearch#41706 correctly exposed them). Env vars remain as internal mechanism but are now visible in setup wizard. - Lower default timeout 8s→4s, request_timeout 6s→3s, full_read_limit 3→2 to reduce per-turn blocking latency. Co-authored-by: Hao Zhe <haozhe4547@gmail.com> Co-authored-by: Eurekaxun <eurekaxun@163.com>
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…viking-recall-48927 feat(openviking): add full recall prefetch policy (salvage NousResearch#48927)
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
Salvage of PR NousResearch#48927 by @ehz0ah, which consolidates OpenViking recall work from NousResearch#41706 (@huangxun375-stack), NousResearch#33260, NousResearch#49975, and NousResearch#32444. Replaces stale background post-turn prefetch warming with synchronous current-query recall. The old queue_prefetch warmed the PREVIOUS user message while turn-start recall consumed the CURRENT one, so injected context was always about the wrong topic. Changes: - prefetch() now does session-aware /api/v1/search/search with the current query, falls back to /api/v1/search/find on failure - Contract-safe payloads: limit, score_threshold, context_type, session_id — no top_k, no search-body mode, no target_uri - L2 content reads for items with level=2 or empty abstracts, capped at full_read_limit (default 2) - Local ranking (score + query-token overlap + leaf boost), dedup, score threshold, and injected-char budget - queue_prefetch() is now a no-op (background warming removed) - Additive batched viking_read: uris param accepts up to 3 URIs - Per-request timeout support on _VikingClient.get/post/delete - Removes stale _prefetch_result/_prefetch_thread/_prefetch_generation state and _invalidate_prefetch_state() - Strengthened system_prompt_block guidance Salvage follow-up fixes: - Expose all 8 recall config knobs in get_config_schema() (PR NousResearch#48927 had removed them; NousResearch#41706 correctly exposed them). Env vars remain as internal mechanism but are now visible in setup wizard. - Lower default timeout 8s→4s, request_timeout 6s→3s, full_read_limit 3→2 to reduce per-turn blocking latency. Co-authored-by: Hao Zhe <haozhe4547@gmail.com> Co-authored-by: Eurekaxun <eurekaxun@163.com>
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
…viking-recall-48927 feat(openviking): add full recall prefetch policy (salvage NousResearch#48927)
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
Salvage of PR NousResearch#48927 by @ehz0ah, which consolidates OpenViking recall work from NousResearch#41706 (@huangxun375-stack), NousResearch#33260, NousResearch#49975, and NousResearch#32444. Replaces stale background post-turn prefetch warming with synchronous current-query recall. The old queue_prefetch warmed the PREVIOUS user message while turn-start recall consumed the CURRENT one, so injected context was always about the wrong topic. Changes: - prefetch() now does session-aware /api/v1/search/search with the current query, falls back to /api/v1/search/find on failure - Contract-safe payloads: limit, score_threshold, context_type, session_id — no top_k, no search-body mode, no target_uri - L2 content reads for items with level=2 or empty abstracts, capped at full_read_limit (default 2) - Local ranking (score + query-token overlap + leaf boost), dedup, score threshold, and injected-char budget - queue_prefetch() is now a no-op (background warming removed) - Additive batched viking_read: uris param accepts up to 3 URIs - Per-request timeout support on _VikingClient.get/post/delete - Removes stale _prefetch_result/_prefetch_thread/_prefetch_generation state and _invalidate_prefetch_state() - Strengthened system_prompt_block guidance Salvage follow-up fixes: - Expose all 8 recall config knobs in get_config_schema() (PR NousResearch#48927 had removed them; NousResearch#41706 correctly exposed them). Env vars remain as internal mechanism but are now visible in setup wizard. - Lower default timeout 8s→4s, request_timeout 6s→3s, full_read_limit 3→2 to reduce per-turn blocking latency. Co-authored-by: Hao Zhe <haozhe4547@gmail.com> Co-authored-by: Eurekaxun <eurekaxun@163.com>
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…viking-recall-48927 feat(openviking): add full recall prefetch policy (salvage NousResearch#48927)
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
Salvage of PR NousResearch#48927 by @ehz0ah, which consolidates OpenViking recall work from NousResearch#41706 (@huangxun375-stack), NousResearch#33260, NousResearch#49975, and NousResearch#32444. Replaces stale background post-turn prefetch warming with synchronous current-query recall. The old queue_prefetch warmed the PREVIOUS user message while turn-start recall consumed the CURRENT one, so injected context was always about the wrong topic. Changes: - prefetch() now does session-aware /api/v1/search/search with the current query, falls back to /api/v1/search/find on failure - Contract-safe payloads: limit, score_threshold, context_type, session_id — no top_k, no search-body mode, no target_uri - L2 content reads for items with level=2 or empty abstracts, capped at full_read_limit (default 2) - Local ranking (score + query-token overlap + leaf boost), dedup, score threshold, and injected-char budget - queue_prefetch() is now a no-op (background warming removed) - Additive batched viking_read: uris param accepts up to 3 URIs - Per-request timeout support on _VikingClient.get/post/delete - Removes stale _prefetch_result/_prefetch_thread/_prefetch_generation state and _invalidate_prefetch_state() - Strengthened system_prompt_block guidance Salvage follow-up fixes: - Expose all 8 recall config knobs in get_config_schema() (PR NousResearch#48927 had removed them; NousResearch#41706 correctly exposed them). Env vars remain as internal mechanism but are now visible in setup wizard. - Lower default timeout 8s→4s, request_timeout 6s→3s, full_read_limit 3→2 to reduce per-turn blocking latency. Co-authored-by: Hao Zhe <haozhe4547@gmail.com> Co-authored-by: Eurekaxun <eurekaxun@163.com>
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…viking-recall-48927 feat(openviking): add full recall prefetch policy (salvage NousResearch#48927)
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
Salvage of PR NousResearch#48927 by @ehz0ah, which consolidates OpenViking recall work from NousResearch#41706 (@huangxun375-stack), NousResearch#33260, NousResearch#49975, and NousResearch#32444. Replaces stale background post-turn prefetch warming with synchronous current-query recall. The old queue_prefetch warmed the PREVIOUS user message while turn-start recall consumed the CURRENT one, so injected context was always about the wrong topic. Changes: - prefetch() now does session-aware /api/v1/search/search with the current query, falls back to /api/v1/search/find on failure - Contract-safe payloads: limit, score_threshold, context_type, session_id — no top_k, no search-body mode, no target_uri - L2 content reads for items with level=2 or empty abstracts, capped at full_read_limit (default 2) - Local ranking (score + query-token overlap + leaf boost), dedup, score threshold, and injected-char budget - queue_prefetch() is now a no-op (background warming removed) - Additive batched viking_read: uris param accepts up to 3 URIs - Per-request timeout support on _VikingClient.get/post/delete - Removes stale _prefetch_result/_prefetch_thread/_prefetch_generation state and _invalidate_prefetch_state() - Strengthened system_prompt_block guidance Salvage follow-up fixes: - Expose all 8 recall config knobs in get_config_schema() (PR NousResearch#48927 had removed them; NousResearch#41706 correctly exposed them). Env vars remain as internal mechanism but are now visible in setup wizard. - Lower default timeout 8s→4s, request_timeout 6s→3s, full_read_limit 3→2 to reduce per-turn blocking latency. Co-authored-by: Hao Zhe <haozhe4547@gmail.com> Co-authored-by: Eurekaxun <eurekaxun@163.com>
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…viking-recall-48927 feat(openviking): add full recall prefetch policy (salvage NousResearch#48927)
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.
What does this PR do?
This PR consolidates the OpenViking session-prefetch work with the useful parts of PR #41706, while updating the implementation to match the current OpenViking server contract.
The main change is that Hermes now uses fuller OpenViking automatic recall without sending stale OpenViking payloads. Recall uses session-aware
/api/v1/search/searchwhen a session id is available, falls back to/api/v1/search/findfor non-session search failures, filters withcontext_type, and keeps local ranking, deduplication, L2 reads, and injected context size bounded.This PR intentionally removes OpenViking's post-turn background prefetch warming. The old queue warmed the previous user message, while turn-start recall consumes the current user message. OpenViking recall is now a single current-query path with a bounded synchronous budget.
It does not send legacy
top_k, does not forward toolmodeinto search bodies, and does not use the invalidviking://agent/memoriestarget.The cherry-picked PR #41706 commit was preserved with original authorship:
c982d947f feat(openviking): add full recall prefetch policy764fb28dc4e5863792a7cda22e2570b24691cc83.Open PRs Superseded
After this PR merges, these still-open OpenViking-related PRs can be closed as superseded by this branch:
/api/v1/content/readenrichment in current-query recall.limitpayload; covered here with contract-safelimit, notop_k, session-aware search, and bounded reads/timeouts.Related Issue
N/A
Type of Change
Changes Made
plugins/memory/openviking/__init__.pyquery,limit,score_threshold,context_type, and optionalsession_id.top_k, search-bodymode, andviking://agent/memories.context_type="memory"by default; advanced env config can opt into resources withOPENVIKING_RECALL_RESOURCES.queue_prefetch()work because the old queue/prefetch query keys did not line up across turns.OPENVIKING_RECALL_TIMEOUT_SECONDSdefault8.0OPENVIKING_RECALL_REQUEST_TIMEOUT_SECONDSdefault6.0OPENVIKING_RECALL_FULL_READ_LIMITdefault3viking_readsupport throughuris, capped at three URIs, while preserving single-URI output shape.viking_forgettool.tests/openviking_plugin/test_openviking.pytests/plugins/memory/test_openviking_provider.pytop_k, no search-bodymode, no invalid target URI, L2 reads, empty-summary fallback behavior, no-op OpenVikingqueue_prefetch(), per-request recall timeouts, full-read caps, and budget-exhaustion logging.How to Test
viking_read, and synchronous current-queryprefetch()against the real server.Validation Performed
Latest validation on this branch:
UV_NATIVE_TLS=true uv run python -m py_compile plugins/memory/openviking/__init__.py tests/openviking_plugin/test_openviking.py tests/plugins/memory/test_openviking_provider.pyscripts/run_tests.sh tests/openviking_plugin/test_openviking.py tests/plugins/memory/test_openviking_provider.py -- -o addopts=scripts/run_tests.sh tests/agent/test_memory_provider.py tests/agent/test_memory_async_sync.py tests/agent/test_memory_skill_scaffolding.py tests/agent/test_memory_session_switch.py -- -o addopts=git diff --checkviking://agent/memories._RECALL_TARGET_URIS.top_kmatches are only negative assertions in tests.Earlier live local OpenViking smoke for this PR branch, before the timeout-default-only follow-up, using a local OpenViking checkout as the server source:
/api/v1/system/statusreturnedstatus=ok.viking://user/peers/hermes/memories/events/...URI./api/v1/content/readreturned the expected content.prefetch()returned an OpenViking context block containing the expected smoke marker.Smoke summary:
status_ok=true,read_ok=true,prefetch_ok=true,cleanup_ok=true.Notes
Recall tuning knobs are intentionally not shown in Hermes memory setup. Users who need to tune them can set env/config directly; otherwise the fixed defaults apply.
Sensitive local paths, credentials, and machine-specific config details are intentionally omitted from this PR description.
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/A; behavior covered by provider prompt, PR body, and testscli-config.yaml.exampleif I added/changed config keys — N/A; no new setup config keys exposedCONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/Aviking_readschema updated for additiveurissupportScreenshots / Logs
Relevant command summaries are included in Validation Performed above. No UI screenshots apply.