Repository navigation
Description
Problem
The July 12 incident in #9548 made Cloud Run callers reach the HTTP-only Parakeet ILB with https://. Voice-message transcription was functionally unavailable for roughly eight hours, but callers could return HTTP 200 with an empty transcript. Grafana showed downstream Parakeet traffic disappearing; Parakeet 5xx and generic HTTP success did not represent the customer outcome.
This is a broader contract problem, not only an endpoint-scheme typo:
backend/routers/chat.pyreturns{"transcript": transcript or ""}on batch and multipart transcription paths.backend/utils/chat.pycatches voice-message transcription failures and can end the SSE response without an explicit error event.backend/utils/stt/pre_recorded.pymaps an upstream response with neither segments nor text to an empty result.backend/routers/transcribe.pycan detect a dead live STT socket, clear audio, and keep the client WebSocket open without a structured terminal/recovery signal.
A genuine no-speech result is valid. Provider timeout, malformed output, configuration failure, and a dead live-STT connection are not. They must not be indistinguishable to the client, fleet telemetry, or production alerting.
The static URL-contract guard added by #9549 is necessary and should remain, but it cannot prove production topology, provider reachability, model routing, response parsing, or customer-visible semantics.
Scope
Create one explicit, cross-route transcription-outcome contract and use it for API behavior, low-cardinality metrics, end-to-end synthetics, deploy gating, and alerting. Cover pre-recorded voice messages/uploads, sync callers, and live /v4/listen failure signaling. Do not redesign durable conversation finalization; that remains #9453.
Proposed deliverables
1. Typed outcome contract
Define and document a small outcome vocabulary at the backend response boundary:
success— eligible audio produced non-empty normalized text.expected_silence— explicit speech/length gate determined that no transcript is expected.empty_unexpected— eligible audio produced no text.timeout,upstream_error,config_error,invalid_input— distinct failure classes.
Return a distinguishable retryable failure or structured final SSE error for provider/config failures. Keep true no-speech behavior separate and backward-compatible where required.
For /v4/listen, terminal STT death must result in a machine-readable recovery/failure state: bounded reconnect with explicit state, or a visible service-unavailable terminal event. Never leave a client session open while silently dropping transcribable audio.
2. Customer-journey telemetry
Emit a low-cardinality completion counter and latency histogram, e.g.:
omi_voice_transcription_completed_total{
route, provider, outcome, deployment_version, client_platform
}
omi_voice_transcription_latency_seconds_bucket{route, provider, outcome, ...}
No UID, request ID, audio, transcript, filename, or high-cardinality raw language label may be included.
Instrument accepted audio, completion outcome, and live-session audio-to-transcript divergence so 200-empty outcomes are measurable. PostHog/client events may support blast-radius diagnosis, but are not paging authority.
3. Production-safe capability synthetics and release gate
Add an authenticated canary probe from the production VPC using a fixed synthetic spoken-audio fixture and a known normalized phrase assertion. It must exercise:
Cloud Run caller -> selected provider -> VPC/ILB -> Parakeet -> parser -> API response
Add a lower-level direct Parakeet probe for diagnosis. The full-route probe is the paging authority.
Integrate the same probe into candidate Cloud Run deployment promotion before traffic shift. Preserve static runtime-env validation; this is an additional behavior/capability gate.
4. Alert and dashboard contract
Create alerts from semantic outcomes rather than HTTP status alone:
- critical: two E2E failures within 10 minutes;
- critical: zero successful eligible transcriptions for 10 minutes while eligible attempts exist;
- critical/degraded: qualifying failure ratio and absolute-count thresholds with volume gates;
- separate probe-telemetry absence from product failure.
Create or extend an incident dashboard showing synthetic state/age, eligible success rate, failures by route/provider/revision, attempt volume, current serving revision, and links to dependency views.
Acceptance criteria
- A provider timeout, malformed/empty upstream result, and bad configuration are observably different from
expected_silencein API/SSE behavior and metrics. - Eligible audio never silently becomes a blank successful result because the provider/configuration failed.
- A dead
/v4/listenSTT socket produces an explicit recovery or terminal failure signal; an E2E fault test proves it. - Metrics distinguish route, provider, outcome, deployment version, and client platform without sensitive/high-cardinality labels.
- A production-VPC synthetic proves known audio becomes known non-empty text through each selected critical route; two failures within ten minutes create an actionable page.
- Candidate deployment promotion runs the same capability check before serving production traffic and records revision plus redacted result.
- Alerts use outcome/volume semantics and do not rely only on LB 5xx, traffic, or pod readiness.
- Tests cover genuine silence, timeout, provider 5xx, bad/empty provider payload, config error, and live socket death.
- Existing fix(backend): use http:// for parakeet ILB URL in Cloud Run services #9549 endpoint-scheme guard remains covered; no static rule is weakened.
Grounded references
- Fix HOSTED_PARAKEET_API_URL: https → http for Cloud Run services #9548 / fix(backend): use http:// for parakeet ILB URL in Cloud Run services #9549 — July 12 HTTP-vs-HTTPS Parakeet ILB incident and targeted static guard.
- Fix parakeet internal LB timeout mismatch causing ~15% 504 failures #8736 — earlier Parakeet ILB/client timeout mismatch; same route-contract failure class.
- Desktop PTT: fix Parakeet runtime drift and reconnect audio loss #9417 — dev/prod Parakeet routing and reconnect audio loss.
- Durable conversation finalization: Cloud Tasks job seam so listen conversations cannot stay stuck in_progress/processing #9453 — durable finalization is related but separately scoped.
backend/routers/chat.pybackend/utils/chat.pybackend/utils/stt/pre_recorded.pybackend/routers/transcribe.pybackend/scripts/product_capability_synthetics.pybackend/scripts/validate-backend-runtime-env.py
Safety / agent notes
- Do not include production credentials, raw audio, transcript text, UIDs, request identifiers, or private dashboard URLs in code, fixtures, logs, metrics, or issue comments.
- Use synthetic/non-user audio only. Canary identity must be isolated, rate-limited, and excluded from user analytics where appropriate.
- Public checks should work with fakes or return explicit
SKIP_NO_CREDENTIALS/NOT_RUNwhen production-only execution is unavailable. - Production deploys, traffic shifts, alert/contact-point changes, and status-page updates require separate maintainer approval.
Activity
fix(transcription): retain failed audio and surface live STT errors (#…