Fix #1518: (capture) Internal Review the conversation above prompts stored as user chunks#1879
Open
Memtensor-AI wants to merge 1 commit into
Open
Fix #1518: (capture) Internal Review the conversation above prompts stored as user chunks#1879Memtensor-AI wants to merge 1 commit into
Memtensor-AI wants to merge 1 commit into
Conversation
- System messages (including internal review prompts) were incorrectly stored as LongTermMemory chunks, polluting user's retrievable memory - Modified SystemParser.parse_fast() to return empty list for non-tool-schema system messages - Tool schema handling remains unchanged (stored as ToolSchemaMemory) - Added comprehensive test coverage for system message handling Fixes #1518
Collaborator
Author
✅ Automated Test Results: PASSEDAll tests passed (35/-542 executed, 613 skipped). memos_local_plugin/smoke: 0 passed, 578 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
Successfully fixed bug #1518 where system messages and internal review prompts were incorrectly stored as user memory chunks.
Root Cause
In
src/memos/mem_reader/read_multi_modal/system_parser.py, theparse_fast()method was storing ALL system messages (including internal review prompts and system instructions) asLongTermMemorychunks, polluting the user's retrievable memory with system-level content that should never be stored.Solution Implemented
Modified
SystemParser.parse_fast()to immediately return an empty list for system messages that don't contain tool schemas. This prevents system prompts and internal review messages from being stored as memory chunks while preserving correct tool schema handling.Changes Made
LongTermMemorychunks for system messagesFiles Changed
src/memos/mem_reader/read_multi_modal/system_parser.py- Core fix implementationtests/mem_reader/test_system_parser.py- Comprehensive test coverage (new file)Verification
Impact
ToolSchemaMemoryThe fix is minimal, focused, and follows the project's TDD approach with comprehensive test coverage.
Related Issue (Required): Fixes #1518
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