Repository navigation
feat(playback): turn on-demand playback on in prod - #24215
Merged
Merged
Conversation
Graduates PLAYBACK_ON_DEMAND_ENABLED (DEC-BTR-004) on the six prod hosts and the prod listen and pusher charts. Kill switch: set it false. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
marked this pull request as ready for review
November 1, 2026 05:14
There was a problem hiding this comment.
1 issue found across 5 files
Confidence score: 3/5
prod.overlay.yamlalso enables on-demand playback in staging because staging inherits the production overlay without overriding this key. Add an explicit stagingfalseoverride, or document and validate the intended behavior.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/deploy/runtime_env/prod.overlay.yaml">
<violation number="1" location="backend/deploy/runtime_env/prod.overlay.yaml:44">
P2: This production overlay also enables `PLAYBACK_ON_DEMAND_ENABLED` in staging because staging composes the prod overlay and does not override this key. Add an explicit staging `false` override, or document and validate staging as an intentional part of this rollout.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| env: | ||
| # Graduation of the David-approved on-demand playback (DEC-BTR-004): build playback | ||
| # artifacts on open/play/download only. Kill switch: set false. | ||
| PLAYBACK_ON_DEMAND_ENABLED: {value: 'true', category: rollout} |
There was a problem hiding this comment.
P2: This production overlay also enables PLAYBACK_ON_DEMAND_ENABLED in staging because staging composes the prod overlay and does not override this key. Add an explicit staging false override, or document and validate staging as an intentional part of this rollout.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/deploy/runtime_env/prod.overlay.yaml, line 44:
<comment>This production overlay also enables `PLAYBACK_ON_DEMAND_ENABLED` in staging because staging composes the prod overlay and does not override this key. Add an explicit staging `false` override, or document and validate staging as an intentional part of this rollout.</comment>
<file context>
@@ -39,6 +39,9 @@ overlay:
env:
+ # Graduation of the David-approved on-demand playback (DEC-BTR-004): build playback
+ # artifacts on open/play/download only. Kill switch: set false.
+ PLAYBACK_ON_DEMAND_ENABLED: {value: 'true', category: rollout}
# Replay uses the existing singleton loop; live admission stays inline.
LISTEN_FINALIZATION_REPLAY_ENABLED:
</file context>
Git-on-my-level
added a commit
that referenced
this pull request
Nov 1, 2026
…#24216) Redelivered sync tasks currently warm rollout cohorts even when they cannot run work, and long Dream sweeps hold the fresh Cloud Run fleet. This change removes those no-op cohort reads, carries retry history back from a valid sequencer claim, routes Dream sweeps to backfill, and declares the syncwall capacity/rate cuts. Changes: - Warm cohorts after the locked job's terminal/convergence checks. Stale epochs, migrated deliveries, lock conflicts and terminal cleanup keep their existing outcomes. `begin_job` returns the prior Redis job snapshot in its DB executor leaf; the necessary Redis read remains there, while the separate route executor dispatch disappears. Cohort-only timeouts retain the original queue-owned 409 after a confirmed lock release; uncertain release uses the existing safe continuation. Paid pipeline timeout behavior, run-lock re-reads, retry counts, five attempts and the final terminal check remain authoritative. - Route the production Dream sweep scheduler to backend-sync-backfill with its matching sync-jobs OIDC audience. Keep Dream cadence, drain, canary and behavior intact. - Declare backend-sync max 40 (from 50), keeping min 5, and sync-jobs-fresh rate 15 (from 25), keeping concurrency 160 and retry/backoff settings. Mirror the fresh queue source rate in staging to preserve the existing parity contract. Validation: - Targeted backend CI harness: 1,549 passed across 19 files, one deselected. - Follow-up through the same harness: all 40 tests in the three failed CI guard modules passed after the scope/expectation corrections; 236 adjacent cohort/publication tests also passed. - Final handler contract suite: 206 passed, including cohort-read/budget expiry, direct/sequenced delivery and confirmed/uncertain lock release. - Hermetic sync Cloud Tasks stack: all 11 sync scenarios passed, including real loopback admission/delivery, emulator persistence, Redis fencing, terminal duplicates and retries. Provider leaves are deterministic. - `make preflight`: all 38 selected checks passed, including async/import/runtime-image source closure, Firestore guards, route policies, lifecycle and documentation checks. Rollout is lead-owned. This PR does not apply live settings or deploy. Deploy the worker changes to backend-sync and backend-sync-backfill, reconcile the Dream scheduler, and apply the ops config separately. Review fresh latency/backlog after cap 40 before applying queue smoothing. Restore cap 50/rate 25 or the prior worker revision for rollback. Coordination: #23973 proposes a later retirement cap 20/min 3 and backfill ceiling 10; its cap hunk and sizing test conflict with this intermediate max 40/min 5. Audio-merge is intentionally excluded per the lead's ruling because it has no prod ops entry and #24215 changes its load. The meta-repo sentinel expectation needs a lead update. No listen/pusher env or workflow changes. Cap-hold is deliberately unchanged per the lead's custody ruling. Its sweep still has a 900-second cooperative owner-work budget, plus provider and storage tails, so these requests continue to hold the hot fleet for up to roughly 15 minutes before trailing IO completes. A hard sub-300-second response must not leave paid work exposed to revision retirement; durable request-owned continuation on the same service is deferred follow-up. The background-work ratchet and its baseline remain intact. Failure-Class: none These are performance and scheduling changes; the timeout correction preserves the pre-existing response contract within this unmerged optimization. Existing durable custody, retry and mutation authorities are preserved. No production account data was read or changed. Line-Count-Exception: backend/routers/sync.py | 4147 -> 4166 | Preserve the cohort timeout retry contract with confirmed lock release and shared bounded continuation cleanup. Follow-up validation: the exact CI slow-guardrail harness passed 2,050 tests. The cohort timeout matrix now triggers the established budget context from inside the stub, avoiding tiny real-clock deadlines. Production source is unchanged from Luna R2-reviewed `17411d7b`; lead ruling `237a5e` accepts this test-only follow-up without another review round. Source queue rate 15 does not apply during merge or the normal code train; manual Config Train must wait for the lead's cap-40 peak decision.
…nd-prod # Conflicts: # backend/docs/feature-flag-registry.md
Git-on-my-level
added a commit
that referenced
this pull request
Nov 2, 2026
…24280) ## What prod storage lifecycle gains a second `SetStorageClass` rule: the already-Coldline `chunks/` batch artifacts (`.batch.enc`/`.batch.bin` — the same p76a scope as the Coldline rule) move to **ARCHIVE** at `age: 90`. The validator accepts the new rule shape (ARCHIVE from COLDLINE only, **prod bucket only**, at most one rule per target class, same `chunks/`-only prefix scoping and `age >= 30` floor), and the contract tests pin it. ## Why (cost) ~160 TB sits in Multi-Region Coldline at ~$34/day and grows +$0.12/day (billing export 10-01..11-01, `omi-private-cloud-sync`). Archive is $0.0022/GB-mo vs Coldline $0.007 → the stock falls to ~$11/day, **−$22/day steady (ramping)**. Lifecycle age is creation-based and transitions are asynchronous, so no age strictly *guarantees* a Coldline interval; `age: 90` = 3× the Coldline transition age keeps a real Coldline residency even for lagged transitions, the pre-existing stock (created ≥90d ago) moves on first evaluation, and the 30–90-day Coldline tail ramps in over ~60 days. David approved this move on 2026-11-01 (lead ruling ac0c9b: "Coldline to Archive after playback live"). ## Safety - Same prefix/suffix scope as the Coldline rule — small `.opus.enc` chunks stay Standard, `merged/`, `playback/` and noncurrent rules untouched. - `matchesStorageClass: ["COLDLINE"]` — only objects already in Coldline move; no Standard object can skip to Archive. - **Dispatch gate:** do not dispatch prod `apply` carrying this rule until playback-on-demand (#24215) is live — Archive retrieval is $0.05/GB vs Coldline $0.02/GB, and on-demand playback is the reader that would pay it. Noted in the README next to the existing freeze gate. - Rollback is unchanged: `lifecycle_variant=rollback` drops this rule with the Coldline one (objects already moved stay Archive; reverting class needs a rewrite job). - No `.github/` changes: the rule rides the existing apply/rollback variants. ## Tests `backend/test.sh` with `BACKEND_UNIT_TEST_FILE_LIST=tests/unit/test_storage_lifecycle_contract.py`: 19 passed locally (1.05s). Failure-Class: none UI-Evidence: none -- backend config/validator/tests only, no web/admin/app edits
MichaelC001
pushed a commit
to MichaelC001/omi
that referenced
this pull request
Nov 2, 2026
Adds a second SetStorageClass rule to prod.json moving the already-Coldline chunks/ batch artifacts (.batch.enc/.bin, the same p76a scope) to ARCHIVE at age 60 — at least 30 days after the Coldline transition, so the p76 cadence is unchanged and the existing ~160 TB stock qualifies on first evaluation. David approved the move 11-01 (lead ruling ac0c9b), gated on playback-on-demand (BasedHardware#24215) being live before the prod apply dispatch: Archive retrieval bills $0.05/GB vs Coldline $0.02/GB and on-demand playback is the reader that would pay it. Value: ~$34/day Coldline at-rest falls to ~$11/day (-$22/day steady). Validator: SetStorageClass rules now target COLDLINE (from STANDARD/MULTI_REGIONAL) or ARCHIVE (from COLDLINE only), at most one of each; everything else (chunks/ prefix scoping, age >= 30, no Delete reaching chunks/) unchanged. Contract tests pin the new rule shape and the rollback delta. No workflow changes: the rule rides the existing apply/rollback variants.
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.
Summary
Turns
PLAYBACK_ON_DEMAND_ENABLEDon 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
/urlspoll. 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.yamlandbackend/charts/pusher/prod_omi_pusher_values.yaml:"true".runtime_env.yamland 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:
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/urlspoll.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 importomi_playback_*, so read Cloud Monitoring directly. The series appears on the first increment.failed_final+errorshare of on-demand outcomesretryshareomi_playback_writes_totalbuiltaudio-mergeattemptsomi-private-cloud-syncClass A opsExpected 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.shon 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