-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
Telegram: auto reply threading broken — replyToId not mapped to reply_to_message_id #17880
Description
Bug
Telegram outbound reply threading does not work automatically. The agent's responses are sent as standalone messages rather than threaded back to the user's triggering message.
Expected Behavior
When channels.telegram.replyToMode is set to "all" or "first", outbound agent responses should include reply_to_message_id in the Telegram API call, threading them back to the user's message.
Actual Behavior
replyToMode: "all"configured — no threading on automatic agent responses[[reply_to_current]]tag in response text — no threading- Explicit
replyToparam viamessagetoolaction=send— no threading - Workaround found: passing
messageIdparam in themessagetool does thread correctly
Root Cause (likely)
Field mapping mismatch in the delivery pipeline. The auto-reply pipeline sets replyToId on outbound payloads (via applyReplyThreading in deliver-*.js), but the Telegram send layer in handleTelegramAction reads replyToMessageId (via readNumberParam(params, "replyToMessageId")).
The generic message tool's readTelegramSendParams does map replyTo → replyToMessageId, but when the payload arrives from the auto-reply pipeline, the field is named replyToId — which doesn't match what handleTelegramAction expects.
Meanwhile, the messageId param on the generic message tool does work for threading, suggesting an alternate code path that correctly sets reply_to_message_id.
Code References
dist/deliver-D8pfr6ov.js:761—applyReplyThreading()setscurrentMessageId/replyToIddist/pi-embedded-MmRJqJFv.js:53519—resolveTelegramReplyId(reply.replyToId)dist/pi-embedded-MmRJqJFv.js:53530— passesreplyToMessageIdtosendTelegramTextdist/send-BbDRH_ID.js:1440-1444— appliesreply_to_message_id/reply_parametersdist/thinking-BL4QW4f_.js:410— Telegram defaultreplyToModeis"off"
Environment
- OpenClaw 2026.2.16 (commit
108ebc380) - Telegram desktop app (macOS)
channels.telegram.replyToMode: "all"streamMode: "partial"(edit-based streaming)
Workaround
Use the message tool with explicit messageId param set to the inbound message ID to force threading. Auto-threading from normal agent responses does not work.
Created by Clawd 🐾