memorize(): make delivery resumable per memcell so retries and replays are idempotent

Open
#516 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@chuiwenwei is already working on this.

Since Nov 6, 2026.

  • #577 by @chuiwenwei — open

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
ai, backend

Research direction

Start with service/memorize.py and service/_boundary.py, then trace markdown entry ID generation and OME dispatch. The issue describes the pending per-memcell delivery state, resume path, deterministic downstream IDs, event deduplication, and retry changes needed. Done means retries resume pending memcells without duplicating entries or events; the suggested boundary-call retry is only a smaller first step.

Written by the indexing model from the issue text.

Description

Why

memorize() is not atomic: boundary detection writes the memcell and consumes
the session buffer, then episode extraction and the OME pipelines run. A
failure after that point cannot be retried safely today:

  • re-running an /add cuts a second memcell from the same messages;
  • re-running a /flush finds an empty buffer and does nothing, leaving the
    memcell without its episode.

This is why the async_mode queue (branch feat/memorize-async-mode, PR to follow) ships with max_attempts = 1 and
documents crash recovery as at-least-once. The same limitation applies to
synchronous clients that retry a 5xx.

What the cloud engine does

Replays are idempotent there because three things line up:

  1. the unit of retry is the memcell, not the add request: the memcell is
    persisted with a "not yet dispatched" marker and an orphan re-dispatch
    sweep resumes from it instead of re-running boundary detection;
  2. downstream ids are deterministic (entry_id = <prefix>_<memcell_id>_<subject>_<idx>
    with a unique index; cluster ids are hashes), so a replay overwrites
    instead of appending;
  3. OME runs at-least-once on top of 1 and 2.

What EverOS would need

  • a per-memcell delivery state on memcell (written with the memcell, cleared
    when every pipeline finished) and a resume entry point that runs only the
    pipelines for memcells still marked pending;
  • episode / derived-entry ids derived from the memcell (today ep_<date>_<seq>),
    or a "memcell already has its entry" check in the markdown writer;
  • OME event dedup keyed by memcell id;
  • the queue (and the sync path's error mapping) switched to "retry = resume
    pending memcells" instead of "re-run the request".

Touches service/memorize.py, service/_boundary.py, the markdown entry id
scheme and OME dispatch; larger than the queue feature itself, so a separate
change.

Possible first step (small)

Retry only failures that happen before anything is written: wrap the boundary
LLM call (_boundary.py, the _detect call) in a typed error, let the queue
retry only that type (max_attempts back to 3 for it), and map it to 503 on
the sync path. Covers the most common failure (LLM down / rate-limited)
without any duplication risk. Roughly a dozen lines.

Dominant language
Python
Stars
13.3k
Forks
926
Avg merge
1d 10h
Merged PRs (30d)
57

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EverMind-AI/EverOS

All issues in EverMind-AI/EverOS

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.