Skip to content

fix(discord): wire voice input callback at adapter connect time - #61407

Closed
isheng-eqi wants to merge 3 commits into
NousResearch:mainfrom
isheng-eqi:fix/discord-voice-input-callback-connect
Closed

fix(discord): wire voice input callback at adapter connect time#61407
isheng-eqi wants to merge 3 commits into
NousResearch:mainfrom
isheng-eqi:fix/discord-voice-input-callback-connect

Conversation

@isheng-eqi

Copy link
Copy Markdown
Contributor

Fixes #60623

_voice_input_callback was only set in _handle_voice_channel_join, not at adapter connect or reconnect. Voice transcription was logged but never forwarded as an inbound message without explicit /voice join.

Wire the callback at both connect and reconnect paths.

_voice_input_callback was only set in _handle_voice_channel_join, not at adapter connect or reconnect. Voice transcription was logged but never forwarded as an inbound message without explicit /voice join.

Wire the callback at both connect and reconnect paths.

Fixes NousResearch#60623
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/discord Discord bot adapter sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages P3 Low — cosmetic, nice to have labels Jul 9, 2026
…t tests

PR NousResearch#61407 accesses self._handle_voice_channel_input in _platform_reconnect_watcher. The test mock runner created via _make_runner() must have this attribute.
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for tracing both connection paths. The callback gap is present on current main, but the proposed wiring does not yet make an automatic/programmatic voice join usable end-to-end.

Problems

  • gateway/run.py:12907-12909 returns before dispatch when the guild lacks _voice_text_channels[guild_id]. That binding is only established by the successful /voice join flow at gateway/run.py:12807-12809; DiscordAdapter.join_voice_channel() starts the listener but does not create it (plugins/platforms/discord/adapter.py:2852-2893). The new callback alone therefore still drops transcripts for the path described in the PR.
  • The PR changes startup and reconnect delivery behavior but adds no regression coverage. Current reconnect tests use the generic StubAdapter in tests/gateway/test_platform_reconnect.py:14-74 and do not assert the callback contract.

Suggested changes

  • Define the automatic/programmatic join's text-channel and SessionSource binding, then establish it before voice input can be dispatched.
  • Add startup and reconnect tests that assert callback wiring and a bound transcript reaching the standard handler.

Automated hermes-sweeper review.

- Wire adapter._voice_input_callback at connect and reconnect so voice
  transcription is forwarded without requiring /voice join (NousResearch#60623).
- Add optional text_channel_id and source params to DiscordAdapter
  .join_voice_channel() so automatic/programmatic voice joins can
  establish the text-channel binding needed by _handle_voice_channel_input.
- Add TestVoiceInputCallbackWiring: asserts callback wiring on startup
  and reconnect for Discord adapters with voice attributes.
@isheng-eqi
isheng-eqi force-pushed the fix/discord-voice-input-callback-connect branch from 6c5c3ad to e8a9876 Compare July 10, 2026 17:12
@isheng-eqi

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review! I've addressed both concerns:

  1. Text-channel binding for automatic joins: Added optional text_channel_id and source parameters to DiscordAdapter.join_voice_channel(). When provided, the adapter stores them in _voice_text_channels[guild_id] and _voice_sources[guild_id] — the same binding that /voice join establishes — so automatic/programmatic voice joins can route transcripts through _handle_voice_channel_input without requiring the slash command.

  2. Callback wiring tests: Added TestVoiceInputCallbackWiring with:

    • test_startup_wires_voice_input_callback — asserts _voice_input_callback is set on the Discord adapter during cold-start connect
    • test_reconnect_wires_voice_input_callback — asserts the callback is re-wired after reconnect

Please take another look!

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Jul 11, 2026
teknium1 pushed a commit that referenced this pull request Jul 28, 2026
…t tests

PR #61407 accesses self._handle_voice_channel_input in _platform_reconnect_watcher. The test mock runner created via _make_runner() must have this attribute.
@teknium1

Copy link
Copy Markdown
Contributor

Merged into main via consolidated salvage PR #73517 (merge b8c38a451a). Your _voice_input_callback wiring at start() + reconnect watcher and join_voice_channel(text_channel_id=…) binding were cherry-picked (3 commits) 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
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…t tests

PR NousResearch#61407 accesses self._handle_voice_channel_input in _platform_reconnect_watcher. The test mock runner created via _make_runner() must have this attribute.
prmartinow pushed a commit to prmartinow/hermes-agent that referenced this pull request Aug 26, 2026
…t tests

PR NousResearch#61407 accesses self._handle_voice_channel_input in _platform_reconnect_watcher. The test mock runner created via _make_runner() must have this attribute.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have platform/discord Discord bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord: voice input callback not wired at adapter connect — silent voice until /voice join

3 participants