Skip to content

fix: Feishu voice messages routed to VOICE for STT; .ogg added to nat… - #38299

Closed
bujinyun wants to merge 1 commit into
NousResearch:mainfrom
bujinyun:fix/feishu-voice-stt
Closed

fix: Feishu voice messages routed to VOICE for STT; .ogg added to nat…#38299
bujinyun wants to merge 1 commit into
NousResearch:mainfrom
bujinyun:fix/feishu-voice-stt

Conversation

@bujinyun

@bujinyun bujinyun commented Jun 3, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes Feishu voice messages not being auto-transcribed by the STT pipeline. Two changes:

  1. feishu.py: Feishu's audio message type was mapped to MessageType.AUDIO (audio file attachment), which skips STT transcription. In Feishu's API, audio IS a voice message - there is no "audio file attachment" concept (files use file type). Changed to MessageType.VOICE so voice messages trigger auto-transcription.

  2. transcription_tools.py: Added .ogg to LOCAL_NATIVE_AUDIO_FORMATS. Feishu sends voice as .ogg, which faster-whisper supports natively, but the format was missing from the native list, causing unnecessary ffmpeg dependency.

Type of Change

  • Bug fix

Changes Made

  • gateway/platforms/feishu.py:3617 - MessageType.AUDIO -> MessageType.VOICE for audio messages
  • tools/transcription_tools.py:99 - Added .ogg to LOCAL_NATIVE_AUDIO_FORMATS

How to Test

  1. Send a voice message from Feishu to a Hermes bot
  2. Before fix: voice arrives as file attachment, no STT transcription
  3. After fix: voice is auto-transcribed and text appears in chat

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter tool/tts Text-to-speech and transcription labels Jun 3, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for identifying the Feishu STT routing gap. Current main confirms the core issue: plugins/platforms/feishu/adapter.py:3822 resolves normalized audio as AUDIO, and gateway/run.py:10416-10422 excludes that type from STT.

Problems

  • The proposed unconditional VOICE mapping loses the existing audio-file distinction. gateway/run.py:10414-10422 explicitly treats AUDIO attachments as non-STT, and the Feishu adapter sends audio as a file attachment at plugins/platforms/feishu/adapter.py:2158-2175.
  • The diff also adds .silk and pilk work outside the stated scope. Adding .silk to global validation affects every provider (tools/transcription_tools.py:1022-1036), while only the local path converts it.
  • No regression tests cover Feishu audio-vs-voice classification or local OGG preparation.

Suggested changes

  • Port the fix to plugins/platforms/feishu/adapter.py and classify only verified voice-note inputs as VOICE; retain AUDIO for file attachments.
  • Add resolver/STT-path tests for both cases, plus an OGG local-STT regression test.
  • Split or complete the separate SILK support.

Automated hermes-sweeper review.

return self._resolve_media_message_type(media_types[0] if media_types else "", default=MessageType.PHOTO)
if preferred == "audio":
return self._resolve_media_message_type(media_types[0] if media_types else "", default=MessageType.AUDIO)
return MessageType.VOICE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please retain a discriminator here rather than classifying every Feishu audio event as VOICE: current gateway routing deliberately keeps MessageType.AUDIO attachments out of STT (gateway/run.py:10414-10422). This needs coverage for both a native voice note and an ordinary audio-file attachment.

SUPPORTED_FORMATS = {".mp3", ".mp4", ".mpeg", ".mpga", ".m4a", ".wav", ".webm", ".ogg", ".aac", ".flac"}
LOCAL_NATIVE_AUDIO_FORMATS = {".wav", ".aiff", ".aif"}
SUPPORTED_FORMATS = {".mp3", ".mp4", ".mpeg", ".mpga", ".m4a", ".wav", ".webm", ".ogg", ".aac", ".flac", ".silk"}
LOCAL_NATIVE_AUDIO_FORMATS = {".wav", ".aiff", ".aif", ".ogg"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding .silk to this global validation set affects cloud-provider dispatch too, but the new conversion exists only in _transcribe_local. Please split this unrelated capability or normalize it consistently for every provider that can receive an accepted .silk file.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Closing as stale target: this PR patches gateway/platforms/feishu.py, which was deleted when the platform adapters were rewritten as plugins — the live code now lives in plugins/platforms/*/adapter.py, so this diff can no longer apply.

The Feishu VOICE-routing half is covered by the #29235 salvage against the live plugin adapter, and the .ogg STT-format half by the #43371 salvage (SUPPORTED_FORMATS additions) — both in the upcoming Feishu/inbound-audio salvage.

Thanks @bujinyun — if anything in your change isn't covered by the salvage noted above, please resubmit against the current plugin adapter.

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

Labels

P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages 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