← Back to PRs

#7611: fix: migrate channels.telegram.token to botToken on config load

by luiginotmario open 2026-02-03 01:20 View on GitHub →
## What When configuring Telegram, users often set token instead of the expected botToken. Previously, openclaw doctor would strip this as an "unrecognized key", causing data loss in the openclaw json (forcing manual edit). This PR adds a legacy migration to automatically rename token → botToken. ## Why Improves UX by accepting the intuitive key name and auto-migrating it, rather than silently removing it. ## Changes Added legacy rule to detect channels.telegram.token Added migration for both top-level and per-account configs Added tests for the migration ## Testing [x] pnpm build ✅ [x] pnpm check ✅ [x] pnpm test ✅ (all 5222 tests pass) AI-Assisted tho fully tested <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds a legacy-config migration that renames `channels.telegram.token` (and `channels.telegram.accounts.*.token`) to `botToken` during config load, plus a legacy rule so `openclaw doctor` reports the deprecated key instead of silently stripping it. Tests were extended to cover both top-level and per-account migration behavior. The change fits the existing config pipeline by extending the legacy detection rules (`src/config/legacy.rules.ts`) and adding an additional entry to the ordered legacy migration list (`src/config/legacy.migrations.part-3.ts`), which is composed into `LEGACY_CONFIG_MIGRATIONS` and applied on config load. <h3>Confidence Score: 4/5</h3> - This PR looks safe to merge and is unlikely to cause regressions. - Changes are narrowly scoped to a legacy-config migration and detection rule, and the migration is guarded to avoid overwriting `botToken` when already present. The added tests cover the main migration paths; remaining feedback is mostly around log/test robustness rather than correctness. - src/config/legacy.migrations.part-3.ts (migration change message formatting) and src/config/config.legacy-config-detection.rejects-routing-allowfrom.test.ts (test robustness/coverage). <!-- 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