Repository navigation
Conversation
Already-serialized memory entries crashed with KeyError when the id key was missing and AttributeError when the id was not a string. Derive the ref_id from the string form when an id exists and skip it otherwise. Fixes MemTensor#2448
🤖 Open Code ReviewTarget: PR #2449 ✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s). Generated by cloud-assistant via Open Code Review. |
✅ Automated Test Results: PASSEDAll tests passed (4/4 executed). memos_python_core/changed-repo-python: 4/4. Duration: 8s [advisory, non-gating] AI-generated tests on branch test/auto-gen-350cec654abe26f4-20261001000641: 44/44 passed — these do NOT affect the PR verdict; review the branch manually. Branch: |
|
This PR has been automatically marked as stale due to inactivity. |
|
Closing this to get my open pull requests in this repository down to a sane number: I had 8 open here at once, which is more than anyone should be asked to review. The branch stays in my fork if it is ever useful - happy to reopen on request. |
Fixes #2448
Summary
prepare_reference_datainsrc/memos/mem_os/utils/reference_utils.pyhandlesTextualMemoryItemobjects and raw dicts, but the dict branch assumes every key exists and thatidis a string:Both escape the streaming pipeline for memory entries that are not
TextualMemoryIteminstances (e.g. already-serialized dicts from a cache or an MCP payload).Fix
Read the id defensively: derive
ref_idfrom the string form when an id exists, skip it otherwise.TextualMemoryItembehavior is unchanged.Regression test
Added
tests/mem_os/test_prepare_reference_data.py:TextualMemoryItemand string-id dict paths as unchangedruff check(repo-pinned 0.11.8) passes on both touched files.AI Disclosure