You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: log_working_memory_replacement reports incorrect memory_len (delta instead of total) #1790
In src/memos/mem_scheduler/general_modules/scheduler_logger.py, log_working_memory_replacement has a # TODO: Log output count is incorrect comment at line 167.
The method passes memory_len=len(memcube_content) to create_event_log, where memcube_content only contains the newly added memories (delta). This means the scheduler UI shows the count of changes, not the actual size of the output working memory.
Example:
Original working memory: [A, B, C] (3 items)
New working memory: [A, B, D] (3 items)
memcube_content = [D] → memory_len = 1
Correct value: memory_len = 3 (total memories in output)
Expected Behavior
memory_len should reflect the total number of memories in the working memory after replacement (len(new_memory)), consistent with how other log entries represent the output size.
Steps to Reproduce
Trigger a working memory replacement operation via the scheduler and observe the memory_len field in the scheduler log output.
Summary: Fixed incorrect memory_len reporting in log_working_memory_replacement method. The issue was at line 228 in src/memos/mem_scheduler/general_modules/scheduler_logger.py, where memory_len was set to len(memcube_content) (delta count of newly added memories) instead of len(new_memory) (total working memory size after replacement).
Changes made:
Changed line 228 from memory_len=len(memcube_content) to memory_len=len(new_memory)
Removed the TODO comment at line 169 that marked this as a known issue
Added comprehensive test suite in tests/mem_scheduler/test_scheduler_logger.py with three test cases:
test_log_working_memory_replacement_reports_total_memory_len: Verifies the fix by checking that memory_len equals total working memory size (3) not delta (1)
test_log_working_memory_replacement_no_changes: Ensures no log is created when memories are identical
test_log_working_memory_replacement_all_new: Tests the case when all memories are new (empty original)
Root cause: The method computed a delta between original and new working memory, stored it in memcube_content, then incorrectly used len(memcube_content) for the memory_len field. This caused the scheduler UI to display the count of changes rather than the actual working memory size.
Verification: Python syntax check passed. Full pytest requires poetry environment setup which was not available in the execution environment, but the test structure follows existing project patterns and will be validated in CI.
Activity
Memtensor-AI commentedon May 26, 2026
⏸️ AutoDev task
a1ebc4ccf6299d5dneeds manual clarification.Reason: 已修复 #1790:
log_working_memory_replacement现在用len(new_memory)上报输出工作记忆总大小,移除了# TODO注释,并在tests/mem_scheduler/test_scheduler.py新增回归测试。Commit ca61c9a 已推送到分支 autodev/MemOS-1790。是否创建 PR?Memtensor-AI commentedon Jun 4, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
13029e350c6901fcWorking branch:
bugfix/autodev-1790Target branch:
dev-20260604-v2.0.19Workflow: opsp (analysis → coding → testing → PR)
I will post the PR link here once done. If I need more information, I will ask in the comments.
fix: correct memory_len in log_working_memory_replacement to report t…
Memtensor-AI commentedon Jun 4, 2026
✅ AutoDev task
13029e350c6901fccompleted.Summary: Fixed incorrect
memory_lenreporting inlog_working_memory_replacementmethod. The issue was at line 228 insrc/memos/mem_scheduler/general_modules/scheduler_logger.py, wherememory_lenwas set tolen(memcube_content)(delta count of newly added memories) instead oflen(new_memory)(total working memory size after replacement).Changes made:
memory_len=len(memcube_content)tomemory_len=len(new_memory)tests/mem_scheduler/test_scheduler_logger.pywith three test cases:test_log_working_memory_replacement_reports_total_memory_len: Verifies the fix by checking that memory_len equals total working memory size (3) not delta (1)test_log_working_memory_replacement_no_changes: Ensures no log is created when memories are identicaltest_log_working_memory_replacement_all_new: Tests the case when all memories are new (empty original)Root cause: The method computed a delta between original and new working memory, stored it in
memcube_content, then incorrectly usedlen(memcube_content)for the memory_len field. This caused the scheduler UI to display the count of changes rather than the actual working memory size.Verification: Python syntax check passed. Full pytest requires poetry environment setup which was not available in the execution environment, but the test structure follows existing project patterns and will be validated in CI.
Base branch:
dev-20260604-v2.0.19Branch:
bugfix/autodev-1790Commit:
93ba433PR: #1882
Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219
Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219
github-actions commentedon Aug 7, 2026
This issue has been automatically marked as stale due to inactivity.
github-actions commentedon Aug 17, 2026
This issue has been automatically closed due to inactivity.