Description
Telegram DM replies intermittently fail to deliver because OpenClaw caches lastThreadId from incoming messages in the session store, then includes message_thread_id when sending replies. Telegram rejects these with "message thread not found".
Context
- This is a 1:1 DM with a bot (not a group/forum)
- The bot chat does NOT have Topics enabled (it's a regular DM — no option to enable/disable Topics)
- Yet incoming messages from Telegram carry a
message_thread_id field
- OpenClaw caches this as
lastThreadId in sessions.json
- Subsequent replies include
message_thread_id → Telegram API rejects them
The fix in #11620 ("recover proactive sends when stale topic thread IDs are used by retrying without message_thread_id") only covers proactive sends (cron announces, sub-agent results). It does NOT cover normal session replies in the main DM session.
Steps to Reproduce
- Set up a Telegram bot DM
- Send messages — observe
lastThreadId appearing in sessions.json under the main session
- Some replies will fail to deliver to Telegram (visible in OpenClaw web dashboard but never arrive in Telegram)
- Manually deleting
lastThreadId from sessions.json + gateway restart temporarily fixes it, but it gets re-cached from the next incoming message
Observed Session Store
{
"agent:main:main": {
"lastThreadId": 1651,
"lastTo": "telegram:911251122",
"lastChannel": "telegram"
}
}
Expected Behavior
Environment
- OpenClaw: 2026.2.9
- Telegram Bot API
- Chat type: private (1:1 DM with bot)
Workaround
Manually delete lastThreadId from sessions.json and restart gateway. But it gets re-cached from the next incoming message.
Description
Telegram DM replies intermittently fail to deliver because OpenClaw caches
lastThreadIdfrom incoming messages in the session store, then includesmessage_thread_idwhen sending replies. Telegram rejects these with "message thread not found".Context
message_thread_idfieldlastThreadIdinsessions.jsonmessage_thread_id→ Telegram API rejects themRelation to #11620
The fix in #11620 ("recover proactive sends when stale topic thread IDs are used by retrying without message_thread_id") only covers proactive sends (cron announces, sub-agent results). It does NOT cover normal session replies in the main DM session.
Steps to Reproduce
lastThreadIdappearing insessions.jsonunder the main sessionlastThreadIdfrom sessions.json + gateway restart temporarily fixes it, but it gets re-cached from the next incoming messageObserved Session Store
{ "agent:main:main": { "lastThreadId": 1651, "lastTo": "telegram:911251122", "lastChannel": "telegram" } }Expected Behavior
message_thread_idfrom incoming messages should NOT be cached/used for repliesEnvironment
Workaround
Manually delete
lastThreadIdfrom sessions.json and restart gateway. But it gets re-cached from the next incoming message.