Repository navigation
fix: preserve live speech across poisoned conversation rows - #24212
Merged
Merged
Conversation
Normalize only null transcript fields and escape repeated pre-commit decoder failures through the existing bounded generation rollover. Retain the full drain on probe failure and keep committed speech out of the new escape. Failure-Class: FC-permanent-write-rejection-retried-forever
…peech Limit poison-row recovery to a typed transcript decoder rejection. Dispatch the displaced generation through the normal lifecycle without stalling speech persistence, including multi-channel sessions. Retry photos without replaying an already committed legacy transcript. Failure-Class: FC-permanent-write-rejection-retried-forever
Only a refused segment commit may enter the existing permanent-write recovery arm. A permanent photo failure must retain photos alone after speech commits. Classify nested JSON recursion as transcript decode failure so both bounded rollover and normal finalization can admit it. Failure-Class: FC-permanent-write-rejection-retried-forever
Git-on-my-level
added a commit
that referenced
this pull request
Nov 1, 2026
…ple cap (#24228) ## Summary Train safety for the GMP sidecar's per-scrape `samples` cap (lead ruling 3d124a). Above the cap, GMP drops the instance's **whole** scrape, not just the new series. Backend Cloud Run max scrape, read-only GMP aggregates (`scrape_samples_scraped`, job `omi-cloud-run-application-metrics`): | Service | Max scrape | Note | |---|---|---| | backend | 9,339 now; 9,873 24h max | 3 instances, median 9,224 | | backend-sync | 7,704 | | | backend-sync-backfill | 6,769 | | | backend-integration | 6,042 | | | desktop-backend | 3,151 | | The next train adds to backend, beyond the write probe: - #24211 stage histogram: 96 - #24223: up to 18, behind a default-off flag - #24214: 2 - #24212: up to 2 That is up to about 118 samples against roughly 127 of headroom. Two changes: 1. **`OMI_FIRESTORE_WRITE_PROBE_ENABLED` kill switch** for the #24218 write probe. It is on unless the literal `false`. Off means `database._client` never wraps the transport, so no labelled write series exist in that process. That leaves 2 unlabelled counter samples. It is registered in `config/feature-flags.yaml` as `ops_kill`, and the registry doc is re-rendered. 2. **Shared Cloud Run sidecar cap 10,000 → 15,000** (`backend/deploy/cloud_run_gmp_sidecar.yaml`: backend, desktop-backend, notifications-job). Today backend is about 1% from losing all metrics on any new series; this restores headroom. GMP bills per sample emitted, so the cap itself costs nothing. The sync sidecar (`cloud_run_gmp_sync.yaml`, max 7,704) is unchanged. Series behaviour: - **Write probe series are per instance.** They grow with code-path diversity (distinct caller × collection × op an instance has executed, capped), not with write volume. - **At batch 100%**, instance count may grow and each instance sees more batch callers. Per-instance cardinality rises toward the caps, not with load. Recommended for the train: merge this. If the cap raise is not wanted in this train, set `OMI_FIRESTORE_WRITE_PROBE_ENABLED=false` on backend Cloud Run only. Sync, listen and pusher keep the probe. ## Product invariants affected none. Observability config only; no data path. ## Verification All runs used `backend/test.sh` under `bin/omi-heavy` + `nice -n 19`, at the unit layer: - `test_firestore_write_probe.py`: 16 passed, including the kill switch (literal `false` and ` FALSE ` leave `FirestoreClient.commit` unwrapped; unset, empty, `true`, `0`, `off` stay on). - The other tests that read the sidecar config: `test_attach_cloud_run_gmp_sidecar` (117), `test_external_list_cache`, `test_fleet_deployment`, `test_parakeet_request_metrics`, `test_relevance_metric_is_scraped`, `test_sync_absorption_metrics`. All pass. - `scripts/check_feature_flag_registry.py`: OK. ## Rollback Set the switch to `false` on any service, or revert. The cap can return to 10,000 only if the max scrape is well below it. Failure-Class: none 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/24228?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/24228?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24228&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.
Legacy live transcription can retry a stored conversation forever when its transaction decoder rejects the transcript field. Buffered speech can then be lost on disconnect, especially with custom STT and no server audio custody. Explicit null/absent transcript segments now merge as empty; other malformed shapes and encodings remain fail closed and raise a specific
TranscriptSegmentsDecodeError.Only five consecutive pre-commit transcript decoder failures on the same conversation earn the existing bounded generation escape (at most once per 60 seconds). Unrelated validation, replay-receipt, and absorption failures reset the streak. Failed, cancelled, or unchanged-owner probes keep the entire pristine drain queued. The existing oversized handling, v2 dispatch, and batch-only routing are unchanged.
reason=logs retain the fixed allowlist.After ownership moves, the real conversation controller dispatches the displaced row through its existing
process_conversationand finalization lifecycle in a tracked background task, for both single-channel and multi-channel sessions. This task survives socket teardown and does not block new speech persistence. Normal finalization and episode processing policies remain authoritative; the escape does not repair corrupt stored speech or force an episode boundary.The legacy segment transaction's commit is also the speech retry boundary: a subsequent photo false-return or exception retries photos without replaying already committed speech on a fresh generation. This includes permanent photo-write rejection: only pre-commit faults enter the existing permanent-write classifier. Post-commit reply failures and cancellation likewise cannot requeue that committed text. Deeply nested JSON recursion is classified as a transcript decoder failure, including at normal lifecycle content admission.
Validation (local synthetic data; no production access):
nice -n 19 /Users/dazheng/workspace/omi/bin/omi-heavy run -- env BACKEND_PYTEST_WORKERS=4 BACKEND_UNIT_TEST_FILE_LIST=/Volumes/Ephemeral/scratch/persistfix2/unit-files.txt bash backend/test.sh. Covers the strict transaction, complete retained speech, unrelated ValueErrors, real controller creation/finalization handoff in both channel modes (dict and deeply nested JSON failures), nonblocking finalization after transcript teardown, false/transient/permanent photo failures after a real commit, existing oversized recovery, replay and lifecycle suites.test_transcript_strict_decode.py,test_late_audio_reply.py, andtest_listen_process_pending_shutdown.py, through the same targeted backend harness withadditional-files.txt.fa77582a3adb5b531e5852562211aea82bc75f63vianice -n 19 /Users/dazheng/workspace/omi/bin/omi-heavy run -- backend/testing/listen_pusher_stack/run.sh --keep --state-dir /Volumes/Ephemeral/scratch/persistfix2/stack-reviewed-final. This measures local endpoint/lifecycle behavior, not deployed behavior.make preflight: passed atfa77582a3adb5b531e5852562211aea82bc75f63undernice -n 19/omi-heavy.Deployment: lead-owned listen roll, off-peak only (outside 13–22Z). No backend/listen/pusher deployment, flag change, historical repair, or account-data mutation is part of this lane. No GCP tier used.
Failure-Class: FC-permanent-write-rejection-retried-forever
Line-Count-Exception: backend/database/conversations.py | 4638 -> 4649 | Null-only normalization and a typed strict-decoder failure preserve the transaction boundary and fail-closed authorization.
Line-Count-Exception: backend/routers/listen/transcripts.py | 1744 -> 1817 | Bound decoder-only generation recovery and distinguish committed speech from photo retry before every legacy speech recovery path.
Line-Count-Exception: backend/routers/listen/conversations.py | 1065 -> 1082 | Dispatch displaced-row finalization through the existing lifecycle after decoder recovery changes ownership, including multi-channel sessions.