#11240: Fix #10875: Clear Telegram commands before registering to prevent duplicates
channel: signal
channel: telegram
app: web-ui
gateway
cli
agents
stale
Cluster:
Skill Command Deduplication
## Problem
When `commands.nativeSkills` is set to "auto", Telegram skill commands are registered multiple times on gateway restart. Each skill appears 5 times with suffixes like `_2`, `_3`, etc.
## Root Cause
The Telegram API endpoint `setMyCommands` appends commands rather than replacing them across gateway restarts, causing duplicates to accumulate.
## Fix
Call `deleteMyCommands` before `setMyCommands` to clear the existing command list before registering fresh commands.
## Changes
- Added `deleteMyCommands` call before `setMyCommands` in `src/telegram/bot-native-commands.ts`
Fixes #10875
Wallet: BYCgQQpJT1odaunfvk6gtm5hVd7Xu93vYwbumFfqgHb3
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR primarily addresses Telegram native command duplication across gateway restarts by clearing existing bot commands before re-registering them (`deleteMyCommands` before `setMyCommands`).
It also includes a set of related fixes/enhancements across cron scheduling, memory backend fallback behavior, Signal inbound handling, TTS config, and UI markdown rendering performance.
One correctness issue was found in the Signal edit handling: edited messages can end up with a `messageId` of `"NaN"` if the edit target timestamp is not parseable, which can break deduplication/downstream indexing.
<h3>Confidence Score: 4/5</h3>
- Mostly safe to merge once the Signal edit messageId handling is fixed.
- Changes are generally straightforward and localized, but Signal edit handling can generate a non-unique `messageId` ("NaN") for certain inputs, which is likely to break deduplication/indexing for edited messages.
- src/signal/monitor/event-handler.ts
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#14991: fix(telegram): deduplicate skill commands by skillName to prevent B...
by smartchainark · 2026-02-12
84.7%
#6457: fix(telegram): register commands for group scope + preserve topic t...
by dae-sun · 2026-02-01
81.6%
#17062: fix(telegram): prioritize workspace skills over bundled in native c...
by scout-wolfe · 2026-02-15
79.1%
#11132: fix(telegram): guard command menu overflow and doctor warnings
by kiminbean · 2026-02-07
78.5%
#9734: fix(telegram): correct sender identification for channel messages (...
by divol89 · 2026-02-05
77.3%
#11347: fix: scope Telegram update offset to bot token
by anooprdawar · 2026-02-07
76.7%
#8166: fix(telegram): lifecycle fixes for duplicate messages and auto-reco...
by cheenu1092-oss · 2026-02-03
76.6%
#3186: fix(telegram): sanitize update offset + lock polling
by daxiong888 · 2026-01-28
75.6%
#18711: fix(telegram): replace hyphens with underscores in export-session c...
by MisterGuy420 · 2026-02-17
75.6%
#4878: fix: string/type handling and API fixes (#4537, #4380, #4373, #4547...
by lailoo · 2026-01-30
75.0%