Repository navigation
fix(discord): prevent voice replies from cutting off during playback - #130346
Merged
Merged
Conversation
Preserve realtime PCM through normal backpressure and release queued speech only after the Discord player finishes. Tolerate brief provider stalls, remove the STT/TTS completion deadline, and settle playback immediately on terminal session shutdown.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 27, 2026
…penclaw#130346) * fix(discord): prevent voice replies from cutting off during playback Preserve realtime PCM through normal backpressure and release queued speech only after the Discord player finishes. Tolerate brief provider stalls, remove the STT/TTS completion deadline, and settle playback immediately on terminal session shutdown. * test(discord): remove unused playback test bindings
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.
What Problem This Solves
Fixes an issue where Discord voice replies cut off mid-sentence when the realtime provider generates audio faster than Discord plays it. Redacted production diagnostics captured four replies with 6.8–7.2 seconds of generated audio being stopped after only 1.18–1.36 seconds, even with barge-in disabled. Queued answers could also start before previous playback finished, brief provider stalls could stop the player, and STT/TTS responses had a fixed one-minute completion deadline.
Why This Change Was Made
Discord's playback owner now retains a bounded audio queue, respects writable backpressure, and ends the source only after its queued tail drains. Actual player Idle owns normal completion and releases the next exact-speech answer; provider completion and encoder closure do not. This removes the artificial backpressure cancellation state and its cancellation-race handling.
Realtime players tolerate up to two seconds of missing frames, with a three-second playback watchdog margin and progress-aware draining. STT/TTS playback retains its bounded startup timeout but waits for actual completion, while session shutdown force-stops buffered resources and cancels both startup and completion waits. Pipeline failures release queued speech through the same playback owner. No public config keys, dependencies, persistence, or SDK contracts are added.
User Impact
Discord voice replies finish speaking across normal buffering and brief provider gaps, queued answers no longer replace unfinished speech, and long STT/TTS replies can finish without a one-minute cutoff. Intentional interruption and session shutdown still stop audio promptly. Pending realtime audio remains capped at two minutes, with a visible terminal error on genuine overflow.
Evidence
audioMs=6800 elapsedMs=1230 chunks=17, followed byoutput-backpressureand forced response cancellation despite barge-in being disabled. Host, account, channel, and transcript details are omitted.The production bot runs an immutable remote deployment. This PR does not replace or restart that operator-owned gateway; post-change channel listening remains a deployment verification step. The regression uses the real encoder/player boundary, and the production logs establish that its burst matches the observed failure.
Production code: +125 / −133 (net −8). Tests and test support: +450 / −130 (net +320), including extraction of the existing batch-playback case into its owning suite. Documentation: +6 / −2.