OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Question]: openviking: auto-capture completed but extract returned 0 memories and openviking: agent memories search failed: Error: OpenViking request failed [INTERNAL]: Access denied for viking://agent/0f4f36742ab1/memories

Open SpiderJack0516 opened this issue 8 months ago • 4 comments

Your Question

I execute openclaw-eval local, it keeps appearing “ openviking: auto-capture completed but extract returned 0 memories. Check OpenViking server logs for embedding/extract errors.” and “ openviking: agent memories search failed: Error: OpenViking request failed [INTERNAL]: Access denied for viking://agent/0f4f36742ab1/memories” . Openviking registered context-engine. The detailed log is in txt file.

Image

logs.txt

Context

No response

Code Example (Optional)


Related Area

None

Before Asking

SpiderJack0516 avatar Mar 24 '26 02:03 SpiderJack0516

same

Joeywzr avatar Mar 24 '26 15:03 Joeywzr

@Joeywzr 这样应该会有效。问题原因是把userid给修改为default了。 /Users/miniconda3/envs/openviking/lib/python3.10/site-packages/openviking/server/routers/system.py 需要改第 111 行和第 120 行,一共两处:

第 111 行,把 _ctx 改成 ctx(去掉下划线,表示要使用这个变量):

改前

_ctx: RequestContext = Depends(get_request_context),

改后

ctx: RequestContext = Depends(get_request_context),

第 120 行,把 service.user._user_id 改成 ctx.user.user_id:

改前

"user": service.user._user_id,

改后

"user": ctx.user.user_id,

SpiderJack0516 avatar Mar 25 '26 06:03 SpiderJack0516

同样的问题,查看最新版的代码似乎已经改了,但还是会有这个问题

Stitch-7 avatar Apr 30 '26 09:04 Stitch-7

Confirmed fixed.

Root cause of the Access denied for viking://agent/0f4f36742ab1/memories part was the old OpenClaw plugin namespace routing. Older plugin code derived the agent memory space with a hash-like value such as 0f4f36742ab1 and then searched viking://agent/<hashed-space>/memories. That value did not match the request's effective X-OpenViking-Agent, so server-side access control correctly rejected it.

The fix landed in these PRs:

  • https://github.com/volcengine/OpenViking/pull/1606

    • Main fix. Reworked OpenClaw plugin auth/namespace handling and replaced the old space-discovery/hash routing with canonical namespace expansion.
    • Agent memory aliases now resolve to the effective agent namespace, for example viking://agent/<agent_id>/memories, or viking://agent/<agent_id>/user/<user_id>/memories when agent-scope-by-user isolation is enabled.
  • https://github.com/volcengine/OpenViking/pull/1054

    • Related prerequisite fix. /api/v1/system/status now returns the request context user (ctx.user.user_id) instead of the process default user. This prevents the plugin from resolving the runtime user as default incorrectly.
  • https://github.com/volcengine/OpenViking/pull/1789

    • Follow-up hardening. The plugin no longer synthesizes X-OpenViking-Account / X-OpenViking-User as default/default; tenant headers are sent only when explicitly configured.
  • https://github.com/volcengine/OpenViking/pull/1809

    • Follow-up routing fix. Clarified agent_prefix semantics and made the fallback OpenClaw agent main, avoiding agent id drift.

Current expected behavior:

  • viking://agent/memories from the OpenClaw plugin is normalized to the current effective agent namespace before /api/v1/search/find.
  • Access to another agent namespace still returns permission denied by design.
  • The exact hashed path from this issue, viking://agent/0f4f36742ab1/memories, should no longer be generated by the fixed plugin path.

If anyone still sees this after upgrading, please check that both sides are actually updated:

  1. OpenViking server includes PR #1054 and #1606 or later.
  2. OpenClaw plugin includes PR #1606, #1789, and #1809 or later.
  3. Plugin namespace config matches the server account policy, especially isolateAgentScopeByUser.
  4. Enable plugin routing diagnostics with OPENVIKING_LOG_ROUTING=1 or OPENVIKING_DEBUG=1 and verify X_OpenViking_Agent, resolved_user_id, and target_uri in the logs.

Note: the separate message auto-capture completed but extract returned 0 memories can still happen for model/config reasons, such as embedding or extraction model failures. That is independent from the access-denied routing bug fixed here. If only the 0 memories symptom remains, please open a new issue with the server logs around session commit/extraction.

Closing this as fixed by #1606, with related fixes #1054, #1789, and #1809.

Mijamind719 avatar Jun 01 '26 09:06 Mijamind719