Skip to content

fix(telegram): raise command menu cap from 30 to 100 so plugin commands appear - #33484

Closed
liuhao1024 wants to merge 2 commits into
NousResearch:mainfrom
liuhao1024:fix/telegram-plugin-command-menu-cap
Closed

fix(telegram): raise command menu cap from 30 to 100 so plugin commands appear#33484
liuhao1024 wants to merge 2 commits into
NousResearch:mainfrom
liuhao1024:fix/telegram-plugin-command-menu-cap

Conversation

@liuhao1024

@liuhao1024 liuhao1024 commented May 27, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Raise MAX_COMMANDS_PER_SCOPE from 30 to 100 so that plugin slash commands appear in the Telegram bot menu.

Related Issue

Fixes #33480

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • gateway/platforms/telegram.py: Raise MAX_COMMANDS_PER_SCOPE from 30 to 100; update comment; fix hardcoded 30 in log message to reference MAX_COMMANDS_PER_SCOPE
  • tests/hermes_cli/test_commands.py: Add regression test test_plugin_commands_survive_hundred_command_cap

How to Test

  1. Run pytest tests/ -q — all tests should pass
  2. Verify the specific scenario described above is resolved

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 26.4.1

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture and workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A

Code Intelligence

  • Analyzed: gateway/platforms/telegram.py:MAX_COMMANDS_PER_SCOPE (callers: 2 — set_my_commands at line 1579, _ensure_forum_commands at line 4784)
  • Analyzed: hermes_cli/commands.py:telegram_menu_commands (default max_commands=100, priority logic in _prioritize_telegram_menu_commands)
  • Blast radius: LOW — constant change only affects Telegram menu registration, no core logic
  • Related patterns: _TELEGRAM_MENU_PRIORITY (22 built-in commands at priority 0), _prioritize_telegram_menu_commands (sorts by priority)

Checklist

  • Tests pass (TestTelegramMenuCommands — 8/8 passed)
  • Regression test added
  • Diff scoped to 2 files only
  • No unrelated changes

…ds appear

Fixes NousResearch#33480

MAX_COMMANDS_PER_SCOPE was hardcoded to 30, which caused all plugin
slash commands to be truncated from the Telegram bot menu.  Built-in
commands fill 22 priority-0 slots, leaving only 8 for remaining
commands — plugin commands (priority 1) were always pushed out.

Telegram's Bot API officially supports up to 100 commands via
setMyCommands.  Raise the cap to 100 so plugin and skill commands
are included in the menu alongside built-ins.

Also fixes the log message to reference MAX_COMMANDS_PER_SCOPE instead
of the hardcoded literal 30.
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have labels May 27, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for isolating the Telegram command-menu truncation problem.

Automated hermes-sweeper review found this is already implemented on current main through a broader, configurable solution:

  • dbe14ce35 added platforms.telegram.extra.command_menu.max_commands, clamped to 1..100, plus configurable command priority.
  • d4be583d9 raised the safe default cap from 30 to 60 while preserving the payload-size safeguard; users can still set 100 when appropriate.
  • plugins/platforms/telegram/adapter.py:2936-2945 uses that configuration for normal scopes, and :7484-7487 uses it for forum scopes.
  • tests/hermes_cli/test_commands.py:1250-1283 covers a configured plugin command surviving even a 30-command cap.

The PR's target was also relocated from gateway/platforms/telegram.py to the bundled Telegram platform adapter. Closing as implemented on main.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/telegram Telegram bot adapter sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Plugin slash commands truncated by 30-command cap in Telegram menu

3 participants