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
[Bug] /product/add returns 200 but memory not stored in Neo4j #1355
After calling /product/add with async_mode=sync, the API returns 200 with "Memory added successfully", but the memory is not actually stored in Neo4j. The database remains empty (MATCH (n) RETURN count(n) returns 0).
API returns: {"code": 200, "message": "Memory added successfully", "data": []}
Check Neo4j: MATCH (n) RETURN count(n) returns 0
Root Cause Analysis
The log shows: WARNING - log_add_messages - No add/update items prepared; skipping addMemory/knowledgeBaseUpdate logs. user_id=user1 mem_cube_id=user1 task_id=None missing_ids=[]
The issue is in memos/mem_scheduler/task_schedule_modules/handlers/add_handler.py in the log_add_messages method. It tries to parse msg.content as JSON via json.loads(msg.content), but the resulting userinput_memory_ids list is empty.
The upstream extraction flow appears to fail silently - the LLM (Kimi-K2-Instruct) is called successfully but the extracted memory IDs list ends up empty before reaching the storage step.
Expected Behavior
Memory should be stored in Neo4j and Qdrant after a successful API call.
Additional Context
RabbitMQ is unavailable (DNS resolution fails in Docker Desktop on Windows), but this should not affect sync mode
The LLM call itself succeeds (verified via direct API testing)
The issue appears to be in the scheduler/handler layer between LLM extraction and Neo4j storage
Summary: Fixes #1355: /product/add returned HTTP 200 with "Memory added successfully" but wrote zero nodes to Neo4j / Qdrant when the LLM-extraction fallback path fired.
Root cause: SimpleStructMemReader._get_llm_response in src/memos/mem_reader/simple_struct.py returned a salvage dict whose memory item was keyed by "memory_list" (underscore), while downstream consumers _process_chat_data and _process_transfer_chat_data read resp.get("memory list", []) (single space). The salvaged UserMemory item was silently dropped whenever the LLM output failed strict JSON parsing (very common with Kimi-K2). mem_group ended up empty, text_mem.add([]) did nothing, the scheduler then emitted the "No add/update items prepared" warning the user reported. The typo was introduced by PR #913 (commit d7aaf57) while refactoring the LLM exception path; both sibling readers (multi_modal_struct.py, strategy_struct.py) kept the correct "memory list" spelling, confirming this is a localised regression.
Note: the bug report initially pointed at mem_scheduler.task_schedule_modules.handlers.add_handler.log_add_messages. That handler is downstream of storage and only writes audit-log events — patching it cannot affect Neo4j persistence. The fix is one level upstream, in the mem-reader fallback. The "No add/update items prepared" warning is a symptom, not a cause.
Change: one-character key correction in simple_struct.py plus an inline comment pinning the contract. Two TDD regression tests added in tests/mem_reader/test_simple_structure.py (test_get_llm_response_fallback_key_matches_consumer, test_process_chat_data_fine_yields_node_when_llm_unparseable). Both tests fail on the buggy code and pass after the fix. Verification: 93 passed / 1 skipped across tests/mem_reader/ + tests/mem_scheduler/; ruff lint and format both clean. The 2 pre-existing test_coarse_memory_type.py failures require the optional markitdown extra and are unrelated (confirmed via git stash). No public API or OpenAPI changes; no new dependencies.
Activity
github-actions commentedon Apr 25, 2026
This issue has been automatically marked as stale due to inactivity.
MaiHHConnect commentedon Apr 26, 2026
Memtensor-AI commentedon Jun 30, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
6ff53eaf01566b96Working branch:
bugfix/autodev-1355Target 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(mem_reader): use "memory list" key in LLM-unparseable fallback (#…
Memtensor-AI commentedon Jun 30, 2026
✅ AutoDev task
6ff53eaf01566b96completed.Summary: Fixes #1355: /product/add returned HTTP 200 with "Memory added successfully" but wrote zero nodes to Neo4j / Qdrant when the LLM-extraction fallback path fired.
Root cause:
SimpleStructMemReader._get_llm_responseinsrc/memos/mem_reader/simple_struct.pyreturned a salvage dict whose memory item was keyed by"memory_list"(underscore), while downstream consumers_process_chat_dataand_process_transfer_chat_datareadresp.get("memory list", [])(single space). The salvagedUserMemoryitem was silently dropped whenever the LLM output failed strict JSON parsing (very common with Kimi-K2).mem_groupended up empty,text_mem.add([])did nothing, the scheduler then emitted the "No add/update items prepared" warning the user reported. The typo was introduced by PR #913 (commit d7aaf57) while refactoring the LLM exception path; both sibling readers (multi_modal_struct.py,strategy_struct.py) kept the correct"memory list"spelling, confirming this is a localised regression.Note: the bug report initially pointed at
mem_scheduler.task_schedule_modules.handlers.add_handler.log_add_messages. That handler is downstream of storage and only writes audit-log events — patching it cannot affect Neo4j persistence. The fix is one level upstream, in the mem-reader fallback. The "No add/update items prepared" warning is a symptom, not a cause.Change: one-character key correction in
simple_struct.pyplus an inline comment pinning the contract. Two TDD regression tests added intests/mem_reader/test_simple_structure.py(test_get_llm_response_fallback_key_matches_consumer,test_process_chat_data_fine_yields_node_when_llm_unparseable). Both tests fail on the buggy code and pass after the fix. Verification: 93 passed / 1 skipped acrosstests/mem_reader/+tests/mem_scheduler/; ruff lint and format both clean. The 2 pre-existingtest_coarse_memory_type.pyfailures require the optionalmarkitdownextra and are unrelated (confirmed viagit stash). No public API or OpenAPI changes; no new dependencies.Base branch:
mainBranch:
bugfix/autodev-1355Commit:
034c621PR: #1977
Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
Fix #1355: [Bug] /product/add returns 200 but memory not stored in Ne…
fix: repair trailing comma in malformed extraction JSON (MemTensor#2456)