-
-
Notifications
You must be signed in to change notification settings - Fork 69k
[Bug]: Multi-agent Telegram: /new command sends "New session started" to wrong bot #2537
Description
Summary
When running multiple Telegram bot accounts bound to different agents, the /new command sends the "New session started" confirmation message via the wrong bot. The native command handler in bot-native-commands.ts creates a context without AccountId, causing the reply to fall back to the first/default account instead of the one that received the command.
Steps to reproduce
- Configure two Telegram accounts with different bot tokens, each bound to a different agent
- Start the gateway with both bots running
- Send /new to bot A
Expected behavior
The "✅ New session started" message appears in the chat with bot A (the bot that received the /new command).
Actual behavior
The "✅ New session started" message appears in the chat with bot B (a different bot).
Environment
- Clawdbot version: 2026.1.25
- OS: Linux (Debian 13)
- Install method: pnpm (local dev)
Logs or screenshots
Debug trace showing accountId=undefined when sending the reset confirmation:
[DEBUG reset] channel=telegram to=telegram:8368358784 accountId=undefined sessionKey=agent:sam-silver:main
[DEBUG send] opts.accountId=undefined resolved.accountId=eugene-silver resolved.tokenSource=config
Fix
Root cause: src/telegram/bot-native-commands.ts line ~444 creates context without AccountId. Fix is to add AccountId: route.accountId to the context payload, matching how bot-message-context.ts handles regular messages.