← Back to PRs

#7535: fix(voice-call): queue realtime transcript waiters

by hclsys open 2026-02-02 23:14 View on GitHub →
channel: voice-call
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