Skip to content

Telegram forum topic replies not delivered to topic — message_thread_id missing from sendMessage API call #78755

@huntian32

Description

@huntian32

Summary

When replying to messages in a Telegram forum group topic, the reply is processed correctly by the agent but the outbound sendMessage call to Telegram only includes chat_id (the group), omitting message_thread_id (the topic). The message lands in the group's main chat instead of the specific topic, making it invisible to users browsing that topic.

Environment

  • OpenClaw: 2026.5.6 (issue also present on 2026.5.4, 2026.5.4-beta.3)
  • Channel: Telegram polling
  • Group type: Telegram Forum (supergroup with is_forum: true)
  • Config: channels.telegram.groups["-1003759908827"].topics configured with per-topic systemPrompts

Reproduction

  1. Configure a Telegram forum group with topics in openclaw.json:
{
  "channels": {
    "telegram": {
      "groups": {
        "-1003759908827": {
          "requireMention": false,
          "topics": {
            "55": { "systemPrompt": "..." }
          }
        }
      }
    }
  }
}
  1. Send a message in topic 55 from Telegram
  2. Agent receives the message, generates a reply
  3. sessions.json shows correct deliveryContext:
{
  "channel": "telegram",
  "to": "telegram:-1003759908827",
  "accountId": "default",
  "threadId": 55
}
  1. Gateway log shows:
[telegram] sendMessage ok chat=-1003759908827 message=21230

Expected: API call includes message_thread_id: 55 → reply appears in topic 55
Actual: Only chat_id sent → reply appears in group main chat (not visible in topic)

Evidence

  • systemSent: true in sessions.json — Gateway believes it sent successfully
  • lastThreadId: 55 — threadId is tracked in session state
  • deliveryContext.threadId: 55 — correct value in delivery context
  • But the Telegram sendMessage log shows no threadId parameter being passed
  • The reply message (21230) is visible in the group's main chat, not in topic 55

When It Broke

Last successful topic reply: 2026-05-04 15:33 (message 21166)
Around the same time, the active-memory plugin started failing with:

Error: Bundled plugin dirName must be a single directory: -1003759908827:topic:55

The active-memory plugin is now disabled, but the topic delivery issue persists even after:

  • Restarting Gateway
  • Deleting and re-creating the topic 55 session from sessions.json
  • Upgrading from 2026.5.4 → 2026.5.6

Hypothesis

The session delivery path for Telegram forum topics either:

  1. Never correctly mapped threadIdmessage_thread_id for the outbound sendMessage call, OR
  2. A regression somewhere between working state and 2026.5.4 broke the threadId pass-through in the Telegram channel delivery layer

Workaround

None currently. Topic replies are silently lost to the group main chat.

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