#17120: fix: transcribe all Telegram voice messages, not just mention-gated groups
channel: telegram
stale
size: S
trusted-contributor
## Summary
Extends preflight transcription to work for ALL voice messages, not just group messages with mention requirements. This ensures Telegram voice messages in DMs and other non-mention-gated contexts are transcribed before being processed by the agent.
Previously, transcription only ran for group messages where mentions were required (fix #16789). For DMs and non-mention-gated groups, transcription relied on `applyMediaUnderstanding` which may not have been triggered in all cases.
## Changes
- Modified `needsPreflightTranscription` condition in `bot-message-context.ts` to run for all voice messages with no user text, not just group messages with mention requirements
- Added test for direct message voice transcription
## Testing
- All 437 telegram tests pass
- Added new test case for DM voice messages to verify transcription is triggered
Fixes openclaw/openclaw#17101
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Extends preflight audio transcription to all voice messages regardless of chat type or mention settings.
Previously, transcription only ran for mention-gated group messages. The change simplifies the condition from `isGroup && requireMention && hasAudio && !hasUserText && mentionRegexes.length > 0` to just `hasAudio && !hasUserText`, ensuring all audio content (voice messages and audio files) without accompanying text gets transcribed upfront.
- Simplified preflight transcription logic in `bot-message-context.ts:404`
- Added test coverage for DM voice message transcription
- Test suite passes (437 telegram tests)
- Maintains existing behavior: audio with captions is not transcribed during preflight
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change is a straightforward simplification that removes unnecessary conditions from the preflight transcription check. The logic is sound: transcribe audio when there's no user text, regardless of chat type. Test coverage is comprehensive (437 tests passing + new DM test), and the change follows the existing pattern established in previous fixes (#16789). The simplified condition is easier to understand and maintains backward compatibility.
- No files require special attention
<sub>Last reviewed commit: f791bbe</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#17748: fix: transcribe voice messages in Telegram DMs (v2)
by Limitless2023 · 2026-02-16
90.6%
#23067: feat(telegram): add disableAudioPreflight config for groups and topics
by yangnim21029 · 2026-02-22
83.9%
#22940: fix(discord): detect voice messages for preflight transcription bef...
by aldoeliacim · 2026-02-21
81.0%
#23572: feat(voice): enable voice note conversation loop for Telegram and W...
by davidrudduck · 2026-02-22
78.1%
#20155: feat(telegram): add tg-network-guard transcript status + reply flow
by artemgetmann · 2026-02-18
76.5%
#12936: fix(telegram): omit message_thread_id for private DM chats
by omair445 · 2026-02-09
75.0%
#21898: fix(telegram): auto-detect captionable messages for editMessageCaption
by ptrkstr · 2026-02-20
75.0%
#14443: fix(telegram): skip General topic thread ID for all chat types (#14...
by lailoo · 2026-02-12
74.8%
#13389: feat(telegram): support native voice notes with automatic OGG/Opus ...
by leavingme · 2026-02-10
74.5%
#21193: fix(tts): send voice messages as Opus bubbles on Telegram
by aris-katkova · 2026-02-19
74.3%