fix(summarizer): use correct URI matching for memory context_type during reindex#1155
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom Apr 2, 2026
Conversation
…assification during reindex
The summarizer used uri.startswith("viking://memory/") to detect memory
URIs, but actual memory URIs are viking://user/{space}/memories/... and
viking://agent/{space}/memories/... — the prefix never matched, causing
all memories to be classified as context_type="resource" during reindex.
Replace the broken inline prefix check with a call to the existing
get_context_type_for_uri() from core/directories.py, which correctly
uses substring matching ("/memories" in uri) and handles all URI types
including session URIs.
Fixes volcengine#1060
|
Failed to generate code suggestions for PR |
zhoujh01
approved these changes
Apr 1, 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
uri.startswith("viking://memory/")prefix check insummarizer.pywith a call to the existingget_context_type_for_uri()fromcore/directories.pyviking://user/{space}/memories/...), causing all memories to be misclassified ascontext_type="resource"during reindexcontext_type == "memory"Root Cause
summarizer.py:61checkeduri.startswith("viking://memory/")but actual memory URIs use the patternviking://user/{space}/memories/...orviking://agent/{space}/memories/...— the prefix never matches.The correct logic already existed in
core/directories.py:get_context_type_for_uri()using"/memories" in uri. The fix simply wires it up.Changes
openviking/utils/summarizer.py: Replace 4-line inline check with 1-line call toget_context_type_for_uri(uri)tests/unit/test_summarizer_context_type.py: 9 tests covering all URI types + regression test for the old broken patternTest plan
test_context.pytests pass (no regression)startswith("viking://memory")patterns remain in codebaseFixes #1060