Fix #1790: fix: log_working_memory_replacement reports incorrect memory_len (delta instea#1882
Open
Memtensor-AI wants to merge 1 commit into
Open
Fix #1790: fix: log_working_memory_replacement reports incorrect memory_len (delta instea#1882Memtensor-AI wants to merge 1 commit into
log_working_memory_replacement reports incorrect memory_len (delta instea#1882Memtensor-AI wants to merge 1 commit into
Conversation
…otal size - Changed memory_len from len(memcube_content) to len(new_memory) - memcube_content contains only delta (added memories) - new_memory contains the complete working memory after replacement - Removed TODO comment at line 169 - Added comprehensive test suite in tests/mem_scheduler/test_scheduler_logger.py Fixes #1790
Collaborator
Author
✅ Automated Test Results: PASSEDAll tests passed (35/35 executed, 36 skipped). memos_local_plugin/smoke: 0 passed, 1 skipped, memos_local_plugin/contract: 35 passed, 35 skipped. Duration: 4s 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
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.
Related Issue (Required): Fixes #1790
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Executor did not report tests.
Checklist
@MatthewZhuang, @CarltonXiang, @syzsunshine219 please review this PR.
Reviewer Checklist
log_working_memory_replacementreports incorrect memory_len (delta instead of total) #1790