fix(memory): skip working-memory cleanup during reorganize pass - #2193
fix(memory): skip working-memory cleanup during reorganize pass#2193RerankerGuo wants to merge 1 commit into
Conversation
🤖 Open Code ReviewTarget: PR #2193 ✅ OpenCodeReview: No comments generated. Looks good to me. Generated by cloud-assistant via Open Code Review. |
✅ Automated Test Results: PASSEDAll tests passed (10/10 executed). memos_python_core/changed-repo-python: 10/10. Duration: 5s [advisory, non-gating] AI-generated tests on branch test/auto-gen-959e5b5df4cda358-20260803121326: 65/65 passed — these do NOT affect the PR verdict; review the branch manually. Branch: |
MemoryManager.add(mode='sync') previously always invoked _cleanup_working_memory which prunes the oldest WorkingMemory nodes to stay within the configured cap. During a reorganize pass the working pool is being rebuilt from long-term material, so that cleanup would silently drop freshly reconstructed nodes. Guard the cleanup call with the existing is_reorganize flag so reorganize preserves the rebuilt working-memory population while non-reorganize mode keeps the original eviction behaviour. Closes MemTensor#1952.
777a499 to
668d61e
Compare
|
Addressed the automated review finding in |
✅ Automated Test Results: PASSEDAll tests passed (10/10 executed). memos_python_core/changed-repo-python: 10/10. Duration: 5s [advisory, non-gating] AI-generated tests on branch test/auto-gen-6e65348cb7a4aac1-20260805132025: 78/78 passed — these do NOT affect the PR verdict; review the branch manually. Branch: |
Summary
MemoryManager.add(mode='sync')so_cleanup_working_memoryis skipped when the manager is running inside a reorganize pass (self.is_reorganize=True).remove_oldest_memorywould silently drop freshly rebuilt nodes.Closes #1952.
Verification
ruff formatapplied (no reformat).ruff checkpre-existing warnings only (BLE001/DTZ005on untouched lines).remove_oldest_memoryis not invoked whenis_reorganize=Trueand is invoked in normal mode.Checklist