Skip to content

[Bug] Cron delivery.announce fails in Telegram DMs: message_thread_id=1 regression #12625

@ademnex-ui

Description

@ademnex-ui

Bug Description

All cron job deliveries fail in Telegram DMs with:

GrammyError: Call to 'sendMessage' failed! (400: Bad Request: message thread not found)

Environment

  • OpenClaw: 2026.2.6-3
  • Channel: Telegram (DM, not group/forum)
  • Cron: isolated session + delivery.announce

Root Cause

Related to #10926. Commit 19b8416a8 introduced a regression where message_thread_id=1 is sent to Telegram API for DM chats. The fix in buildTelegramThreadParams() only skips thread_id=1 when scope === "forum", but DMs have scope === "dm".

What I tried (hotfixes, none worked)

  1. Patched buildTelegramThreadParams() in all 3 dist files (extensionAPI.js, reply-B_4pVbIX.js, loader-n6BPnYom.js) to skip thread_id=1 unconditionally
  2. Patched subagent-announce.ts to skip threadId="1" in callGateway params
  3. Tried delivery.bestEffort: true
  4. Tried sessionTarget: main + systemEvent

None resolved the issue because the thread_id appears to be injected at the gateway routing layer, after these functions.

Reproduction

{
  "schedule": {"kind": "at", "at": "<2min-from-now>"},
  "payload": {"kind": "agentTurn", "message": "test", "model": "haiku"},
  "sessionTarget": "isolated",
  "delivery": {"mode": "announce", "channel": "telegram", "to": "<dm-chat-id>"}
}

Expected

Message delivered to Telegram DM.

Actual

Infinite retries, each failing with thread_not_found. Sub-agent runs 20+ times burning tokens.

Impact

  • All cron notifications to Telegram DMs are broken
  • Each failed cron spawns 20+ retry sessions (token waste)
  • Only workaround: sub-agent uses message tool directly with chatId (unreliable, causes spam)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions