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
Summary: Fixed the add_memory → get_memory 404 race condition in async mode.
Root cause: In async mode, add_memory writes fast-mode LongTermMemory nodes and immediately returns their IDs (IDs_A) to the caller. The scheduler's MemReadMessageHandler._process_memories_with_reader would then call fine_transfer_simple_mem which produces brand-new UUID nodes (IDs_B), write those, and hard-delete IDs_A. Any get_memory(IDs_A) call issued after the scheduler ran would return 404 because the original nodes no longer existed.
Fix applied in src/memos/mem_scheduler/task_schedule_modules/handlers/mem_read_handler.py: when fine_transfer_simple_mem produces exactly one enhanced memory per input item (the common 1:1 case), the enhanced item's .id is overwritten with the original node's ID before writing. Neo4j uses MERGE semantics, so the graph node is updated in-place and the caller's handle remains permanently valid. Reused IDs are then excluded from the subsequent delete list so the freshly-updated node is never destroyed. The existing delete-and-replace behavior is fully preserved for 1:N expansions and zero-output cases.
Tests: 4 new unit tests added in tests/mem_scheduler/test_mem_read_handler_id_stability.py covering the 1:1 reuse path (ID assigned, ID not deleted), the 1:N expansion fallback (old ID still deleted), and the zero-output fallback. All 50 scheduler tests pass. Ruff clean.
Activity
Memtensor-AI commentedon Sep 2, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
c738ad199edc554fWorking branch:
bugfix/autodev-2329-20260902085902328Target branch:
latest dev* branchWorkflow: 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: reuse original memory ID in scheduler 1:1 async refinement to pr…
Memtensor-AI commentedon Sep 2, 2026
✅ AutoDev task
c738ad199edc554fcompleted.Summary: Fixed the add_memory → get_memory 404 race condition in async mode.
Root cause: In async mode,
add_memorywrites fast-mode LongTermMemory nodes and immediately returns their IDs (IDs_A) to the caller. The scheduler'sMemReadMessageHandler._process_memories_with_readerwould then callfine_transfer_simple_memwhich produces brand-new UUID nodes (IDs_B), write those, and hard-delete IDs_A. Anyget_memory(IDs_A)call issued after the scheduler ran would return 404 because the original nodes no longer existed.Fix applied in
src/memos/mem_scheduler/task_schedule_modules/handlers/mem_read_handler.py: whenfine_transfer_simple_memproduces exactly one enhanced memory per input item (the common 1:1 case), the enhanced item's.idis overwritten with the original node's ID before writing. Neo4j usesMERGEsemantics, so the graph node is updated in-place and the caller's handle remains permanently valid. Reused IDs are then excluded from the subsequent delete list so the freshly-updated node is never destroyed. The existing delete-and-replace behavior is fully preserved for 1:N expansions and zero-output cases.Tests: 4 new unit tests added in
tests/mem_scheduler/test_mem_read_handler_id_stability.pycovering the 1:1 reuse path (ID assigned, ID not deleted), the 1:N expansion fallback (old ID still deleted), and the zero-output fallback. All 50 scheduler tests pass. Ruff clean.Base branch:
mainBranch:
bugfix/autodev-2329-20260902085902328Commit:
b36f301PR: #2330
Assigned to: @whipser030
Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
github-actions commentedon Oct 4, 2026
This issue has been automatically marked as stale due to inactivity.
github-actions commentedon Oct 14, 2026
This issue has been automatically closed due to inactivity.