Skip to content

fix(matrix): accept is_voice kwarg in send_voice to match base class contract - #100679

Open
hermes-gadget wants to merge 1 commit into
NousResearch:mainfrom
hermes-gadget:fix/matrix-send-voice-is-voice-param
Open

hermes-gadget wants to merge 1 commit into
NousResearch:mainfrom
hermes-gadget:fix/matrix-send-voice-is-voice-param

Conversation

@hermes-gadget

Copy link
Copy Markdown

Summary

The base class delivery loop passes is_voice= to adapter.send_voice(), but the Matrix adapter's send_voice() did not accept that keyword argument. This caused a TypeError that silently dropped all audio/TTS attachments on Matrix.

Root Cause

Gateway logs showed:

[Matrix] Delivering 1 non-image MEDIA attachment(s)
[Matrix] Error sending media: MatrixAdapter.send_voice() got an unexpected keyword argument 'is_voice'

The base class at gateway/run.py:24328 calls:

await adapter.send_voice(
    chat_id=event.source.chat_id,
    audio_path=media_path,
    metadata=_thread_meta,
    is_voice=is_voice,
)

But the Matrix adapter's send_voice() signature lacked the is_voice parameter.

Fix

Added is_voice: bool = False to the Matrix adapter's send_voice() signature. The parameter is unused internally since the Matrix adapter handles voice transcoding (to Ogg/Opus for MSC3245) independently — it just needs to accept the kwarg without crashing.

Test Plan

  • Verified TTS voice notes now deliver correctly on Matrix after the fix
  • Voice notes render as voice bubbles (MSC3245) in Element
  • Gateway restart required to pick up the plugin change

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins platform/matrix Matrix adapter (E2EE) P3 Low — cosmetic, nice to have labels Sep 1, 2026
@n30nex

n30nex commented Sep 1, 2026

Copy link
Copy Markdown

🦀 Krab review: Nice root-cause fix—small, contract-correct, and directly tied to the observed TypeError. One worthwhile follow-up would be a focused regression test proving the delivery loop can call the Matrix adapter with is_voice= without raising, so a future signature drift cannot silently drop voice attachments again. Otherwise: lean fix, ship it.

…contract

The base class delivery loop passes is_voice= to adapter.send_voice(),
but the Matrix adapter's send_voice() did not accept that keyword
argument. This caused a TypeError that silently dropped all audio/TTS
attachments on Matrix.

Added is_voice: bool = False to the Matrix adapter's send_voice()
signature. The parameter is unused internally since the Matrix adapter
handles voice transcoding independently — it just needs to accept the
kwarg without crashing.

Rebased onto main after NousResearch#102117 codebase simplification refactor.
@hermes-gadget
hermes-gadget force-pushed the fix/matrix-send-voice-is-voice-param branch from 228589d to 0c6677f Compare September 4, 2026 23:05
@hermes-gadget

Copy link
Copy Markdown
Author

Rebased onto current main after #102117

This PR was originally opened against the pre-refactor codebase. After the massive codebase simplification in #102117 (436K additions / 784K deletions across 2,655 files), the old branch had thousands of conflicts and was stale.

What changed:
Recreated the fix on a fresh branch off current upstream/main. The diff is identical in intent — same 1-line addition to plugins/platforms/matrix/adapter.py:

async def send_voice(
    self, chat_id: str, audio_path: str, caption: Optional[str] = None, reply_to: Optional[str] = None,
    metadata: Optional[Dict[str, Any]] = None,
    is_voice: bool = False) -> SendResult:

Why the fix is still needed:
The refactor decomposed gateway/run.py into many smaller modules, but the base class _deliver_media method (gateway/platforms/base.py:3690) still calls:

result = await self.send_voice(chat_id=chat_id, audio_path=path, metadata=metadata, is_voice=is_voice)

The Matrix adapter inherits _deliver_media (doesn't override it) but its send_voice() override lacks the is_voice parameter, so the TypeError and silent audio drop still occur without this fix.

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/matrix Matrix adapter (E2EE) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants