Skip to content

DELETE /api/v1/memories does not cascade to derived memories (episodic, foresight, event_log) #148

Description

@contextablemark

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

  1. Store messages via POST /api/v1/memories until boundary detection triggers extraction
  2. Confirm episodic memories are searchable via GET /api/v1/memories/search
  3. Delete the MemCell: DELETE /api/v1/memories with event_id set to the MemCell _id
  4. 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

Activity

  1. JiwaniZakir commented on Mar 29, 2026

    @JiwaniZakir

    The root cause is straightforward: MemCellDeleteService.delete_by_combined_criteria performs the soft-delete on MemCell documents but never invokes the downstream repository delete methods, leaving derived records orphaned across MongoDB, Elasticsearch, and Milvus. The fix requires wiring the existing cascade infrastructure — EpisodicMemoryEsRepository.delete_by_event_id, ForesightMilvusRepository.delete_by_parent_id, and their equivalents — into that service method, using memcell_event_id_list to resolve the parent-child relationship before (or immediately after) the MemCell.delete_many(filter_dict) call. Worth noting that since Elasticsearch and Milvus deletes are separate I/O operations, the cascade should handle partial failure gracefully to avoid a state where some stores are cleaned up but others are not.

  2. cyfyifanchen commented on Jun 6, 2026

    @cyfyifanchen
    Collaborator

    Closing this as part of the EverOS 1.0 issue triage. This issue references the pre-1.0 API or retired infrastructure such as /api/v1/memories, /api/v3/agentic/*, MongoDB, Elasticsearch, Milvus, Redis, Kafka, longjob, or old memory type names. EverOS 1.0 uses POST /api/v1/memory/{add,flush,search,get} with Markdown + SQLite + LanceDB. Migration notes are tracked in PR #258: #258. If the same behavior still occurs on current main with the 1.0 API, please open a fresh issue with a 1.0 repro.

  3. cyfyifanchen commented on Jun 6, 2026

    @cyfyifanchen
    Collaborator

    Post-triage verification: keeping this closed because the reported DELETE /api/v1/memories cascade path belongs to the retired pre-1.0 MongoDB/ES/Milvus stack. The broader 1.0 memory lifecycle question is not being ignored; delete/reset/rollback APIs are still tracked in open issue #14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions