Repository navigation
SCA-4372: Label recovered mobile batch uploads - #26334
Merged
Merged
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. |
Git-on-my-level
added a commit
that referenced
this pull request
Nov 26, 2026
SCA-4372, app PR. Release verifies the deployed recovery labels from the backend follow-up before ramping. #26334 DESIGN: - Reads and writes — no new Firestore reads or writes in the batch upload path. Delay eligibility in the phone's existing WAL drain and keep the existing file, index, acknowledgement, and retry lifecycle. - Hold — 300 seconds in the background or while the on-device live preview engine runs, and 60 seconds in the foreground without it. Release the session when pending audio or its oldest sealed file reaches that limit, on foreground, or on capture end. Deadline wakes drain phone WALs without discovering or downloading pendant storage. The existing 300-second and 20-file request caps still apply. - Expected batch reads — about 1.37B/day at the issue baseline, falling to about 0.6–0.7B/day at full adoption. - Kill switch — PostHog `mobile-batch-upload-hold` defaults off. Off keeps the immediate per-seal wake and releases held files on the next client tick once the flag is observed. Release provisions the mobile flag through the existing flag store. An active hold refreshes the shared flag snapshot at most once a minute. - Ramp — 0→5→25→100 under the SCA-3891 cut guard with Margin GO. Use the latency and never-arrived guards below. Roll back on any lost-audio or custody alarm. - Production proof — count units/day from `omi_batch_pipeline_unit_diarization_outcome_total` and measure batch reads per audio-hour. Compare the settled readback to the SCA-4372 baseline after adoption. - Open risks — phone loss or uninstall can remove held audio before cloud acceptance. Check GPU memory with larger units and qualify iOS background timer execution on a device. Suspended apps rely on the next execution window or foreground recovery. ## Rollback guards - **Latency.** In server GMP, add the p90 of `omi_batch_pipeline_upload_hold_age_seconds` to the p90 of `omi_batch_pipeline_upload_to_transcript_seconds`, grouped by `hold_state` and filtered to `recovered="false"` in both histograms. Turn the flag off when the sum exceeds H + 300 s in any state. H is 60 s for `fg60` and 300 s for `bg300` and `fg_preview300`. This rule uses two marginal percentiles. The phone computes hold age at HTTP send time from the oldest included seal, capped at one day. - **Never-arrived.** In PostHog, compare `Mobile Held WAL Backlog` by build, trigger, and `cohort`. Turn the flag off if the enabled cohort shows a backlog above control, using the count distribution and `oldest_held_age_s > H + 900 s` for the oldest file's effective `hold_state`. For an unknown state, including a WAL recovered without an active deadline, use H = 300 s for the backlog check. Use the same time cutoff when comparing against control. A file count is separate from the age cutoff. The app samples sealed mobile Standard files still awaiting acceptance in both cohorts. On-device seal metadata supplies age for held WALs, and capture end supplies the control reference. Each process sends at most one startup sample, one per foreground, and one additional sample per hour. Check delivery and ingestion coverage for both cohorts before using the comparison. The repository records a 2% stable default ingestion sample for unlisted events. Release should verify the keep-list or adequate sampled coverage, especially at 5% rollout. - **Recovered.** The app sends `X-Omi-Upload-Recovered: 1` for held WALs recovered from the index or the seal journal. Those requests carry `recovered="true"` in both GMP histograms and are tracked separately from the latency guard. Recovered and fresh files upload in separate requests under the same size caps. ## Product invariants affected - INV-CAP-1. Sealing and index publication still run before upload scheduling. Both existing local receipts and unindexed journal files are recoverable after restart. A held sibling also prevents an immutable partial capture claim. ## Verification - Hermetic Flutter coverage for the three states, foreground and capture-end release, age, flag off, both request caps, journal re-scan, and upload metadata. Line-Count-Exception: app/lib/backend/http/api/conversations.dart | 1642 -> 1645 | Attach the hold state and age at the existing multipart send. Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 5103 -> 5106 | Signal the existing capture-end and rollover boundaries so the hold releases promptly. Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 3212 -> 3256 | Connect WAL lifecycle sampling and recovered request metadata to the existing upload drain. Line-Count-Exception: app/lib/utils/analytics/analytics_manager.dart | 3155 -> 3168 | Attribute the device signal to the release build and distinguish a resolved off cohort from unavailable flags. - `omi-heavy run -- flutter test -j "$OMI_HEAVY_CPUS"` with the focused hold, capture, upload trace and coordinator tests (113), plus WAL custody, account generation, upload gate and resilience tests (249) — 362 passed. - Feature flag registry validation passed. ## UI evidence UI-Evidence: none This patch changes upload scheduling and telemetry without changing any screens or strings. ## Failure class Failure-Class: none Hold-age follow-up verification: 228 affected Flutter tests passed, covering dispatch timing, replay age, clamping, disabled flags, and WAL restart recovery. Targeted Dart analysis and all 228 affected Flutter tests passed after the CI lint correction. Recovery and backlog follow-up verification: 329 affected Flutter tests passed through `omi-heavy`, covering indexed and unindexed journal recovery, separate request grouping, send headers, both cohorts, deadline changes, signal cadence, account cutover, and existing WAL and multipart paths. The Dart analyzer ratchet passed after the explicit analytics import correction. Analytics event registry validation passed.
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.
SCA-4372. Backend follow-up for recovered mobile batch WALs. Companion app PR #26319
DESIGN:
X-Omi-Upload-Recovered: 1. Both hold-age and publication latency histograms userecovered="true|false". Absent and invalid values map to false. The existing fivehold_statevalues and GMP keep-lists cover the new samples.mobile-batch-upload-holdflag is the kill switch. Release verifies both deployed histograms carry the recovery label, then ramps the app 0→5→25→100 under the SCA-3891 cut guard with Margin GO.hold_stateand withrecovered="false"on both GMP histograms, turn the hold flag off if phone hold-age p90 plus server upload-to-transcript p90 exceeds H + 300 s. H is 60 s forfg60and 300 s forbg300orfg_preview300. Monitor recovered samples separately. Roll back on any lost-audio or custody alarm.omi_batch_pipeline_unit_diarization_outcome_totaland batch reads per audio-hour.Product invariants affected
None.
Verification
Line-Count-Exception: backend/routers/sync.py | 4205 -> 4208 | Read the optional recovery header at the existing sync intake.
UI evidence
UI-Evidence: none
Failure class
Failure-Class: none