-
Notifications
You must be signed in to change notification settings - Fork 330
Description
Bug Description
Search API (/api/v1/search/search and /api/v1/search/find) returns empty results when target_uri is "viking://" or any URI without explicit space segment (e.g. "viking://user/memories/"). This affects all requests running as ROOT role, including dev mode (no root_api_key configured).
Root Cause (updated)
After deeper investigation, the primary root cause is in openviking/retrieve/hierarchical_retriever.py, _get_root_uris_for_type() (line 437):
if not ctx or ctx.role == Role.ROOT:
return []When the role is ROOT (which includes all dev mode requests), this method returns an empty list. The recursive search then has no valid starting points and returns 0 results.
A secondary issue exists in openviking/storage/viking_vector_index_backend.py, _build_scope_filter() (line 479-482): In("uri", [target_dir]) performs exact match on target_directories, so "viking://" never matches any stored URI. URIs without explicit space segments (e.g. "viking://user/memories/") also fail because stored URIs include the space (e.g. "viking://user/default/memories/...").
Who is affected
- All dev mode users (no
root_api_keyconfigured, localhost binding) — this is the default setup recommended byexamples/openclaw-memory-plugin - All ROOT role API requests (even with
root_api_key, using the root key directly) - Non-ROOT roles (ADMIN/USER) are not affected because
_get_root_uris_for_typereturns correct space-qualified URIs for them
Impact
- The official OpenClaw memory plugin (
examples/openclaw-memory-plugin) defaults totargetUri: "viking://"and runs in dev mode, making auto-recall completely non-functional out of the box - Memory writes succeed, but recall silently returns 0 results — no errors in logs
- The
ov findCLI command also returns empty results in dev mode
Environment
- OpenViking version: v0.2.1 (also confirmed on main branch)
- Mode: Dev mode (no
root_api_key, localhost binding) - Role: ROOT (default for dev mode)
Steps to Reproduce
- Deploy OpenViking v0.2.1 in dev mode (no
root_api_key) - Store memories via session API (create session → add messages → extract)
- Search with
target_uri: "viking://"→ returns empty - Search with
target_uri: "viking://user/default/memories/"→ returns results
Suggested Fix
-
In
hierarchical_retriever.py: Remove the ROOT early-return in_get_root_uris_for_type()so ROOT users also get space-qualified root URIs as starting points for recursive search. -
In
viking_vector_index_backend.py: Whentarget_uriis root"viking://", skip the URI filter. For URIs missing space segments, expand them using the current user context (e.g."viking://user/memories/"→"viking://user/{user_space}/memories/").
Workaround
Add filter: {"account_id": "default"} to search request body. This bypasses the scope filter and returns correct results.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status