Skip to content

[Bug]: Deleting a session whose memory is not open creates its storage first, only to delete it #1728

Description

@edwinyyyu

Describe the bug

Deleting a session whose episodic memory is not open builds the whole memory first, and building it creates the session's storage when it is missing. So deleting a session that was never written to creates a vector store collection and a segment store partition, only to delete them.

As of 82b6c6f58 (main), paths under packages/server/src/memmachine_server/:

  • episodic_memory/episodic_memory_manager.py:288, delete_episodic_session: when the instance is not cached, it calls episodic_memory_params_from_config and builds an EpisodicMemory to call delete_session_episodes on it.
  • episodic_memory/long_term_memory/service_locator.py:92, _event_params: on the event backend, this opens the session's vector store collection, creating it when absent (create_collection, line 125), and opens or creates its segment store partition (open_or_create_partition, line 140).

Deletion therefore depends on creation succeeding. Any failure to create the storage (a backend error, a timeout) fails the deletion, even when there was nothing to delete.

Steps to reproduce

  1. Create a project or session, and do not add any memories to it.
  2. Delete it.
  3. The event backend creates the session's vector store collection and segment store partition, then deletes them (visible as a create followed by a delete in the backends).

Expected behavior

Deleting a session deletes whatever storage it has, by key, and creates none.

Notes

Environment

  • MemMachine: main at 82b6c6f58

🤖 Written by Claude Code (Claude Opus 5.5) on behalf of @edwinyyyu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions