Repository navigation
SCA-2533: Retain audio during automatic empty-generation teardown - #26103
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f43f320a68
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # are a subcollection and need their physical cleanup afterwards. | ||
| conversations_db.delete_conversation_photos(uid, conversation_id) | ||
| _discard_unreferenced_audio(uid, conversation_id, deleted_conversation) | ||
| _log_retained_empty_recording_audio(uid, conversation_id) |
There was a problem hiding this comment.
Add the required audio lifecycle change note
This changes automatic listen teardown from conditionally deleting audio to always retaining it, but the commit contains no pipeline change note. Searching backend/docs/listen_pusher_pipeline/changes/ also found no note covering this change. backend/AGENTS.md explicitly requires a note in the same PR for audio or conversation lifecycle changes; add one describing the retention behavior, rollout state, and verification evidence so the operational documentation reflects the new cleanup policy.
AGENTS.md reference: backend/AGENTS.md:L164-L164
Useful? React with 👍 / 👎.
| from utils.observability.fallback import record_fallback | ||
| from utils.observability.transcription import record_sync_intake_outcome | ||
| from utils.other.storage import delete_conversation_audio_files | ||
| from utils.other.storage import count_retained_raw_conversation_objects |
There was a problem hiding this comment.
Update the remaining tests that patch the removed import
Removing lifecycle.delete_conversation_audio_files leaves existing tests patching an attribute that no longer exists: test_record_orphan_repair.py:177 and test_conversation_quiet_finalization.py:964 both call monkeypatch.setattr with its default raising=True. Their parametrized cases will therefore fail with AttributeError before exercising the lifecycle behavior. Update those tests to patch the storage deletion boundary and mock the new inventory boundary where cleanup actually runs. The test runner could not execute here because the environment lacks the google package, but these stale attribute references remain in the reviewed tree.
Useful? React with 👍 / 👎.
## Scope Backport [#26103](#26103) (`34831db99152f11ddca1dacdca1bf3df360d55e1`) onto `96f06315ca05f0d55c3cc9b84bfcb0bff877ca22`. Both digests observed serving under `96f0631` came from that SHA. [Production build-only run](https://github.com/BasedHardware/omi/actions/runs/44975352162) · [Production backend-sync build](https://github.com/BasedHardware/omi/actions/runs/44992934744) - `sha256:b6fbdcb78a6a33f3d3c82ea7048fa71b052e458b24881b33f6f86bbd08f79171`, 18 ready pods at readback. - `sha256:33b5f757e93dc60cf8ebc017b944b236a49c959a1d6016a039b0ac4529de7d20`, 12 ready pods at readback. The registry currently resolves `96f0631` to this digest. One additional commit takes the `OMI_INDEXED_LIST_READS_ENABLED` registry row from [#26188](#26188) and regenerates its reference at the release base's existing as-of date. The base's expired graduation blocks the required pre-push check. This changes registry metadata only and carries zero additional runtime dependencies. Automatic empty-generation teardown retains `chunks`, `audio`, and `raw-live`. It inventories retained object versions read-only and logs the count or inventory error type. The approved logging follow-ups hash owner and conversation IDs in both new events. The purge ERROR uses fixed reason codes and generation counts. The shared `StoragePrefixPurgeBlocked` message also carries a fixed reason code and generation counts. Its typed object map stays available for aggregation. Existing merge cleanup and durable erasure can render the exception without including stored object identities. The conversations router is the only router in the diff. ## Explicit erasure compared with `96f0631` - The serving base aborts at the first prefix delete failure. #26103 tolerates object-not-found and stale-generation races in the six non-WAL conversation prefixes, then relists to verify the result. For protected generations still present, it collects the hold results and continues deleting eligible objects from the rest of those prefixes. A permission, bucket, unverified-only, or strict WAL failure still aborts immediately. No per-object deletion precondition is weakened. - Bucket order comes from a set, so neither version guarantees which bucket runs first. The base reaches each bucket's WAL only after that bucket's preceding prefixes succeed. #26103 still interleaves WAL with each bucket's prefixes. A WAL sweep from an earlier bucket can therefore finish before a hold is discovered in a later bucket, as it could on the base. Once a protected-prefix result is collected, the shared guard skips WAL for the current and every subsequent bucket. Any WAL sweep that runs still uses the strict generation and metageneration preconditions and stops on the first failure. - On `96f0631`, a protected-prefix failure aborts before any private-sync sweeps that have yet to run. #26103 still runs the private-sync `raw-sync` and `raw-mobile-batch` sweeps for blobs whose metadata links them to the conversation when execution reaches that bucket, even after a protected-prefix result. It then raises the aggregate unless an intervening failure aborts sooner. This permits additional partial erasure of linked originals while the protected generations remain. Shipping explicitly accepted this ordering for explicit erasure on SCA-4091. Both logging follow-ups preserve it. - The accepted-erasure runner still calls the strict purge directly and propagates failures for durable retry. Post-response conversation deletion logs typed prefix failures once. The separate account wipe retains its fail-fast path and its existing hold checks. ## Verification - `omi-heavy run -- bash backend/test.sh` with the 10 unit files changed by #26103: 491 passed, 1 Firestore emulator test skipped. The new regression test checks `str(error)` and `sanitize(str(error))`, the rendering used by the durable erasure task. - `omi-heavy run -- bash backend/test.sh test_conversation_lifecycle_contract.py test_listen_lifecycle_rollover_isolation.py test_live_capture_lifecycle.py`: 52 passed. - Pre-push passed, including all 45 selected shared preflight checks, backend type checking, and the hook-selected backend tests. - `git diff --check 96f0631 HEAD` passed. The SCA-2533 commit's stable patch ID matches the upstream merge’s first-parent diff. ## Image and release The backend Dockerfile is `backend/Dockerfile`. The production `build-only` path requires main ancestry and a successful Release Eligibility **push** run on `main` for the exact carrier SHA. A tree-neutral merge would establish ancestry and generate proof for the merge commit. A manual workflow dispatch on the carrier cannot produce the exact-SHA main push receipt. Shipping withdrew the tree-neutral route and referred branch-specific build admission and exact-head proof to David. Publication remains blocked pending that ruling. The listen Helm workflow consumes an already-published tag in production and its forward deploy updates the NEG exporter as well. The production handoff is the approved, image-only listen Deployment patch after full review and Shipping GO. The inverse is `96f0631`. Review requires omi-panel plus an Owners batch-custody check at the exact head. Release readback covers listen 5xx and route 2xx at 10 and 30 minutes, and zero post-roll events in Error Reporting group `COq2w_fF6o7I3gE`. Failure-Class: FC-audio-cleanup-before-durable-custody Line-Count-Exception: backend/routers/conversations.py | 3080 -> 3101 | Report typed audio-prefix failures with hashed IDs and bounded outcome metadata while preserving durable erasure retries. Line-Count-Exception: backend/utils/other/storage.py | 2775 -> 2803 | Keep inventory, protected-generation aggregation, and the original-custody WAL sweep with the conversation storage functions.
Summary
chunks,audioandraw-livewith a read-only inventory and one INFO record. An inventory failure leaves the completed teardown successful and records an unknown count.record-walobjects still use the base commit's fail-fast purge, after the preceding prefixes succeed. The account wipe uses its strict path.Verification
Second panel FIX: moved the purge exception import into the post-response privacy callback. Both CI-failing test files now pass in the 13-file focused run (520 passed, one Firestore emulator test skipped).
First panel FIX: added the lifecycle change note and updated the orphan-repair and quiet-finalization test mocks. The updated head passed 328 tests across six targeted suites and all 41 local preflight checks.
Backend coverage includes the delete request and accepted erasure, automatic listen teardown, merge cleanup, account holds, generation races, empty prefixes and buckets, and fail-fast WAL erasure.
The design revision passed 225 tests across eight targeted suites, with one Firestore emulator test skipped. All 41 local preflight checks passed.
Post-deploy, check that Cloud Error Reporting group
COq2w_fF6o7I3gEstops receiving events. For a newly discarded generation, confirm raw objects remain and the worker emits one retention record.The goal owner approved this design on SCA-2533 at
f43f320a68ad.Failure-Class: FC-audio-cleanup-before-durable-custody
Line-Count-Exception: backend/routers/conversations.py | 3060 -> 3077 | Report typed audio-prefix failures at ERROR level at the post-response task boundary while preserving the durable eraser's retry contract.
Line-Count-Exception: backend/utils/other/storage.py | 2775 -> 2803 | Keep audio bucket routing, read-only inventory, protected-generation aggregation, and the original-custody WAL sweep with the existing conversation storage functions.