Skip to content

fix(discord): drain pending voice input before disconnect - #68901

Closed
toomij99 wants to merge 1 commit into
NousResearch:mainfrom
toomij99:codex/discord-voice-drain
Closed

fix(discord): drain pending voice input before disconnect#68901
toomij99 wants to merge 1 commit into
NousResearch:mainfrom
toomij99:codex/discord-voice-drain

Conversation

@toomij99

Copy link
Copy Markdown
Contributor

Summary

  • Drain valid buffered Discord PCM before the shared voice disconnect path tears down the receiver.
  • Route drained utterances through the existing authorization and transcription path.
  • Add regressions for recent, pre-silence audio and disconnect ordering.

Root cause

leave_voice_channel() stopped the VoiceReceiver and cancelled its listener before audio that had not reached the silence threshold could be transcribed.

Validation

  • tests/gateway/test_voice_command.py::TestVoiceReceiver::test_flush_pending_returns_recent_utterance_before_silence
  • tests/gateway/test_voice_command.py::TestDiscordVoiceChannelMethods::test_leave_voice_channel_processes_pending_audio_before_disconnect
  • ruff check plugins/platforms/discord/adapter.py tests/gateway/test_voice_command.py

Baseline note

The focused file currently has four unrelated pre-existing failures in /voice response-text assertions: current code returns localization keys such as gateway.voice.status_mode and gateway.voice.help, while those tests expect English literals. The full run after this change was 185 passed, 4 failed.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins platform/discord Discord bot adapter tool/tts Text-to-speech and transcription labels Jul 21, 2026
@toomij99
toomij99 marked this pull request as ready for review July 21, 2026 20:39
@toomij99
toomij99 marked this pull request as draft July 22, 2026 04:39
@teknium1

Copy link
Copy Markdown
Collaborator

Merged into main via consolidated salvage PR #73517 (merge b8c38a451a). Your pending voice-input drain (receiver.flush_pending() + auth check) before disconnect was cherry-picked with your authorship.

Your contribution is credited to you in git history. Thank you! Closing this PR as merged-via-salvage.

@teknium1 teknium1 closed this Jul 29, 2026
@toomij99

Copy link
Copy Markdown
Contributor Author

Thank you for the salvage and for preserving authorship

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/discord Discord bot adapter tool/tts Text-to-speech and transcription type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants