fix(core): add separator to agent_space_name to prevent hash collisions#609
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom Mar 15, 2026
Merged
Conversation
agent_space_name() computed md5(user_id + agent_id) without a separator,
so different (user_id, agent_id) pairs could produce the same hash when
their concatenation matched (e.g. ("alice","bot") vs ("aliceb","ot")).
Add ":" separator between user_id and agent_id in the hash input. The ":"
character is safe because the validation regex [a-zA-Z0-9_-] prevents
either field from containing it.
Fix applied to all three implementations:
- openviking_cli/session/user_id.py (Python SDK)
- bot/vikingbot/openviking_mount/ov_server.py (bot server)
- examples/openclaw-memory-plugin/client.ts (TypeScript example)
Note: This is a breaking change for existing agent spaces. Existing data
directories were named using the old hash and will not be found with the
new hash. A migration script or fallback lookup may be needed.
Fixes volcengine#595
qin-ctx
approved these changes
Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agent_space_name()computedmd5(user_id + agent_id)without a separator, allowing different(user_id, agent_id)pairs to collide when their concatenation matched. For example,("alice", "bot")and("aliceb", "ot")both producemd5("alicebot"), mapping to the same agent space.This adds
:as a separator in the hash input across all three implementations (Python SDK, bot server, TypeScript example).Why this matters
Changes
openviking_cli/session/user_id.py:md5(user_id + agent_id)->md5(f"{user_id}:{agent_id}")bot/vikingbot/openviking_mount/ov_server.py: same fixexamples/openclaw-memory-plugin/client.ts: same fix (two occurrences)tests/cli/test_user_identifier.py: new test covering collision scenario, hash stability, swapped IDs, and formatThe
:separator is safe because the validation regex[a-zA-Z0-9_-]prevents either field from containing it.Breaking Change
This changes the hash output for all existing agent spaces. Data stored under the old hash will not be found with the new hash. Options for migration:
Testing
tests/cli/test_user_identifier.pyverifies:(user_id, agent_id)pairs produce different hashesruff format --checkandruff checkpass on all changed filesFixes #595
This contribution was developed with AI assistance (Claude Code).