#16989: fix(telegram): remove duplicate migration call during group->supergroup migration
channel: telegram
stale
size: XS
Cluster:
Telegram Command Fixes
## Summary
- During Telegram group-to-supergroup migration, `migrateTelegramGroupConfig` was called twice: first on the freshly-loaded `currentConfig` (which is persisted to disk), then again on the stale startup `cfg` parameter (which is never saved). The second call was a copy-paste artifact that mutated a stale in-memory config object for no purpose.
- Removed the redundant second call to `migrateTelegramGroupConfig({ cfg, accountId, oldChatId, newChatId })` at line 668 of `bot-handlers.ts`.
## Test plan
- Existing `group-migration.test.ts` tests continue to pass (4/4 green), confirming the migration function itself is unaffected.
- The removed line only mutated the stale `cfg` parameter which was never written to disk, so removing it has no behavioral change on persisted state.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Removes a redundant call to `migrateTelegramGroupConfig` in the `message:migrate_to_chat_id` handler in `bot-handlers.ts`. The handler already calls `migrateTelegramGroupConfig` with `currentConfig` (freshly loaded from disk) and persists it via `writeConfigFile(currentConfig)`. The removed line called the same function again with the stale `cfg` parameter (passed at startup), whose mutations were never saved — making it a no-op copy-paste artifact.
- Removed duplicate `migrateTelegramGroupConfig({ cfg, accountId, oldChatId, newChatId })` call that mutated the stale startup `cfg` object without persisting it
- No behavioral change: only `currentConfig` was ever written to disk; the stale `cfg` mutation had no effect
- Existing tests (4/4 in `group-migration.test.ts`) continue to pass
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge — it removes dead code with no behavioral impact.
- The change is a single-line removal of a clearly redundant function call. The removed call mutated the stale startup `cfg` parameter which was never persisted to disk (only `currentConfig` is written via `writeConfigFile`). The migration logic, persistence, and all logging remain intact. The change is well-scoped and verified by existing tests.
- No files require special attention.
<sub>Last reviewed commit: 9bf1cc6</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16995: fix(telegram): record update ID before processing to prevent crash ...
by AI-Reviewer-QS · 2026-02-15
77.0%
#18664: fix(imessage): honor groupConfig regardless of allowlistEnabled
by brandonwise · 2026-02-16
76.4%
#11347: fix: scope Telegram update offset to bot token
by anooprdawar · 2026-02-07
75.4%
#16105: fix: handle message_reaction updates in group polling mode
by claw-sylphx · 2026-02-14
75.4%
#19213: Telegram: preserve DM topic thread in direct replies
by Kemalau · 2026-02-17
75.3%
#13580: fix(telegram): skip updateLastRoute when dmScope isolates DM sessions
by lailoo · 2026-02-10
75.0%
#7611: fix: migrate channels.telegram.token to botToken on config load
by luiginotmario · 2026-02-03
74.9%
#14443: fix(telegram): skip General topic thread ID for all chat types (#14...
by lailoo · 2026-02-12
74.8%
#22363: fix(telegram): isolate update offset state by bot token
by AIflow-Labs · 2026-02-21
74.8%
#8166: fix(telegram): lifecycle fixes for duplicate messages and auto-reco...
by cheenu1092-oss · 2026-02-03
74.7%