fix(telegram): skip empty text replies instead of crashing with GrammyError 400#56620
Conversation
…yError 400 Filter whitespace-only text chunks at the bot delivery fan-in before they reach sendTelegramText(). Covers normal text replies, follow-up text, and voice fallback text paths. Media-only replies are unaffected. message_sent hook still fires with success: false for suppressed empty replies. Fixes openclaw#37278
Greptile SummaryThis PR fixes a GrammyError 400 crash caused by whitespace-only text payloads reaching Confidence Score: 5/5Safe to merge — the fix is minimal, correctly targets all three text delivery paths, and is covered by regression tests. No P0 or P1 issues found. The helper function is well-typed and applied consistently. Empty-chunk handling in sendChunkedTelegramReplyText is already correct (the for-loop simply doesn't execute). Tests cover both the hook-blanking and the whitespace-only input scenarios. No files require special attention.
|
| Filename | Overview |
|---|---|
| extensions/telegram/src/bot/delivery.replies.ts | Adds filterEmptyTelegramTextChunks() and applies it to all three text delivery paths; implementation is correct and consistent. |
| extensions/telegram/src/bot/delivery.test.ts | Updates hook-blanking test to use whitespace content and converts previously-throwing empty-text test to a resolves assertion, accurately covering the new behavior. |
Reviews (1): Last reviewed commit: "fix(telegram): skip empty text replies i..." | Re-trigger Greptile
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
…yError 400 (openclaw#56620) Filter whitespace-only text chunks at the bot delivery fan-in before they reach sendTelegramText(). Covers normal text replies, follow-up text, and voice fallback text paths. Media-only replies are unaffected. message_sent hook still fires with success: false for suppressed empty replies. Fixes openclaw#37278
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
…yError 400 (openclaw#56620) Filter whitespace-only text chunks at the bot delivery fan-in before they reach sendTelegramText(). Covers normal text replies, follow-up text, and voice fallback text paths. Media-only replies are unaffected. message_sent hook still fires with success: false for suppressed empty replies. Fixes openclaw#37278
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
…yError 400 (openclaw#56620) Filter whitespace-only text chunks at the bot delivery fan-in before they reach sendTelegramText(). Covers normal text replies, follow-up text, and voice fallback text paths. Media-only replies are unaffected. message_sent hook still fires with success: false for suppressed empty replies. Fixes openclaw#37278
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
…yError 400 (openclaw#56620) Filter whitespace-only text chunks at the bot delivery fan-in before they reach sendTelegramText(). Covers normal text replies, follow-up text, and voice fallback text paths. Media-only replies are unaffected. message_sent hook still fires with success: false for suppressed empty replies. Fixes openclaw#37278
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
…yError 400 (openclaw#56620) Filter whitespace-only text chunks at the bot delivery fan-in before they reach sendTelegramText(). Covers normal text replies, follow-up text, and voice fallback text paths. Media-only replies are unaffected. message_sent hook still fires with success: false for suppressed empty replies. Fixes openclaw#37278
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
…yError 400 (openclaw#56620) Filter whitespace-only text chunks at the bot delivery fan-in before they reach sendTelegramText(). Covers normal text replies, follow-up text, and voice fallback text paths. Media-only replies are unaffected. message_sent hook still fires with success: false for suppressed empty replies. Fixes openclaw#37278
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
…yError 400 (openclaw#56620) Filter whitespace-only text chunks at the bot delivery fan-in before they reach sendTelegramText(). Covers normal text replies, follow-up text, and voice fallback text paths. Media-only replies are unaffected. message_sent hook still fires with success: false for suppressed empty replies. Fixes openclaw#37278
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
Summary
sendTelegramText()message_senthook still fires withsuccess: falsefor suppressed empty repliesRoot Cause
deliverReplies()inextensions/telegram/src/bot/delivery.replies.tschecked!reply?.text(falsy) but not semantic emptiness. Whitespace-only or hook-blanked replies passed the check and reachedsendTelegramText()→bot.api.sendMessage()→ GrammyError 400: message text is empty.The direct outbound path (
send.ts) and draft preview path already had empty guards. Only bot delivery was missing them.Change Type
Testing
1104 tests pass across 76 Telegram test files. Updated regression tests:
success: falseFixes #37278