Skip to content

fix: openviking sync recall + increase API retry limit - #8474

Closed
libinghui123 wants to merge 4 commits into
NousResearch:mainfrom
libinghui123:fix/openviking-sync-recall
Closed

fix: openviking sync recall + increase API retry limit#8474
libinghui123 wants to merge 4 commits into
NousResearch:mainfrom
libinghui123:fix/openviking-sync-recall

Conversation

@libinghui123

@libinghui123 libinghui123 commented Apr 12, 2026

Copy link
Copy Markdown

Summary

Three fixes for the OpenViking memory provider:

  1. prefetch() sync recall: now performs a synchronous search with the current query instead of waiting for the previous turn's background search. Previously memories were always injected one turn late, and the first turn received no memories at all.
  2. viking_remember() immediate commit: now commits the session immediately after storing the message, so memories are indexed and searchable across all sessions right away.
  3. max_retries: increased from 3 to 10 to improve resilience against transient provider errors.

Changes

File Change
plugins/memory/openviking/__init__.py prefetch() sync recall with current query; viking_remember() commits immediately
run_agent.py max_retries increased from 3 to 10
tests/plugins/memory/test_openviking_provider.py 11 unit tests

Test Results

  • tests/plugins/memory/test_openviking_provider.py: 11/11 passed
  • tests/agent/test_memory_provider.py: 54/54 passed (no regression)

How to Test

  1. prefetch fix: Store a fact in OpenViking in session A, then ask the same question in session B. Verify it is recalled on the first turn.
  2. viking_remember fix: Call viking_remember content="My favorite color is blue". Immediately switch to another channel (new session) and ask "What is my favorite color?". Verify it recalls correctly.
  3. max_retries fix: Trigger a transient API error and verify it is retried up to 10 times.

Platforms Tested

  • Linux

Note

Ensure OPENVIKING_ENDPOINT and related env vars are set in ~/.hermes/.env (or the active dotenv) and that no_proxy includes the internal endpoint address to bypass corporate proxies.

🤖 Generated with Claude Code

- openviking: prefetch() now does a synchronous search with the current
  query instead of waiting for the previous turn's background search.
  Previously memories were always injected one turn late, and the first
  turn received no memories at all.
- openviking: retain background prefetch as fallback if sync search fails.
- run_agent: increase max_retries from 3 to 10 to improve resilience
  against transient provider errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@libinghui123
libinghui123 force-pushed the fix/openviking-sync-recall branch from d1a83b5 to c73f774 Compare April 12, 2026 15:49
李冰辉 and others added 3 commits April 12, 2026 23:54
Add unit tests covering:
- prefetch() performs sync search with current query
- prefetch() uses current query, not stale cached background results
- prefetch() returns empty on empty query / missing client
- prefetch() falls back to cache on sync failure
- queue_prefetch() starts background thread
- sync_turn() increments turn count
- on_session_end() commits session

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…n recall

Before: viking_remember() only added a message to the current session.
The memory was only extracted and made searchable after the session ended
or commitTokenThreshold was reached — meaning memories stored via
viking_remember were NOT searchable in other channels/sessions.

After: viking_remember() commits the session immediately after storing
the message, so the memory is indexed and searchable across all sessions
right away.

Also updates the tool description to accurately reflect immediate indexing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- openviking: prefetch() now does a synchronous search with the current
  query instead of waiting for the previous turn's background search.
  Previously memories were always injected one turn late, and the first
  turn received no memories at all.
- openviking: retain background prefetch as fallback if sync search fails.
- openviking: viking_remember() now commits the session immediately so
  the memory is indexed and searchable across all sessions right away.
- run_agent: increase max_retries from 3 to 10 to improve resilience
  against transient provider errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@ZaynJarvis ZaynJarvis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review: Sync Recall + Retry Fixes

Verdict: Request Changes — please split into two PRs

This PR bundles two independent concerns: (1) sync recall implementation and (2) reliability fixes (max_retries, trust_env). The reliability fixes are good and mergeable today; the sync recall approach conflicts with #5838.

Blocking Issues

1. Sync recall in prefetch() conflicts with #5838's architecture

This PR implements sync recall by modifying prefetch() to do a synchronous search inline, overriding the background prefetch result. #5838 implements the same feature at the manager layer with a config gate, which is architecturally cleaner (the manager decides recall strategy, providers stay stateless). The two approaches conflict on both plugins/memory/openviking/__init__.py and run_agent.py. Since #5838 is the recommended merge, please extract the sync recall changes from this PR.

2. max_retries=10 changes the run loop retry count, not the HTTP retry count

The max_retries = 10 change is in the conversation loop's retry-on-API-error block — this is a good resilience improvement but should be in a separate PR so it doesn't get blocked by the sync recall conflict.

Cherry-Pick Candidates (extract into separate PR)

These two changes are clean, independent, and ready to merge:

# 1. In _VikingClient.__init__ — bypass corporate proxies for local endpoints
httpx_module = self._httpx
self._httpx = httpx_module.Client(trust_env=False)

# 2. In run_conversation() — increase API retry limit
max_retries = 10  # was 3

Note on trust_env=False: This creates an httpx.Client instance stored as self._httpx. Since _VikingClient.get() calls self._httpx.get(), this correctly routes through the client's connection pool. However, the health() method also uses self._httpx.get() — verify that the timeout kwarg passes through cleanly on an httpx Client instance (it does, but worth a test).

What Is Good

  • 206-line test suite is thorough and the FakeHttpx fixture pattern (supporting both module-call and Client-call semantics) is well-designed. Please port the non-sync-recall tests into the cherry-pick PR.
  • Immediate commit after viking_remember is an interesting feature — but it belongs in a dedicated PR after the base session lifecycle is settled.

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