Skip to content

Telegram: auto reply threading broken — replyToId not mapped to reply_to_message_id #17880

@dodeja

Description

@dodeja

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 replyTo param via message tool action=send — no threading
  • Workaround found: passing messageId param in the message tool 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 replyToreplyToMessageId, 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:761applyReplyThreading() sets currentMessageId / replyToId
  • dist/pi-embedded-MmRJqJFv.js:53519resolveTelegramReplyId(reply.replyToId)
  • dist/pi-embedded-MmRJqJFv.js:53530 — passes replyToMessageId to sendTelegramText
  • dist/send-BbDRH_ID.js:1440-1444 — applies reply_to_message_id / reply_parameters
  • dist/thinking-BL4QW4f_.js:410 — Telegram default replyToMode is "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 🐾

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions