fix: correct memory_len in log_working_memory_replacement - #2176
fix: correct memory_len in log_working_memory_replacement#2176RerankerGuo wants to merge 1 commit into
Conversation
Closes MemTensor#1790 The log_working_memory_replacement method was passing memory_len=len(memcube_content) to create_event_log, where memcube_content only contains the newly added memories (delta). This caused the scheduler UI to display the count of changes instead of the total size of the output working memory. Change to memory_len=len(new_memory) so the log reports the total number of memories in the working memory after replacement, consistent with how other log entries represent the output size. Test: python3 -m py_compile src/memos/mem_scheduler/general_modules/scheduler_logger.py
5d2b7a0 to
a686bda
Compare
🤖 Open Code ReviewTarget: PR #2176 🔍 OpenCodeReview found 1 issue(s) in this PR. 1.
|
✅ Automated Test Results: PASSEDAll tests passed (2/2 executed). memos_python_core/changed-python-source: 2/2. Duration: 4s [advisory, non-gating] AI-generated tests on branch test/auto-gen-5596263aad127f17-20260730085853: 30/30 passed — these do NOT affect the PR verdict; review the branch manually. Branch: |
Summary
This PR fixes #1790 by correcting the
memory_lenfield logged bylog_working_memory_replacementinsrc/memos/mem_scheduler/general_modules/scheduler_logger.py.Changes
memory_len=len(memcube_content)→memory_len=len(new_memory).memcube_contentonly contained the newly added memories (delta), which caused the scheduler UI to display the count of changes rather than the total working-memory size.len(new_memory)reflects the total number of memories in the working memory after replacement — consistent with how other log entries represent the output size.# TODO: Log output count is incorrectcomment, since the underlying issue is resolved.Example
[A, B, C](3 items)[A, B, D](3 items)memory_len = 1(delta — onlyDwas added)memory_len = 3(total output size)Testing
python3 -m py_compile src/memos/mem_scheduler/general_modules/scheduler_logger.pypassesChecklist
log_working_memory_replacementreports incorrect memory_len (delta instead of total) #1790)