mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-07 15:32:21 +02:00
fix(memory): reject blank memory_id on edit and delete (#6342)
In src/ai_interaction.py, when parsing text-format edit or delete actions, an empty line 2 caused memory_id to resolve to empty string. Because startswith("") is always True, the first stored memory was inadvertently edited or deleted.
This change validates that memory_id is non-empty before searching the memory list, restoring parity with the MCP memory tool.
Fixes #6342.
This commit is contained in:
@@ -420,6 +420,8 @@ async def do_manage_memory(content: str, session_id: Optional[str] = None, owner
|
||||
return {"error": "Edit needs line 2: memory_id, line 3: new text"}
|
||||
memory_id = lines[1].strip()
|
||||
new_text = lines[2].strip()
|
||||
if not memory_id:
|
||||
return {"error": "Edit needs line 2: memory_id"}
|
||||
if not new_text:
|
||||
return {"error": "New text cannot be empty"}
|
||||
|
||||
@@ -453,6 +455,8 @@ async def do_manage_memory(content: str, session_id: Optional[str] = None, owner
|
||||
if len(lines) < 2:
|
||||
return {"error": "Delete needs line 2: memory_id"}
|
||||
memory_id = lines[1].strip()
|
||||
if not memory_id:
|
||||
return {"error": "Delete needs line 2: memory_id"}
|
||||
|
||||
memories = _memory_manager.load_all()
|
||||
original_len = len(memories)
|
||||
|
||||
Reference in New Issue
Block a user