Repository navigation
fix(scheduler): align enhanced_mem_ids with filtered mem_group in mem_read_handler - #2512
Merged
endxxxx merged 2 commits intoOct 24, 2026
Conversation
Collaborator
🤖 Open Code ReviewTarget: PR #2512 ✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). Generated by cloud-assistant via Open Code Review. |
Collaborator
✅ Automated Test Results: PASSEDAll tests passed (3/3 executed). memos_python_core/changed-repo-python: 3/3. Duration: 12s Branch: |
Collaborator
✅ Automated Test Results: PASSEDAll tests passed (3/3 executed). memos_python_core/changed-repo-python: 3/3. Duration: 12s [advisory, non-gating] AI-generated tests on branch test/auto-gen-58f6ca128f657779-20261024222026: 57/57 passed — these do NOT affect the PR verdict; review the branch manually. Branch: |
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.
Description
Fix an ID-to-memory misalignment and truncation bug in
MemReadMessageHandler._process_memories_with_readerwhen constructing legacy playground web log events (addMemory/updateMemory).In
_process_memories_with_reader:mem_groupfilters outRawFileMemoryitems (memory.metadata.memory_type != "RawFileMemory"), andenhanced_mem_ids = text_mem.add(mem_group, user_name=user_name)returns IDs corresponding 1-to-1 withmem_group.enhanced_mem_idswith the unfilteredflattened_memories(zip(enhanced_mem_ids, flattened_memories, strict=False)). WheneverRawFileMemoryitems were present inflattened_memories, they consumed theenhanced_mem_idsbelonging to normal memories, shifted every subsequent ID-to-memory mapping, and caused trailing memories inmem_groupto be silently dropped byzip(..., strict=False).Aligning the
ziptarget withmem_group(zip(enhanced_mem_ids, mem_group, strict=False)) ensures each returneditem_idmaps to the exact memory added totext_mem.Type of change
How Has This Been Tested?
Added unit test
test_playground_legacy_events_align_enhanced_ids_with_filtered_mem_groupintests/mem_scheduler/test_mem_read_handler_fast_cleanup.pycovering a mixed batch[RawFileMemory, LongTermMemory (add), UserMemory (update with merged_from)]and asserting exactref_id,id,memory, andmemory_typealignment in bothaddMemoryandupdateMemoryevents without truncation.Checklist