-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
Closed
Description
Bug Description
When receiving messages in Telegram DM topics (Topics in Private Chats, Bot API 9.3+), the threadId is NOT saved in the session's deliveryContext.
Impact
- All replies (text, files, media) go to General chat instead of the topic
- Subagent results also go to wrong place
- Any
MEDIA:outputs miss the topic
Root Cause
In Telegram handler, updateLastRoute is called without threadId for DMs:
updateLastRoute: !isGroup ? {
sessionKey: route.mainSessionKey,
channel: "telegram",
to: String(chatId),
accountId: route.accountId
// ❌ Missing: threadId: resolvedThreadId
} : void 0,The resolvedThreadId (from dmThreadId) is available but not passed to updateLastRoute.
Expected Behavior
For DM topics, deliveryContext should contain:
{
"channel": "telegram",
"to": "361216541",
"accountId": "default",
"threadId": "12345678"
}Actual Behavior
deliveryContext is missing threadId:
{
"channel": "telegram",
"to": "telegram:361216541",
"accountId": "default"
}Suggested Fix
Pass threadId to updateLastRoute for DM topics:
updateLastRoute: !isGroup ? {
sessionKey: route.mainSessionKey,
channel: "telegram",
to: String(chatId),
accountId: route.accountId,
threadId: dmThreadId // Add this line
} : void 0,Version
OpenClaw 2026.2.2-3
Steps to Reproduce
- Enable Topics in Private Chats for your bot (
has_topics_enabled: true) - Create a topic in DM with the bot
- Send a message to the topic
- Reply with a file or trigger a subagent
- Observe: response goes to General instead of the topic
Workaround
Currently using explicit threadId parameter in message tool calls, but this doesn't work for automatic replies and subagent results.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels