Summary
DELETE /api/v1/memories soft-deletes MemCell documents in MongoDB but does not cascade to derived memory types. After deletion, episodic_memory, foresight_record, and event_log_record documents remain in MongoDB, Elasticsearch, and Milvus — and continue to appear in search results.
Steps to Reproduce
- Store messages via
POST /api/v1/memories until boundary detection triggers extraction
- Confirm episodic memories are searchable via
GET /api/v1/memories/search
- Delete the MemCell:
DELETE /api/v1/memories with event_id set to the MemCell _id
- Search again — derived memories still appear
Expected Behavior
Deleting a MemCell should cascade to all derived records:
- episodic_memories — delete from MongoDB, Elasticsearch, and Milvus
- foresight_records — delete from MongoDB and Milvus
- event_log_records — delete from MongoDB, Elasticsearch, and Milvus
The repository classes already have the necessary delete methods (EpisodicMemoryEsRepository.delete_by_event_id, ForesightMilvusRepository.delete_by_parent_id, etc.) — they just aren't called from MemCellDeleteService.delete_by_combined_criteria.
Actual Behavior
MemCellDeleteService.delete_by_combined_criteria only calls MemCell.delete_many(filter_dict). No derived memories are touched. The cascade delete infrastructure (repository delete methods) exists but is not wired into the delete service.
Additional Context
Summary
DELETE /api/v1/memoriessoft-deletesMemCelldocuments in MongoDB but does not cascade to derived memory types. After deletion,episodic_memory,foresight_record, andevent_log_recorddocuments remain in MongoDB, Elasticsearch, and Milvus — and continue to appear in search results.Steps to Reproduce
POST /api/v1/memoriesuntil boundary detection triggers extractionGET /api/v1/memories/searchDELETE /api/v1/memorieswithevent_idset to the MemCell_idExpected Behavior
Deleting a MemCell should cascade to all derived records:
The repository classes already have the necessary delete methods (
EpisodicMemoryEsRepository.delete_by_event_id,ForesightMilvusRepository.delete_by_parent_id, etc.) — they just aren't called fromMemCellDeleteService.delete_by_combined_criteria.Actual Behavior
MemCellDeleteService.delete_by_combined_criteriaonly callsMemCell.delete_many(filter_dict). No derived memories are touched. The cascade delete infrastructure (repository delete methods) exists but is not wired into the delete service.Additional Context
memcell_event_id_listfield on derived memories provides the link back to the parent MemCell, which could be used for cascade lookups3c9a2d0246