Repository navigation
fix(playback): stop obsolete merge jobs retrying on contention - #24192
Merged
Merged
Conversation
Git-on-my-level
added a commit
that referenced
this pull request
Oct 31, 2026
After #24192, four audio merge test cases still patched the router's fingerprint function. The job now checks freshness through `sync_playback.conversation_merge_fingerprint`, so those mocks no longer matched the payload and the job returned `superseded` before reaching the behavior under test. Patch the helper at its current call site in the tombstone/upload-fence and destructive-deferral tests. Production code and every assertion are unchanged. Validation: - Baseline: the four requested files reproduced 10 parametrized failures, with 110 passing tests. - Updated: all 120 tests pass across the same four files through `backend/test.sh`, file isolation, one worker, `TZ=UTC`, `nice -n 19`, and `omi-heavy`. - Searched `backend/tests` for all fingerprint references. The only remaining router fingerprint patch is in `test_audio_merge_tasks.py`, which also patches the new helper and uses the router patch for the separate artifact fingerprint. - `make preflight`, metadata validation, and `git diff --check` pass. Failure-Class: none Test fixture maintenance after a helper extraction; no production behavior change. Lead owns merge. No deploy needed. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/24195?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/24195?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24195&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. -->
Git-on-my-level
added a commit
that referenced
this pull request
Oct 31, 2026
) After 30 minutes, recordings whose tail or proof size cannot be certified can transcribe retained audio with an explicit partial marker. Complete seals, producer fences, audio custody, and hard-3 thresholds are unchanged. Encrypted continuation plans use at most 128 siblings per page and 300 seconds/256 references per unit, with 8,192-entry source/coverage and 8 MiB plan bounds. Every partial pass now fills only spans without existing text, including the first generation. It preserves unannotated transcripts and edits without correction metadata; overlap or ambiguous alignment keeps the original text. Completed coordinators claim their hourly poll transactionally before listing, so stale scheduler snapshots across serving replicas do no storage I/O. They retire after 24 hours without inventory change, retaining audio, coverage and partial status. A new producer upload revision lets the existing repair pass reopen a retired coordinator. Unsignalled storage-only arrivals after retirement need separately authorized operator recovery. Recorded BYOK policies are refused and counted at initial finish and during late continuation. Discard and payer state are checked before retained audio/plan reads and again at atomic intake. The CI fixes classify the server-authored partial metadata, use a closed outcome enum, omit the partial-only binding field from ordinary work so the frozen pre-E1 constructor remains compatible, and correct the deadline test's assumption that all eight requests must start before a 30 ms timeout. Validation: 496 unique backend cases across 14 focused files through backend/test.sh under TZ=UTC and omi-heavy. The final stage-policy/intake/partial selection passed 119 overlapping cases, including the stale-scheduler poll fence. Strict Firestore transaction and real staging/intake/worker fixtures cover preservation, hourly scheduling, 24h retirement, producer-revision repair reopening, and payer/discard races. All 22 donor-projection cases pass with stored bindings decoded through their wire defaults. The hermetic listen/core-flow e2e passed 15 cases; wrapped make preflight passed all 68 checks. These are local checks, not production acceptance. Optional generated API wire metadata remains additive; UI behavior is unchanged. Lead owns merge and all deploys. Keep recordSealRules.partialEnabled=false while rolling pusher; require rollout completion and an authoritative PodList count of zero old-image instances, including terminating instances. Roll all CPU admission/projection hosts and API, then worker/repair. Drain old or enabled repair Jobs before enabling the existing partial switch for new Jobs. No new rollout flag, workflow, production write or capacity added. The paired collector patch remains lead-owned. Two full-suite Flutter failures also receive test-only fixes: boot preference cleanup waits for both getter-triggered quarantine records and joins the journal before deleting its directory; phone-mic safety-copy tests await the actual scheduled drain or durable notification instead of 60/150 ms sleeps. A held-disk completer proves the WAL remains in memory until I/O is released. The canonical targeted app/test.sh run passed 138 protected spine tests plus all eight selected Flutter cases, without a timeout increase or app behavior change. The safe false negative where later complete proof does not upgrade a partial row, and held pages waiting on the existing redrive path, remain follow-ups per lead scope. Includes the test-only shared-main fixture fix from #24195 at 855231d. After #24192 extracted the freshness helper, two test files still patched the router function and returned superseded before their upload-fence assertions. The patch targets the current helper and changes no assertion or production behavior. Independent integration validation passed all 120 cases across the four affected playback test files. Product invariants affected: none (repository selector). UI-Evidence: none Only generated wire DTOs change on clients; there is no UI behavior change. Failure-Class: new Line-Count-Exception: backend/database/conversations.py | 4627 -> 4638 | Preserve coordinator-owned partial receipts across stale processing writes. Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1716 -> 1717 | Carry partial continuation text-preservation authority into the existing transactional assignment.
Git-on-my-level
added a commit
that referenced
this pull request
Nov 1, 2026
## Summary Turns `PLAYBACK_ON_DEMAND_ENABLED` on in **prod**, the graduation David approved on 2026-10-20 (DEC-BTR-004). #24165 added the outcome counter and turned the flag on in dev. With on-demand playback, audio-merge artifacts are built only when someone opens, plays or downloads a conversation, not eagerly on every `/urls` poll. Prod audio-merge attempts are still about 1.1M/day, down from 1.7M after #24192. The pre-10-26 baseline was 0.83M/day. **Approved:** David ruled 2a on 2026-11-01: Plans & Cost flips this off-peak on test evidence, with 24h watches and rollback on the first breach. ## Change - `backend/deploy/runtime_env/prod.overlay.yaml`: `PLAYBACK_ON_DEMAND_ENABLED: 'true'` (rollout) on backend-listen, pusher, backend, backend-sync, backend-sync-backfill and backend-integration, the same six hosts as the dev overlay. - `backend/charts/backend-listen/prod_omi_backend_listen_values.yaml` and `backend/charts/pusher/prod_omi_pusher_values.yaml`: `"true"`. - Composed `runtime_env.yaml` and re-rendered the feature-flag registry. ## Rollout Roll off-peak in the deploy tool's lever order: **listen, then pusher, then the Cloud Run backend train** (backend, backend-sync, backend-sync-backfill, backend-integration). Functionally any order is safe: - The merge handler accepts eager and on-demand tasks. - A host still eager keeps enqueuing as before, so the saving is partial until every host is on. ## Rollback Set `PLAYBACK_ON_DEMAND_ENABLED=false`: revert this PR, or set the overlay value to false and re-roll. Eager playback resumes on the next `/urls` poll. ## 24h watches (rollback on the first breach) Source is Cloud Monitoring `prometheus.googleapis.com/omi_playback_artifacts_total/counter`, written by the backend-sync GMP sidecar (`job=omi-cloud-run-application-metrics`). The in-cluster sync exporter does not import `omi_playback_*`, so read Cloud Monitoring directly. The series appears on the first increment. | Watch | Threshold | |---|---| | `failed_final` + `error` share of on-demand outcomes | < 2% | | `retry` share | not rising hour over hour | | `omi_playback_writes_total` `built` | p95 ≤ 60 s | | Client playback errors | no rise | | Cloud Tasks `audio-merge` attempts | falling toward plays, < 400k/day | | Queue depth | < 10k | | `omi-private-cloud-sync` Class A ops | ≤ 10M/day | ## Expected saving About −$32 to −$83/day (mid −$55), scaled from the 10-31 audio-merge cost basis to ~1.05M removable attempts/day after #24192. ## Tests `backend/test.sh` on the runtime_env validator, pusher config references, playback demand outcomes, playback idempotency, repeat-work cuts, config train, cross-service deploy contract and runtime env render: 22 passed, 3 skipped. Product invariants: INV-MEM-4 (raw audio retained forever; this changes only when derived playback artifacts are built, never source chunks). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Obsolete conversation playback jobs currently retry with HTTP 409 whenever a newer build holds the conversation lock. Check only the current audio metadata on contention and acknowledge a conclusively superseded fingerprint. Current or uncertain jobs retain their retry; eager playback preparation stays enabled.
The optional metadata lookup has a one-second timeout and no SDK retries. A bounded outcome counter distinguishes avoided retries from inconclusive checks. This reduces stale task churn; dollar savings remain unmeasured.
Validation: 114 tests passed across playback idempotency, audio fingerprints, conversation artifacts, merge tasks and playback service. HTTP coverage repeats obsolete requests three times, preserves current-job 409, and covers missing/deleted/invalid metadata and read failures. Independent code review approved.
Failure-Class: none
Failure-Class-Reason: This is a retry-work optimization for conclusively superseded queued revisions; existing source-identity and encoding idempotency protections already hold.
Line-Count-Exception: backend/database/conversations.py | 4619 -> 4627 | Add an optional bounded, no-retry deadline to the existing projected snapshot read so contention checks cannot stall a worker; existing callers retain their behavior.