feat(bot):Support user-key OpenViking mode and align memory namespaces#1994
feat(bot):Support user-key OpenViking mode and align memory namespaces#1994yeshion23333 wants to merge 12 commits into
Conversation
# Conflicts: # benchmark/locomo/vikingbot/import_and_eval_one.sh # benchmark/locomo/vikingbot/import_to_ov.py # benchmark/locomo/vikingbot/run_eval.py # bot/vikingbot/agent/memory.py # bot/vikingbot/agent/tools/ov_file.py # bot/vikingbot/openviking_mount/ov_server.py
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
# Conflicts: # bot/vikingbot/agent/memory.py
| @@ -260,14 +263,13 @@ async def execute( | |||
| if not all_results: | |||
| return f"No results found for query: {query}" | |||
There was a problem hiding this comment.
[Bug] (blocking) This branch drops normal SDK object results. search_client.search() commonly returns an object with .memories, but the memory_user_ids path only handles dict and list; object results fall into this else branch, set memories = [], and the tool returns No results found even when OpenViking returned memory matches.
Please reuse _extract_search_items() here or add the same object handling used elsewhere, for example:
elif hasattr(results, "memories"):
memories = getattr(results, "memories", []) or []| uri = f"viking://user/{user_id}/memories/profile.md" | ||
| uri = "viking://user/memories/profile.md" | ||
| if effective_user_id: | ||
| uri = f"viking://user/{effective_user_id}/memories/profile.md" |
There was a problem hiding this comment.
[Bug] (blocking) read_user_profile() bypasses the namespace-policy URI helpers added in this PR. When an account enables isolate_user_scope_by_agent, the profile lives under viking://user/{user}/agent/{agent}/memories/profile.md, but this still reads viking://user/{user}/memories/profile.md. That means profile injection can read the wrong namespace or fail to find the profile under the exact policy this PR is trying to support.
Please build this URI from _memory_target_uri(effective_user_id), e.g. uri = f"{self._memory_target_uri(effective_user_id)}profile.md", so profile reads follow the same namespace policy as memory search.
| ] | ||
|
|
||
| assert ( | ||
| client._skill_memory_uri("planner", "admin") |
There was a problem hiding this comment.
[Suggestion] (non-blocking) This test defines _accounts() with isolate_agent_scope_by_user=True, but never patches it onto client.client.admin_list_accounts and never calls await client._load_namespace_policy(). As written, _skill_memory_uri() is using the default policy, so the test either fails or does not actually prove policy-scoped skill memory behavior.
Please patch admin_list_accounts and load the policy before asserting the URI.
qin-ctx
left a comment
There was a problem hiding this comment.
Review summary:
This PR moves vikingbot toward supporting both root-key and user-key OpenViking modes, and aligns several memory URI paths with account namespace policy. The direction is good, but there are still two blocking behavior issues in the memory read/search paths.
CI is also currently blocked by formatting: ruff format --check reports 6 files that would be reformatted (benchmark/locomo/openclaw/eval.py, benchmark/locomo/vikingbot/import_to_ov.py, benchmark/locomo/vikingbot/run_eval.py, bot/tests/test_openviking_api_key_type.py, bot/vikingbot/agent/tools/ov_file.py, bot/vikingbot/hooks/builtins/openviking_hooks.py). Please run formatting before the next update.
Non-code PR hygiene: the PR has no linked issue, the testing checklist is unchecked, and the commit stack contains repeated eval commits plus merge commits. Please add the testing notes and consider squashing into clearer logical commits before merge.
Description
Related Issue
Type of Change
Changes Made
Testing
Checklist
Screenshots (if applicable)
Additional Notes