[memory] Duplicated entry validation logic in _validate_entries() and save() #759
Labels
No labels
area:chat
area:core
area:llm
area:routes
area:tools
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sleepy/odysseus#759
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
"File:
services/memory/memory.py_validate_entries()(line 142) andsave()(line 184) both do the same field-defaulting logic:python if "id" not in entry: entry["id"] = str(uuid.uuid4()) if "timestamp" not in entry: entry["timestamp"] = int(time.time()) if "source" not in entry: entry["source"] = "..." if "category" not in entry: entry["category"] = "fact"This validation runs on everyload_all()AND everysave(). For a list of N entries, that's 2N validation passes per write cycle. Thesave()path should trust that_validate_entriesalready ran during load, or the validation should be a single method called once. Additionally,_validate_entriesmutates the input list in place AND returns it — confusing contract."