-
Notifications
You must be signed in to change notification settings - Fork 15.7k
Telegram: threaded conversation support #1597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bc4b512 to
05c82d5
Compare
55cf610 to
a7b13c4
Compare
|
Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: a7b13c4\n- Merge commit: 06a7e1e\n\nThanks @rohannagpal! |
* Telegram: isolate dm topic sessions * Tests: cap vitest workers * Tests: cap Vitest workers on CI macOS * Tests: avoid timer-based pi-ai stream mock * Tests: increase embedded runner timeout * fix: harden telegram dm thread handling (openclaw#1597) (thanks @rohannagpal) --------- Co-authored-by: Peter Steinberger <[email protected]>
|
hi - i'm not technical but i was dealing with a routing issue and this is what my ai agent fixed/suggested: Summary for GitHub Comment What the PR was trying to do: The Bug: Impact: When you send a DM from Telegram/Slack/etc., the main session's routing gets corrupted - messages show as coming from wrong channel, and responses get routed to web UI instead of back to Telegram. Simple fix: Change one line in each channel file: This bug exists in 6 different channel files:
The fix is identical for all channels - just swap route.mainSessionKey to sessionKey in the updateLastRoute call. |
* Telegram: isolate dm topic sessions * Tests: cap vitest workers * Tests: cap Vitest workers on CI macOS * Tests: avoid timer-based pi-ai stream mock * Tests: increase embedded runner timeout * fix: harden telegram dm thread handling (openclaw#1597) (thanks @rohannagpal) --------- Co-authored-by: Peter Steinberger <[email protected]>
|
Hi @rohannagpal! Thanks for this feature 🙌 I'm on 2026.1.24-3 with DM topics fully enabled (BotFather setting on, thread UI visible in Telegram). However, messages from different DM threads still go to the same session (agent:main:telegram:dm: without thread suffix). I checked the gateway logs but don't see any message_thread_id being logged. Is there a way to enable verbose/raw update logging to verify if Telegram is actually sending message_thread_id for DM threads? Any pointers appreciated! |
|
@louzhixian this works for me:
|
|
Thanks a lot! |
|
@e-jung my changes did not touch any of the lines highlighted in your comment. What exactly is the routing issue that you are/were running into? |
|
@rohannagpal Somehow the bot told me that it can see the separated sessions now, thanks! |
|
Yeah the duplicated messages are a pain. Idk what happened, but it just got a lot better for me all of a sudden. Are you seeing the same thing?
From: zhixian ***@***.***>
Date: Monday, 26 January 2026 at 3:53 PM
To: clawdbot/clawdbot ***@***.***>
Cc: Rohan Nagpal ***@***.***>, Mention ***@***.***>
Subject: Re: [clawdbot/clawdbot] Telegram: threaded conversation support (PR #1597)
[https://avatars.githubusercontent.com/u/7994361?s=20&v=4]louzhixian left a comment (openclaw/openclaw#1597)<#1597 (comment)>
@rohannagpal<https://github.com/rohannagpal> Somehow the bot told me that it can see the separated sessions now, thanks!
Btw, any plan to support the drafting message sending api? Messages in threads are duplicated during generating process which is king of annoying 😂
—
Reply to this email directly, view it on GitHub<#1597 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA6S2F2E7QFRKIPIVTEEVFT4IXTJRAVCNFSM6AAAAACSYKKPG2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTOOJYHA2TQMBTGA>.
You are receiving this because you were mentioned.
|
* Telegram: isolate dm topic sessions * Tests: cap vitest workers * Tests: cap Vitest workers on CI macOS * Tests: avoid timer-based pi-ai stream mock * Tests: increase embedded runner timeout * fix: harden telegram dm thread handling (openclaw#1597) (thanks @rohannagpal) --------- Co-authored-by: Peter Steinberger <[email protected]>
Summary
Adds DM thread awareness to Telegram sessions and improves inbound logging to
make DM threads observable and testable.
Why
Adds support for threaded conversations in Telegram.
How
own session context.
session keys.
debugging.
limit parsing.
Tests
pnpm test(Full suite, vm)pnpm test src/telegram/bot-message-context.DM-threads.test.tspnpm test src/telegram/bot.test.tspnpm test src/agents/pi-embedded-runner.get-DM-history-limit-from-session- key.returns-undefined-sessionkey-is-undefined.test.tsManual testing
confirmed distinct sessions in
/statusand differentmessage_thread_idvalues in logs.
message_thread_idwas absent in logs and sessions behaved as a singlethread.
Breaking changes
None.
Changelog
Added entries under
2026.1.23 (Unreleased).AI assistance
/reviewin codex, and skimmedthrough the code.