Repository navigation
Description
Summary
Desktop PTT can fail when its realtime/omni path falls back to batch STT because the dev Cloud Run runtime does not reliably own the Parakeet configuration. A separate client-side reconnect race also drops captured mic chunks.
Incident evidence
At 2026-07-10 23:35 UTC, a desktop request to https://api.omiapi.com/v2/voice-message/transcribe returned HTTP 500.
Dev Cloud Run backend logged:
ValueError: HOSTED_PARAKEET_API_URL environment variable is not set
The PTT client called its method named fallBackToDeepgram, but that method invokes the generic batch transcription API. The backend's STT_PRERECORDED_MODEL selected Parakeet, so no Deepgram request was actually made.
Confirmed findings
1. Dev and prod each run a separate Parakeet deployment
Live checks show one available Parakeet replica in each environment:
- dev:
dev-omi-parakeet, dev internal hostparakeet.omiapi.com - prod:
prod-omi-parakeet, prod internal hostparakeet.omi.me
Both environments also have distinct internal-load-balancer reservations.
A direct dev-service probe passed:
GET /health -> { "status": "healthy", "ready": true, "streaming": true }
POST /v1/transcribe (spoken test clip) -> "Omi parakeet health check 123"
During the investigation, the live dev Cloud Run backend was configured with HOSTED_PARAKEET_API_URL=http://parakeet.omi.me. That is the production hostname while the healthy dev service exists. Resolve the intended topology explicitly: dev should use its dev endpoint, or the dev workload should be intentionally retired and the cross-environment dependency documented, tested, and approved.
Relevant configuration:
backend/charts/parakeet/dev_omi_parakeet_values.yamlbackend/charts/parakeet/prod_omi_parakeet_values.yaml
2. Cloud Run configuration is outside the runtime source of truth
backend/deploy/runtime_env.yaml does not declare the Parakeet URL or the STT model-selector settings for Cloud Run. The deploy workflow renders Cloud Run settings from that manifest, and the validator passed while the endpoint was absent.
The current backend-sync Cloud Run service has STT_PRERECORDED_MODEL but no HOSTED_PARAKEET_API_URL. It runs the sync pipeline, which uses the routed prerecorded-STT path, so it can reproduce the same failure.
Relevant code:
backend/deploy/runtime_env.yaml.github/workflows/gcp_backend.ymlbackend/scripts/validate-backend-runtime-env.pybackend/utils/sync/pipeline.pybackend/utils/stt/pre_recorded.py
3. Misconfiguration becomes an opaque HTTP 500
parakeet_prerecorded_from_bytes raises ValueError when its endpoint is missing. The voice-message route catches RuntimeError only, allowing this configuration mistake to escape as a generic 500.
Relevant code:
backend/utils/stt/pre_recorded.pybackend/routers/chat.py
4. Realtime reconnect can lose PTT audio independently of the backend
The desktop log contains 501 instances of:
RealtimeHub[openai]: dropping mic audio because no realtime session owns this turn
This occurs when a voice-seed refresh/reconnect tears down the realtime session after PTT capture begins. RealtimeHubController.feedAudio retains only local LID state and drops provider input when session is nil; it does not buffer and replay that audio when the new session becomes ready. Rapid barge-in replacement can then strand the following turn behind the continuity fence and force the fragile batch fallback.
Relevant code:
desktop/macos/Desktop/Sources/FloatingControlBar/RealtimeHubController.swiftdesktop/macos/Desktop/Sources/FloatingControlBar/PushToTalkManager.swiftdesktop/macos/Desktop/Sources/FloatingControlBar/VoiceTurnStateMachine.swift
Acceptance criteria
- Decide and document the intended dev/prod Parakeet topology. If environments are isolated, dev Cloud Run uses the dev endpoint; do not silently route it to prod.
- Make every Cloud Run service that can run routed prerecorded STT own the needed provider endpoint and model-selector configuration in
backend/deploy/runtime_env.yaml(includingbackendandbackend-sync). - Add runtime validation that rejects a selected Parakeet provider without
HOSTED_PARAKEET_API_URL, across rendered and live Cloud Run state. - Add a safe development smoke test that sends a synthetic spoken clip through the deployed Cloud Run batch-STT path and asserts a successful transcript.
- Convert missing provider configuration into an explicit controlled error; it must not surface as an unhandled generic 500.
- Buffer/replay PTT audio through realtime session replacement/reconnect instead of dropping it; add a hermetic regression test for the no-session transition and rapid barge-in case.
- PTT telemetry/logs identify the actual backend STT provider/model used by the batch fallback, rather than labelling every path “Deepgram.”
Scope
Development-only investigation and repair first. Do not change or deploy production as part of this issue without explicit approval.
Activity
fix(ptt): repair Parakeet dev routing and reconnect audio (#9422)