Repository navigation
fix(memories): mirror the canonical delete-all into the store the user reads - #10454
aryanorastar wants to merge 2 commits into
Conversation
… reads
DELETE /v3/memories/{id} and /v3/memories/batch branch on canonical_write_decision,
which enables canonical at MEMORY_MODE in {write, read}. GET /v3/memories branches on
canonical_read_enabled, which enables canonical only at MEMORY_MODE=read.
So during the dual-write stage (MEMORY_MODE=write) a delete tombstones the canonical
record while the user's list keeps reading legacy, where the row is untouched. The
client drops it optimistically and the next refresh re-reads legacy, so the memory
reappears seconds later (BasedHardware#10446).
Deleting is symmetric with dual-write: mirror the canonical delete into legacy until
read cutover. The mirror is best-effort — canonical is authoritative and already
committed, so a legacy cleanup failure must not fail a request the user saw succeed —
and it no-ops after cutover, where both sides are canonical.
_force_canonical now pins MEMORY_MODE=read explicitly rather than inheriting the
ambient rollout config, so the existing batch-vs-single authorization-parity cases
keep asserting exactly what they always did.
Refs BasedHardware#10446.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…r reads Follow-up to the single/batch delete mirror: DELETE /v3/memories has the same read/write asymmetry. At MEMORY_MODE=write the canonical wipe is invisible, because GET /v3/memories still reads legacy — so "delete everything" leaves the user's entire list intact on the next refresh (BasedHardware#10446). Mirror the wipe into legacy until read cutover, under the same guard and best-effort contract as the single/batch mirror. Also factors the legacy branch's collect-then-purge into _purge_legacy_memories so both paths share one definition instead of duplicating the pagination and vector cleanup. Refs BasedHardware#10446. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the careful follow-up and for explicitly separating this from #10451.
I reviewed the diff around DELETE /v3/memories and the added regression coverage. The implementation looks technically coherent: canonical delete/delete-all commits first, legacy mirroring only runs before canonical read cutover, and the legacy purge still collects IDs before deleting so vectors are cleaned up. I also ran the touched unit file in a scrubbed local environment:
pytest tests/unit/test_memories_batch_delete.py -q → 23 passed.
I am not approving this automatically because this is intentionally a user-data deletion/migration blast-radius decision: mirroring delete-all means a canonical wipe also bulk-wipes the legacy collection while legacy is still the read surface. That matches the current user-visible semantics of "delete everything", but it removes legacy as a rollback/recovery source for that user's memories during the rollout. Human maintainer review should decide whether that is the desired migration contract before merge.
One merge-readiness note: GitHub still shows Hygiene cancelled and Formatting skipped on this head, so please make sure the required gates are clean before landing.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Hey @aryanorastar 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
What
Follow-up to #10451, which I deliberately scoped out of that PR.
DELETE /v3/memories(delete-all) carries the same read/write asymmetry: atMEMORY_MODE=writethe canonical wipe is invisible becauseGET /v3/memoriesstill reads legacy, so "delete everything" leaves the user's entire list intact on the next refresh.Stacked on #10451 (it reuses that PR's guard); review the last commit only. Refs #10446.
I held this back from #10451 on purpose and I'd rather you decide than assume: mirroring delete-all means a bulk wipe of the legacy collection. That is a much larger blast radius than the single/batch mirror, on a user-data deletion path, during a live migration.
The argument for it: the user explicitly asked to delete everything, and today that request silently doesn't affect what they see. The argument against: if legacy is ever meant to be recoverable during the migration, this removes that option in one call.
If you'd rather leave delete-all asymmetric until read cutover, close this — #10451 stands on its own and fixes the reported symptom.
Fix
canonical_read_enabledis true, and a legacy failure never fails a request whose canonical delete already committed._purge_legacy_memories, so both paths share one definition instead of duplicating the pagination and vector cleanup.Tests
backend/tests/unit/test_memories_batch_delete.py:Suites:
test_memories_batch_delete.py→ 23 passed;test_memories_batch.py+test_memory_api_egress_contract.py+test_memories_pagination_clamp.py+test_inv_mem_1_guard.py→ 34 passed.Product invariants affected
Failure-Class: none