#7535: fix(voice-call): queue realtime transcript waiters
channel: voice-call
Cluster:
Voice Call and TTS Improvements
Fixes #5137\n\n- queue concurrent waiters for waitForTranscript()\n- resolve a single waiter per transcript while preserving onTranscript callback\n- add regression test for concurrent waits\n\n## Test plan\n- pnpm vitest extensions/voice-call/src/providers/stt-openai-realtime.test.ts\n- pnpm format\n
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR fixes a concurrency bug in the OpenAI Realtime STT session’s `waitForTranscript()` by replacing the single shared waiter callback with a FIFO queue of pending waiters, and resolving at most one waiter per completed transcript while still invoking the `onTranscript` callback. It also adds a regression test that exercises two concurrent `waitForTranscript()` calls and ensures they resolve in order and do not interfere with `onTranscript`.
<h3>Confidence Score: 4/5</h3>
- This PR looks safe to merge, with one lifecycle edge case to address around closing sessions with pending waiters.
- The core change is a small, well-scoped shift from a single callback to a waiter queue, and the added test covers the reported concurrency scenario. Main remaining concern is that pending waiters are not cleaned up on `close()`, which can leave promises pending until timeout and leak timers in common call flows.
- extensions/voice-call/src/providers/stt-openai-realtime.ts (waiter lifecycle on close/WS shutdown)
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#5499: fix(voice-call): wait for session creation before sending config up...
by lailoo · 2026-01-31
80.6%
#7652: fix(voice-call): fix Telnyx transcription (STT) not working
by tturnerdev · 2026-02-03
73.2%
#8251: fix(voice-call): remove redundant transcript from extraSystemPrompt
by geodeterra · 2026-02-03
73.0%
#18852: fix: Voice-call state persistence is fire-and-forget, causing silen...
by coygeek · 2026-02-17
72.7%
#13881: fix: Address Greptile feedback - test isolation and channel resolution
by trevorgordon981 · 2026-02-11
72.7%
#19073: feat(voice-call): streaming TTS, barge-in, silence filler, hangup, ...
by odrobnik · 2026-02-17
72.6%
#19489: fix(voice-call): add echo suppression for TTS playback
by kalichkin · 2026-02-17
72.6%
#15050: fix: transcript corruption resilience — strip aborted tool_use bloc...
by yashchitneni · 2026-02-12
72.1%
#23572: feat(voice): enable voice note conversation loop for Telegram and W...
by davidrudduck · 2026-02-22
71.7%
#22480: fix: memory leak, silent WS failures, and connection error handling
by Chase-Xuu · 2026-02-21
71.6%