You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Memories out of sync across phone vs desktop; deleted memories reappear #10446
Root-caused symptom 2 ("deleted memories reappear after ~10–15s") to a read/write decision asymmetry in the V3 memory rollout — not a client cache issue.
The two decisions are gated on different rollout modes.MemoryRolloutMode is off | shadow | write | read (backend/config/memory_rollout.py), and:
canonical_write_decision (utils/memory/canonical_activation.py) enables canonical writes when mode ∈ {write, read} — if rollout_config.mode not in {MemoryRolloutMode.write, MemoryRolloutMode.read}: … not writable
The delete route follows the write decision; the list route follows the read decision:
DELETE /v3/memories/{memory_id} (backend/routers/memories.py:837) branches on _canonical_write_enabled_or_fail_closed(...) → MemoryService(...).delete(...), which tombstones the canonical item.
GET /v3/memories (backend/routers/memories.py:~640) branches on canonical_read_enabled(...).
So while MEMORY_MODE=write — the dual-write stage a rollout necessarily passes through before read cutover, and #10394 has this rollout mid-flight — a delete tombstones the canonical record while the user's list keeps reading legacy, where the row is untouched. The client drops it optimistically, the next refresh re-reads legacy, and it comes back. That matches the reported ~10–15s reappearance exactly.
This may also explain symptom 1 (desktop 15+, phone 0): in write mode new memories land in canonical only, so any surface still reading legacy shows an emptier list than one reading canonical. Worth confirming which read path each client uses before treating that half as the same bug.
What I did not do: propose the code change. The fix is a rollout-semantics call, not a mechanical one — during dual-write, either the delete must apply to both stores (symmetric with dual-write), or it must target the store the user actually reads. Picking wrong on a user-data deletion path during a live migration is the kind of thing that should be decided by whoever owns the rollout contract, and I can't see prod's current MEMORY_MODE from here. Happy to implement whichever semantic you want, with tests.
Quick confirmation for whoever picks this up: check prod MEMORY_MODE. If it's write, this is deterministic for every affected account, not a flake.
It mirrors the canonical delete into legacy while MEMORY_MODE=write, so a delete lands in the store the user actually reads. The mirror no-ops after read cutover, is best-effort (canonical is authoritative and already committed — a legacy cleanup failure must not fail a request the user saw succeed), and no-ops for canonical-only rows since Firestore deletes of absent documents do nothing.
One thing genuinely needs your call, not mine: I picked symmetric dual-delete (a delete applies to both stores while both are live). The alternative is routing deletes at the store the user reads. Both are defensible; this is a live migration's deletion path, so the rollout owner should pick. Easy to switch.
DELETE /v3/memories (delete-all) has the same asymmetry but I deliberately left it out — mirroring it means a bulk wipe of the legacy collection, a far larger blast radius than this bug, and it should land with explicit sign-off.
Regression test verified against the old code (fails) and the fix (passes); INV-MEM-1 guard green; preflight 19/19.
Worth checking when you triage: if prod is at MEMORY_MODE=write, this is deterministic for every affected account rather than an intermittent glitch. Symptom 1 (desktop 15+ vs phone 0) is plausibly the same split — new memories land in canonical while a surface still reading legacy looks empty — but I'd confirm which read path each client uses before assuming.
Triage note on the root cause above — the write/read asymmetry cannot be what prod users are hitting, so #10451 (merged as 5fa372e) does not change prod behavior and the reported symptoms are still unexplained.
Verified against the live prod service (gcloud run services describe backend --region us-central1 --project based-hardware):
MEMORY_MODE=off
MEMORY_ENABLED_USERS unset
MEMORY_V3_GET_ENABLED=false
With MEMORY_MODE=off, MemoryRolloutConfig.for_user() returns _legacy_capabilities for every uid, and resolve_memory_system() short-circuits to MemorySystem.LEGACY before the code cohort matters (backend/utils/memory/memory_system.py:41). build_v3_production_runtime() also returns enabled=False on the MEMORY_V3_GET_ENABLED=false gate. So on prod both the read and the delete follow legacy — there is no canonical/legacy split to desynchronise. (based-hardware-dev is at MEMORY_MODE=read, i.e. past the write stage, so the asymmetry isn't live there either.)
Two consequences for whoever picks this up:
The deferred DELETE /v3/memories (delete-all) mirror is latent, not a live prod bug — no reason to rush a bulk legacy delete into prod on the strength of this report.
Both reported symptoms need a different explanation on the legacy path. Both clients call the same routes (app/lib/backend/http/api/memories.dart and desktop/.../APIClient+Memories.swift both use v3/memories), so an endpoint split isn't it either. Worth getting from the reporter: the affected uid, whether the phone is on a dev/staging build (different Firebase project ⇒ genuinely different account), and app/desktop versions — then check that uid's legacy Firestore rows directly rather than reasoning from the rollout config.
Posted by the hourly desktop bug watchdog; read-only verification, no code change.
Activity
aryanorastar commentedon Jul 24, 2026
Root-caused symptom 2 ("deleted memories reappear after ~10–15s") to a read/write decision asymmetry in the V3 memory rollout — not a client cache issue.
The two decisions are gated on different rollout modes.
MemoryRolloutModeisoff | shadow | write | read(backend/config/memory_rollout.py), and:canonical_write_decision(utils/memory/canonical_activation.py) enables canonical writes whenmode ∈ {write, read}—if rollout_config.mode not in {MemoryRolloutMode.write, MemoryRolloutMode.read}: … not writablecanonical_read_enabled(same module) returns False unlessmode == read—if rollout_config.mode != MemoryRolloutMode.read: return FalseThe delete route follows the write decision; the list route follows the read decision:
DELETE /v3/memories/{memory_id}(backend/routers/memories.py:837) branches on_canonical_write_enabled_or_fail_closed(...)→MemoryService(...).delete(...), which tombstones the canonical item.GET /v3/memories(backend/routers/memories.py:~640) branches oncanonical_read_enabled(...).So while
MEMORY_MODE=write— the dual-write stage a rollout necessarily passes through before read cutover, and #10394 has this rollout mid-flight — a delete tombstones the canonical record while the user's list keeps reading legacy, where the row is untouched. The client drops it optimistically, the next refresh re-reads legacy, and it comes back. That matches the reported ~10–15s reappearance exactly.This may also explain symptom 1 (desktop 15+, phone 0): in
writemode new memories land in canonical only, so any surface still reading legacy shows an emptier list than one reading canonical. Worth confirming which read path each client uses before treating that half as the same bug.What I did not do: propose the code change. The fix is a rollout-semantics call, not a mechanical one — during dual-write, either the delete must apply to both stores (symmetric with dual-write), or it must target the store the user actually reads. Picking wrong on a user-data deletion path during a live migration is the kind of thing that should be decided by whoever owns the rollout contract, and I can't see prod's current
MEMORY_MODEfrom here. Happy to implement whichever semantic you want, with tests.Quick confirmation for whoever picks this up: check prod
MEMORY_MODE. If it'swrite, this is deterministic for every affected account, not a flake.aryanorastar commentedon Jul 24, 2026
Implemented the server-side half in #10451.
It mirrors the canonical delete into legacy while
MEMORY_MODE=write, so a delete lands in the store the user actually reads. The mirror no-ops after read cutover, is best-effort (canonical is authoritative and already committed — a legacy cleanup failure must not fail a request the user saw succeed), and no-ops for canonical-only rows since Firestore deletes of absent documents do nothing.One thing genuinely needs your call, not mine: I picked symmetric dual-delete (a delete applies to both stores while both are live). The alternative is routing deletes at the store the user reads. Both are defensible; this is a live migration's deletion path, so the rollout owner should pick. Easy to switch.
DELETE /v3/memories(delete-all) has the same asymmetry but I deliberately left it out — mirroring it means a bulk wipe of the legacy collection, a far larger blast radius than this bug, and it should land with explicit sign-off.Regression test verified against the old code (fails) and the fix (passes); INV-MEM-1 guard green; preflight 19/19.
Worth checking when you triage: if prod is at
MEMORY_MODE=write, this is deterministic for every affected account rather than an intermittent glitch. Symptom 1 (desktop 15+ vs phone 0) is plausibly the same split — new memories land in canonical while a surface still reading legacy looks empty — but I'd confirm which read path each client uses before assuming.fix(memories): mirror canonical deletes into the store the user still…
fix(memories): mirror the canonical delete-all into the store the use…
fix(memories): mirror canonical deletes into the store the user still…
fix(memories): mirror the canonical delete-all into the store the use…
fix(memories): mirror canonical deletes into the store the user still…
kodjima33 commentedon Jul 25, 2026
Triage note on the root cause above — the write/read asymmetry cannot be what prod users are hitting, so #10451 (merged as 5fa372e) does not change prod behavior and the reported symptoms are still unexplained.
Verified against the live prod service (
gcloud run services describe backend --region us-central1 --project based-hardware):MEMORY_MODE=offMEMORY_ENABLED_USERSunsetMEMORY_V3_GET_ENABLED=falseWith
MEMORY_MODE=off,MemoryRolloutConfig.for_user()returns_legacy_capabilitiesfor every uid, andresolve_memory_system()short-circuits toMemorySystem.LEGACYbefore the code cohort matters (backend/utils/memory/memory_system.py:41).build_v3_production_runtime()also returnsenabled=Falseon theMEMORY_V3_GET_ENABLED=falsegate. So on prod both the read and the delete follow legacy — there is no canonical/legacy split to desynchronise. (based-hardware-devis atMEMORY_MODE=read, i.e. past thewritestage, so the asymmetry isn't live there either.)Two consequences for whoever picks this up:
DELETE /v3/memories(delete-all) mirror is latent, not a live prod bug — no reason to rush a bulk legacy delete into prod on the strength of this report.app/lib/backend/http/api/memories.dartanddesktop/.../APIClient+Memories.swiftboth usev3/memories), so an endpoint split isn't it either. Worth getting from the reporter: the affected uid, whether the phone is on a dev/staging build (different Firebase project ⇒ genuinely different account), and app/desktop versions — then check that uid's legacy Firestore rows directly rather than reasoning from the rollout config.Posted by the hourly desktop bug watchdog; read-only verification, no code change.
fix(memories): keep local-only deletes deleted (#10862)
fix(backend): fail privacy deletion open when the vector store is unc…
fix(backend): restore the released 204 contract for conversation dele…