Repository navigation
fix(backend): conversation delete erases sync staging audio, ledger-linked batch rows and the retired v2 profile - #26215
Merged
Merged
Conversation
…inked batch rows and the retired v2 profile
- Delete (cascade and non-cascade) now erases the conversation's sync staging
(syncing/{uid}/{job_id}/, found via the sync content ledger) and merge-donor
audio prefixes through the existing owner-prefix purge; held objects stay.
- Both conversation batch purges also erase batch rows the ledger links to the
conversation, once every conversation the upload fed is tombstoned.
- Forget AI profile clears the orphaned ai_user_profile_v2 field.
This was referenced Nov 24, 2026
Git-on-my-level
added a commit
that referenced
this pull request
Nov 25, 2026
) ## Summary On resumed keyed from-segments uploads, keep the persisted client projection display-only. Validate retry projections against submitted segments, then discard them during an active resume because the admitted row's stored transcript remains authoritative. Keep projection data out of coordinator input and persistence writes; reuse the same admitted row and transcript. Existing digest-checked late binding on completed idempotency hits remains unchanged. The regression test covers valid and schema-incompatible stored projections and a valid retry projection. The pipeline change note records this lifecycle boundary and its release-train handling. PR #26219 remains untouched as the exact revert of #26215. ## Verification - `test_client_processing_trust_boundary.py`: 61 passed on M1 through `bin/omi-heavy`. - `test_developer_from_segments_idempotency.py`: 94 passed on M1 through `bin/omi-heavy`. - `git diff --check`: passed. Failure-Class: none Line-Count-Exception: backend/routers/developer.py | 2897 -> 2907 | preserve keyed retry projection trust boundary
Git-on-my-level
added a commit
that referenced
this pull request
Nov 25, 2026
Reverts #26215 at `3e1a54b0b924fcd460db162507ee4c9429a34162` under Shipping’s R26 ruling on SCA-1819. Deleting one conversation in a shared upload currently erases staging audio that a live sibling still references. The PR also expanded default delete audio erasure without durable retry on the regular request path. The patch is byte-for-byte the inverse of #26215 relative to its first parent. The tree diff from that parent to this PR head matches #26207’s first-parent patch byte-for-byte, preserving keyed from-segments uploads. `git diff --check` passed. Release owns merge after green exact-head CI. The re-land requires a full custody review of the repaired head. Line-Count-Exception: backend/routers/conversations.py | 3197 -> 3199 | Restore the pre-#26215 cascade-only audio deletion block and its storage guard to preserve shared-upload custody. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/26219?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/26219?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26219&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
shubhxho
pushed a commit
to shubhxho/omi
that referenced
this pull request
Nov 25, 2026
This reverts commit 3e1a54b. Co-authored-by: multica-agent <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Nov 25, 2026
Records the shared-upload custody regression and the pre-#26215 behavior restored by #26219. Shipping authorized this docs-only PR to preserve the exact revert patch. The note records the reviewed revert head and the last serving receipt available at publication. Add the merged revert SHA when Release verifies it. Add the serving receipt when available, or link the pending rollout record if service verification is still open at the four-hour docs deadline. [Connector finding](#26219 (comment)) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/26224?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/26224?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26224&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bugs
A support data-deletion request showed three gaps in how conversation and profile deletion erase data. They affect every user, not one account.
syncing/{uid}/{job_id}/insyncing-local. That bucket has no lifecycle delete, on purpose:scripts/check_sync_staging_lifecycle.pyrequires that. Staging cleanup only runs with a custody receipt, so most staging stays. These objects are keyed by the upload job, not the conversation, and the delete path never looked them up. For one account this was 14,340 objects (about 4.5 GB) that would never expire. Also, acascade=falsedelete erased no audio at all, and merge-donor audio prefixes were only collected whenBUCKET_CANONICAL_AUDIOis set, which it isn't in prod.chunk_identity). They are only reachable by the final conversation id after projection. The purge matched by conversation identity only, so un-projected jobs, results, artifacts and intakes, plus their GCS audio and transcripts, survived until their 28–44 day TTL. On a read-only sample of 200 current prod jobs, 34 link to a live conversation only through the sync ledger (8 of 200 results); once projected, a row is matched by today's code.ai_user_profile_v2. The retired Dream state pass wrote that field (removed in a96ada8). Nothing reads it, butDELETE /v1/users/ai-profileonly removedai_user_profile, so conversation-derived profile text stayed on the user doc.Fix
database/sync_ledger_sources.pyreads the owner's sync content ledger, the durable link from an upload to the conversations it fed. A row hasjob_id(staging dir),batch_pipeline.segment_ids(batch rows), andresult/partial_resultconversation ids. The lookup is 4 single-fieldarray_contains_anyqueries per 30 ids, registered with the Firestore query guard.delete_privacy_conversation_audionow also purges the conversation's merge-donor prefixes and every staging dir (syncing/{uid}/{job_id}/, plus the derived bucket) of the uploads that fed it. It uses the existing_delete_owner_bucket_prefix/delete_owner_bucket_prefixhelper (all generations, legal/retention holds honoured,StoragePrefixPurgeBlockedraised after every prefix is attempted). It adds no new raw deletes. This covers the request path and the accepted/deferred erasure runner from a9aa629, since both call this function.if cascade:. I found no deliberate reason to keep audio oncascade=false: the WS-J matrix and the Q8 note cover memories only, and the non-cascade path already deletes the transcript doc, screen frames and vectors. Automatic empty-generation teardown (bb7cb3f) does not use this route and still keeps its audio.purge_batch_owner(conversation_id=...)inline andpurge_conversationsin the obligation runner) also treat ledger-linked segment ids as the conversation's. This happens only when every conversation that upload fed has a tombstone, so a shared upload never erases a live sibling's pipeline rows. Rows already matched by identity behave as before.delete_ai_user_profilealso deletesai_user_profile_v2._accept_held_conversation_deletestill returns before any erasure), erasure obligations, and the account gate.delete_all_user_storage_objectssweepssyncing/{uid}/in both buckets,purge_user_subtreeruns the fullpurge_batch_owner(uid), and the user-doc wipe removes the v2 field. No change needed there.Exception, explained: a staging dir shared by an upload that fed several conversations (about 6% of ledger rows in a 2,000-row prod sample) is removed when any of them is deleted. That matches the existing raw-sync/raw-mobile-batch original handling in
delete_conversation_audio_files. Batch rows from such an upload wait until all of its conversations are deleted. Staging for uploads that produced no conversation (silence or failed jobs) has no conversation owner; only account deletion removes it.Tests
test_sync_ledger_sources.py(new) covers: all four result fields queried, unsafejob_iddropped, 30-id chunking, the "every fed conversation tombstoned" rule, no stage means no read, and the inlinepurge_batch_ownererasing ledger-linked rows.test_owner_storage_purge_and_gate.pycovers: staging and donor prefixes erased only for this owner and job; a held staging object kept and reported after every prefix is tried; no ledger row leaves staging untouched.test_conversation_batch_purge_resumable.pycovers: the obligation runner erases provisional-identity rows the ledger names and keeps an unrelated upload. With the change reverted this test fails.test_conversation_tombstones.py(a non-cascade delete schedules the audio purge with donors) andtest_delete_conversation_cancels_task_reminders.py(donors are read without the canonical bucket).test_ai_user_profile_route.pychecks that forget clears both profile fields.backend/test.sh: all 78 unit files that reference the delete/purge/profile paths, plustest_firestore_query_shapes.pyandtest_firestore_outside_query_contract.py, pass.Dev verification
Synthetic test account only (no customer data). Evidence: object listings before and after, plus scripts, kept outside the repo.
gcp_backend.ymldeploys only mergedmainSHAs, and auto-dev follows Release Eligibility. So I ran the realDELETE /v1/conversations/{id}?cascade=trueroute function in-process with the dev Cloud Run env and secrets, against dev GCS (syncing-local-development,omi-dev-private-cloud-sync) and the_devFirestore collections. Base commit4a680e2e7cwas the control.STT_SERVICE_MODELSlists retired Deepgram models), so I wrote the conversation doc and ledger link a successful job writes, plus one chunk object.tombstoned. Its stagingsyncing/<uid>/887add7f…/…wavremains (bug reproduced).tombstoned. Its stagingsyncing/<uid>/48078ee3…/…wavandchunks/<uid>/<cid>/…are gone, and the tombstone is recorded. The unrelated upload's staging is untouched.BUCKET_OBJECT_LAKE=omi-dev-object-lake-uc1does not exist, so every dev conversation delete returns 503. Both runs above usedBUCKET_OBJECT_LAKE=to skip it.BUCKET_PRIVATE_CLOUD_SYNC, so it falls back to the prod bucket name.api.omiapi.comroutes most paths to prod (dev-to-prod-api).DELETE ?cascade=truereturned 204tombstoned. After the batch purge obligation settled (about 40 min,artifact_pendingbehind the late-upload window), every object was gone and only 2 content-freeprojection_state: erasedordering rows remained. The merged segment was caught here because its result had been projected onto the conversation. The gap this PR closes is narrower: rows not projected (yet, or ever), which only the ledger links. In a read-only sample that was 34 of 200 jobs and 8 of 200 results. These upload-path batch uploads stage nothing insyncing-local, so bug 1 concerns the legacy sync path and existing staging.Failure-Class: new
Line-Count-Exception: backend/utils/other/storage.py | 2803 -> 2848 | the staging purge sits next to the conversation audio purge it extends; same helpers and blocked-object aggregation
Line-Count-Exception: backend/database/users.py | 2719 -> 2722 | forget-profile must also clear the retired v2 field
🤖 Generated with Claude Code