OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: Memory tool URI examples use a placeholder account (`user123`); the extractor copies it and every read/list fails with "Access denied"

Open za8209 opened this issue 2 months ago • 0 comments

Summary

ReadMemoryTool and ListDirectoryTool in openviking/session/memory/tools.py document their uri parameter with an example that uses a non-existent account name:

  • tools.py:192
    "description": "Memory URI to read, e.g., 'viking://user/user123/memories/profile.md'",
    
  • tools.py:344
    "description": "Directory URI to list, e.g., 'viking://user/user123/memories'",
    

Nothing in the extraction context (session_extract_context_provider.py) tells the model what the real account name is. The extractor therefore copies the example verbatim, and every read / list call against viking://user/user123/... is rejected with PermissionDeniedError. The memory operation is dropped silently — no retry, no user-visible error.

Environment

  • OpenViking v0.4.21 (installed via uv tool, macOS)
  • Server on 127.0.0.1:1933, auth_mode=dev (default)
  • Real account in use: default → viking://user/default/memories/...
  • Extraction model: doubao-seed-2.0-lite
  • Log: ~/.openviking/logs/server.log (112,363 lines, 2026-09-15 → 2026-09-22)

Evidence

Failed to execute read: Access denied appears 20 times (2026-09-17 → 09-19). Below are the 11 that target a viking:// URI — note that 6 of them use the literal user123 from the tool-description example:

2026-09-19 17:36:53.177 | ERROR | openviking.session.memory.tools:execute:257 -
  Failed to execute read: Access denied for viking://user/user123/memories/preferences/default/Rerank配置.md
2026-09-19 ... | ERROR | ... Access denied for viking://user/user123/memories/entities/配置问题/openviking其他已知配置问题.md
2026-09-19 ... | ERROR | ... Access denied for viking://user/user123/memories/entities/软件项目/openviking隔离方案.md
2026-09-19 ... | ERROR | ... Access denied for viking://user/user123/memories/entities/软件项目/openviking.md
2026-09-19 ... | ERROR | ... Access denied for viking://user/user123/memories/entities/ai模型/bge-reranker-v2-m3-gguf.md
2026-09-19 ... | ERROR | ... Access denied for viking://user/user123/memories/cases/微信自动化群发选型.md

Two observations that point at the description text rather than at the model:

  1. Each URI keeps the correct relative path under memories/ (real, existing memory files) and only the account segment is wrong — i.e. the model took the example's account segment and filled in a path it had seen elsewhere in context.
  2. The remaining 5 are a different wrong shape, viking://user/user/claude-code/memories/... (the real shape is viking://user/default/peers/claude-code/memories/...), so the account segment is being guessed rather than resolved.

The rejection is raised at openviking/core/uri_validation.py:105:

if is_accessible(canonical_uri, ctx):
    return canonical_uri
raise PermissionDeniedError(f"Access denied for {canonical_uri}", resource=canonical_uri)

Proposed fix

Either of:

  1. Make the example account-agnostic and state the account separately, e.g. e.g. 'viking://user/<account>/memories/profile.md', plus a line saying the caller's account can be obtained from the context; or
  2. Inject the caller's real account/space into the description at tool-construction time, so the example is always valid for the running ctx.

Why it matters

Every denied call is a memory operation the extractor intended to perform and lost without any retry or user-visible error. In this deployment it compounds an already-elevated extraction parse-failure rate on CJK-heavy long sessions (~198 soft parse failures over 8 days).

Not a duplicate of

  • #4723 / #4722 — those cover the Helper client deriving user URIs from accountId instead of userId. This report is about the server-side memory tool descriptions fed to the extraction model.
  • #3171 / #3172 — peer-isolation blocking in trusted auth mode. Here the failing calls never reach a real account path; the account segment itself is copied from a placeholder.

za8209 avatar Sep 22 '26 10:09 za8209