#14991: fix(telegram): deduplicate skill commands by skillName to prevent BOT_COMMANDS_TOO_MUCH
channel: telegram
stale
size: S
Cluster:
Skill Command Deduplication
## Summary
- Deduplicate skill commands by `skillName` in `registerTelegramNativeCommands` before building the Telegram menu — when multiple agents load the same skill, `listSkillCommandsForAgents()` appends `_2`/`_3`/`_4` suffixes that inflate command count beyond Telegram's 100-command limit
- Only the first occurrence of each skill is registered; duplicate entries from other agents are dropped
- `listSkillCommandsForAgents()` itself is untouched — other channels (Slack, Discord) and internal routing are unaffected
Fixes #5787, #10875, #14737.
## Test plan
- [x] New test: verifies `bird_2`, `bird_3`, `notion_2` are filtered out, only `bird` and `notion` registered
- [x] New test: 120 entries (30 skills × 4 duplicates) dedup to 30 — no truncation warning triggered
- [x] Existing 3 tests continue to pass (binding scoping, unscoped, truncation)
- [x] `pnpm check` passes (formatting, type check, lint)
- [ ] Manual: restart gateway, confirm `getMyCommands` returns unique commands without suffixes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates Telegram native command registration to deduplicate skill-based commands by `skillName` before building the `/` command menu. This avoids the `listSkillCommandsForAgents()` suffixing behavior (`_2`, `_3`, …) inflating the command count and triggering Telegram’s 100-command limit error (`BOT_COMMANDS_TOO_MUCH`).
The change is localized to `registerTelegramNativeCommands` in `src/telegram/bot-native-commands.ts` and adds tests in `src/telegram/bot-native-commands.test.ts` to ensure duplicate skill entries are filtered and that deduplication prevents unnecessary truncation warnings. Other channels and the underlying skill command listing logic are unchanged.
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with low risk.
- The change is small and localized (Telegram menu building only), and the dedup key (`skillName`) is a required string type. Added tests directly cover the new behavior and the max-command-limit interaction. I couldn’t execute the test suite in this environment due to missing pnpm, so confidence is slightly reduced.
- src/telegram/bot-native-commands.ts (dedup behavior in production); src/telegram/bot-native-commands.test.ts (ensure tests pass in CI)
<sub>Last reviewed commit: 50a99c9</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#19164: fix(discord): dedupe native skill commands across agents by skill name
by seewhyme · 2026-02-17
87.1%
#17062: fix(telegram): prioritize workspace skills over bundled in native c...
by scout-wolfe · 2026-02-15
85.1%
#11240: Fix #10875: Clear Telegram commands before registering to prevent d...
by divol89 · 2026-02-07
84.7%
#6457: fix(telegram): register commands for group scope + preserve topic t...
by dae-sun · 2026-02-01
79.4%
#11132: fix(telegram): guard command menu overflow and doctor warnings
by kiminbean · 2026-02-07
78.9%
#23749: fix some issues
by tronpis · 2026-02-22
75.2%
#12076: fix(skills): recursive directory filtering to actually exclude venv...
by xiaoyaner0201 · 2026-02-08
75.1%
#21839: fix(skills): allowBundled: [] now blocks all bundled skills
by hydro13 · 2026-02-20
74.6%
#8075: fix(skills): add --ignore-scripts to all package managers
by yubrew · 2026-02-03
74.6%
#10016: fix: prevent FD exhaustion from skill watcher scanning artifact trees
by oldeucryptoboi · 2026-02-06
74.5%