Bug Description
When using multiple Telegram bot accounts bound to different agents, native slash commands (like /reset, /new) send their confirmation messages to the default account instead of the account that received the command.
Reproduction Steps
- Configure multiple Telegram bot accounts with bindings to different agents:
"accounts": {
"default": { "name": "Jean Luc", "botToken": "..." },
"stealads-builder": { "name": "StealAds Builder", "botToken": "..." }
},
"bindings": [
{ "agentId": "stealads-builder", "match": { "channel": "telegram", "accountId": "stealads-builder" } }
]
- Send
/reset to the stealads-builder bot (non-default account)
- Expected: Only stealads-builder responds with "✅ New session started"
- Actual: Both stealads-builder AND the default bot respond with "✅ New session started"
Root Cause
In src/telegram/bot-native-commands.ts, the ctxPayload passed to finalizeInboundContext is missing the AccountId field:
const ctxPayload = finalizeInboundContext({
// ... other fields
OriginatingChannel: "telegram",
OriginatingTo: \`telegram:\${chatId}\`,
// AccountId is MISSING!
});
When get-reply-run.ts sends the reset confirmation via routeReply:
await routeReply({
accountId: ctx.AccountId, // undefined!
// ...
});
The undefined accountId flows through to resolveTelegramAccount({ accountId: undefined }), which returns the DEFAULT account due to normalizeAccountId() returning "default" for falsy values.
Fix
Add AccountId: accountId to the context payload in bot-native-commands.ts (around line 242):
const ctxPayload = finalizeInboundContext({
// ... existing fields
OriginatingChannel: "telegram",
OriginatingTo: \`telegram:\${chatId}\`,
AccountId: accountId, // ADD THIS LINE
});
The accountId variable is already available in scope from the function parameters.
Verified Fix
We manually patched dist/telegram/bot-native-commands.js and confirmed the fix works - after adding AccountId: accountId, the cross-account message routing no longer occurs.
Environment
- Clawdbot version: 2026.1.24-3
- Multiple Telegram accounts configured with agent bindings
- WSL2 Ubuntu
Workaround
Manually patch dist/telegram/bot-native-commands.js line ~242 to add AccountId: accountId, after the OriginatingTo line, then restart the gateway.
Bug Description
When using multiple Telegram bot accounts bound to different agents, native slash commands (like
/reset,/new) send their confirmation messages to the default account instead of the account that received the command.Reproduction Steps
/resetto thestealads-builderbot (non-default account)Root Cause
In
src/telegram/bot-native-commands.ts, thectxPayloadpassed tofinalizeInboundContextis missing theAccountIdfield:When
get-reply-run.tssends the reset confirmation viarouteReply:The undefined
accountIdflows through toresolveTelegramAccount({ accountId: undefined }), which returns the DEFAULT account due tonormalizeAccountId()returning"default"for falsy values.Fix
Add
AccountId: accountIdto the context payload inbot-native-commands.ts(around line 242):The
accountIdvariable is already available in scope from the function parameters.Verified Fix
We manually patched
dist/telegram/bot-native-commands.jsand confirmed the fix works - after addingAccountId: accountId, the cross-account message routing no longer occurs.Environment
Workaround
Manually patch
dist/telegram/bot-native-commands.jsline ~242 to addAccountId: accountId,after theOriginatingToline, then restart the gateway.