Skip to content

fix: enforce Telegram 100-command limit with warning (#5787)#15844

Merged
steipete merged 2 commits intoopenclaw:mainfrom
battman21:fix/5787-telegram-commands-limit
Feb 14, 2026
Merged

fix: enforce Telegram 100-command limit with warning (#5787)#15844
steipete merged 2 commits intoopenclaw:mainfrom
battman21:fix/5787-telegram-commands-limit

Conversation

@battman21
Copy link
Contributor

@battman21 battman21 commented Feb 13, 2026

Summary

  • Enforce Telegram's 100-command limit for setMyCommands API
  • When commands exceed 100, truncate and warn instead of silently failing
  • Priority order: native > plugin > custom commands

Fixes #5787

Test plan

  • Gateway starts without BOT_COMMANDS_TOO_MUCH error when >100 commands
  • Warning logged when count exceeds 100
  • No change when under 100 commands

🤖 Generated with Claude Code

Greptile Overview

Greptile Summary

This change introduces a hard cap of 100 commands when registering Telegram bot commands via setMyCommands, and logs a warning when configuration exceeds Telegram’s limit. The command list is built with the intended priority order (native → plugin → custom), then truncated before calling the Telegram API to avoid BOT_COMMANDS_TOO_MUCH.

Within the Telegram channel integration, registerTelegramNativeCommands is the central place where both the advertised command menu (setMyCommands) and the runtime command handlers (bot.command) are set up.

Confidence Score: 4/5

  • Mostly safe to merge, but there is a behavioral inconsistency between advertised commands and registered handlers when over the Telegram limit.
  • The PR correctly avoids Telegram API failure by truncating the setMyCommands payload and warning. However, it leaves command handlers registered for commands that are no longer advertised, which will produce confusing UX and potentially unexpected exposure of commands beyond the first 100.
  • src/telegram/bot-native-commands.ts

Last reviewed commit: 151796f

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 342 to 349
const commandsToRegister = allCommands.slice(0, TELEGRAM_MAX_COMMANDS);

if (commandsToRegister.length > 0) {
withTelegramApiErrorLogging({
operation: "setMyCommands",
runtime,
fn: () => bot.api.setMyCommands(allCommands),
fn: () => bot.api.setMyCommands(commandsToRegister),
}).catch(() => {});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Command list/handler mismatch

setMyCommands is truncated to commandsToRegister, but the subsequent bot.command(...) registrations still iterate over all nativeCommands and pluginCommands. This creates a definite divergence where commands beyond the first 100 remain callable (handlers exist) but won’t show in Telegram’s command UI, which is confusing and makes the warning actionable but behavior inconsistent. Consider limiting handler registration to the same truncated set (or explicitly choosing an ordering/selection for which handlers should remain enabled when over the limit).

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/telegram/bot-native-commands.ts
Line: 342:349

Comment:
**Command list/handler mismatch**

`setMyCommands` is truncated to `commandsToRegister`, but the subsequent `bot.command(...)` registrations still iterate over *all* `nativeCommands` and `pluginCommands`. This creates a definite divergence where commands beyond the first 100 remain callable (handlers exist) but won’t show in Telegram’s command UI, which is confusing and makes the warning actionable but behavior inconsistent. Consider limiting handler registration to the same truncated set (or explicitly choosing an ordering/selection for which handlers should remain enabled when over the limit).

How can I resolve this? If you propose a fix, please make it concise.

@steipete steipete self-assigned this Feb 13, 2026
@openclaw-barnacle openclaw-barnacle bot added channel: telegram Channel integration: telegram size: XS labels Feb 14, 2026
@battman21
Copy link
Contributor Author

Addressed in 546de98 — added a comment clarifying the intentional behavior: the command menu is truncated to 100 (Telegram API limit), but handlers remain registered for all commands so they still work when typed manually. This is the correct behavior since the agent handles commands via natural language regardless of the menu.

battman21 and others added 2 commits February 14, 2026 01:50
Telegram's setMyCommands API rejects requests with more than 100 commands.
When skills + custom + plugin commands exceed the limit, truncate to 100
and warn the user instead of silently failing on every startup.
@steipete steipete force-pushed the fix/5787-telegram-commands-limit branch from 546de98 to 682765e Compare February 14, 2026 00:50
@steipete steipete merged commit 11ab1c6 into openclaw:main Feb 14, 2026
9 checks passed
@steipete
Copy link
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm check && pnpm build && pnpm test
  • Land commit: 682765e
  • Merge commit: 11ab1c6

Thanks @battman21!

steipete added a commit to azade-c/openclaw that referenced this pull request Feb 14, 2026
…penclaw#15844)

* fix: enforce Telegram 100-command limit with warning (openclaw#5787)

Telegram's setMyCommands API rejects requests with more than 100 commands.
When skills + custom + plugin commands exceed the limit, truncate to 100
and warn the user instead of silently failing on every startup.

* fix: enforce Telegram menu cap + keep hidden commands callable (openclaw#15844) (thanks @battman21)

---------

Co-authored-by: Peter Steinberger <[email protected]>
mverrilli pushed a commit to mverrilli/openclaw that referenced this pull request Feb 14, 2026
…penclaw#15844)

* fix: enforce Telegram 100-command limit with warning (openclaw#5787)

Telegram's setMyCommands API rejects requests with more than 100 commands.
When skills + custom + plugin commands exceed the limit, truncate to 100
and warn the user instead of silently failing on every startup.

* fix: enforce Telegram menu cap + keep hidden commands callable (openclaw#15844) (thanks @battman21)

---------

Co-authored-by: Peter Steinberger <[email protected]>
GwonHyeok pushed a commit to learners-superpumped/openclaw that referenced this pull request Feb 15, 2026
…penclaw#15844)

* fix: enforce Telegram 100-command limit with warning (openclaw#5787)

Telegram's setMyCommands API rejects requests with more than 100 commands.
When skills + custom + plugin commands exceed the limit, truncate to 100
and warn the user instead of silently failing on every startup.

* fix: enforce Telegram menu cap + keep hidden commands callable (openclaw#15844) (thanks @battman21)

---------

Co-authored-by: Peter Steinberger <[email protected]>
cloud-neutral pushed a commit to cloud-neutral-toolkit/openclawbot.svc.plus that referenced this pull request Feb 15, 2026
…penclaw#15844)

* fix: enforce Telegram 100-command limit with warning (openclaw#5787)

Telegram's setMyCommands API rejects requests with more than 100 commands.
When skills + custom + plugin commands exceed the limit, truncate to 100
and warn the user instead of silently failing on every startup.

* fix: enforce Telegram menu cap + keep hidden commands callable (openclaw#15844) (thanks @battman21)

---------

Co-authored-by: Peter Steinberger <[email protected]>
jiulingyun added a commit to jiulingyun/openclaw-cn that referenced this pull request Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram: setMyCommands fails with BOT_COMMANDS_TOO_MUCH when skills exceed 100 command limit

2 participants

Comments