fix(feishu): transcribe native voice notes - #29295
Conversation
Feishu's "audio" message type is exclusively for in-app voice recordings, but _resolve_normalized_message_type was delegating to _resolve_media_message_type which maps audio/* MIME types to MessageType.AUDIO. gateway/run.py:7605 skips STT for AUDIO, so every voice note sent on Feishu was silently dropped instead of transcribed. Generic audio file uploads in Feishu travel through message_type="file" → preferred_message_type="document", never through the "audio" branch, so returning MessageType.VOICE here is unambiguous. Sibling fix to PR NousResearch#28922 (DingTalk) and PR NousResearch#28918 (Discord) which corrected the same AUDIO-vs-VOICE misclassification on those platforms. Update the existing test to assert MessageType.VOICE and rename it to reflect the invariant it actually guards.
94f07e9 to
bf5c5c5
Compare
- test_extract_audio_type_voice_invariant_regardless_of_mime: pins that message_type='audio' always yields MessageType.VOICE regardless of the downloaded MIME container (AMR, OGG, OPUS, MP4). - test_extract_file_message_audio_mime_stays_audio_not_voice: regression guard confirming that message_type='file' with an audio/* MIME stays MessageType.AUDIO (not VOICE), so generic audio uploads are never silently routed through STT.
|
Thanks for the focused Feishu voice-note fix. Current Problems
Suggested changes
Automated hermes-sweeper review. |
|
Closing as stale target: this PR patches Feishu native voice-note VOICE routing is being salvaged via #29235, which targets the live Thanks @EloquentBrush0x — if anything in your change isn't covered by the salvage noted above, please resubmit against the current plugin adapter. |
Problem
Feishu's
audiomessage type is exclusively for voice notes recorded inthe Lark app — it is never used for generic audio file uploads (those
arrive as
fileormediamessage types instead)._resolve_normalized_message_typeroutedpreferred == "audio"through_resolve_media_message_type, which returnsMessageType.AUDIOfor anyaudio/*MIME type.gateway/run.py:7605explicitly skips STT forMessageType.AUDIO:Result: every Feishu voice note was silently dropped from the
auto-transcription pipeline.
Fix
Return
MessageType.VOICEdirectly in thepreferred == "audio"branchof
_resolve_normalized_message_type. No other branch is affected:fileandmediamessage types map topreferred == "document"andcontinue to resolve via MIME type as before.
Sibling fixes
This is the same AUDIO-vs-VOICE misclassification that was fixed for:
_is_discord_voice_message_attachment)item_type == "voice"check)Feishu's case is simpler: the
audiomessage type at the API level isalready unambiguous — no secondary marker is needed.
Tests
test_extract_audio_message_classified_as_voice— renames theexisting test and corrects its assertion from
"audio"to"voice"(it was asserting the bug).
test_extract_audio_type_voice_invariant_regardless_of_mime— pinsthat the message-level type, not the downloaded MIME type, is
authoritative (AMR, OGG, etc. all produce
MessageType.VOICE).test_extract_file_message_stays_document_not_voice— regressionguard ensuring
filetype messages are unaffected.All 156
tests/gateway/test_feishu.pytests pass (43 skipped — lark_oapi not installed). Ruff clean.Checklist