#6463: fix(telegram): improve timeout handling and prevent channel exits
channel: telegram
## Summary
- Reduces maxRetryTime from 5 minutes to 2 minutes for faster recovery from persistent errors
- Adds retryInterval: "exponential" to use exponential backoff between retry attempts
- Improves error classification for timeout vs conflict vs generic network errors
- Updates test expectations to match new timeout configuration
## Test plan
- [x] Unit tests pass (`pnpm test src/telegram/monitor.test.ts`)
- [x] Linting passes (`pnpm lint`)
- [x] Formatting passes (`pnpm format`)
- [ ] Manual testing with Telegram bot to verify timeout recovery behavior
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Changes adjust grammY runner retry/timing behavior for Telegram polling: `maxRetryTime` is reduced (5m → 2m) and `retryInterval: "exponential"` is set, while `monitorTelegramProvider` now classifies timeout-like `AbortError`s as retryable and adds a hard cap on poll restarts. Tests were updated to match the new runner options.
Main behavioral shift is in the polling loop error/abort handling and restart policy in `src/telegram/monitor.ts`, with a corresponding expectation change in `src/telegram/monitor.test.ts`.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge, with a couple of behavioral edge cases to confirm around abort propagation and retry attempt counting.
- Core changes are localized and test updates reflect new config, but `monitorTelegramProvider` now swallows abort rejections (behavior change) and the restart attempt cap appears off-by-one relative to the intended limit/logging.
- src/telegram/monitor.ts
<!-- greptile_other_comments_section -->
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#6447: fix(telegram): auto-restart polling when grammY runner exits silently
by AugmentAdvertise · 2026-02-01
88.0%
#7247: fix(telegram): abort stale getUpdates connections after long-poll t...
by JanderV · 2026-02-02
86.3%
#7141: fix(telegram): unify network error detection to prevent poll crashes
by hclsys · 2026-02-02
84.9%
#8166: fix(telegram): lifecycle fixes for duplicate messages and auto-reco...
by cheenu1092-oss · 2026-02-03
84.7%
#3186: fix(telegram): sanitize update offset + lock polling
by daxiong888 · 2026-01-28
84.3%
#5561: fix(telegram): auto-restart on timeout + lower API timeout to 60s
by jesseproudman · 2026-01-31
82.9%
#12870: fix: recover from telegram fetch errors (issue #12835)
by ambicuity · 2026-02-09
82.0%
#14741: feat: telegram resilience utilities
by kalachbeg · 2026-02-12
81.8%
#10850: fix(telegram): await runner.stop() to prevent polling race conditio...
by talhaorak · 2026-02-07
81.7%
#9085: fix: improve stability for terminated responses and telegram retries
by vladdick88 · 2026-02-04
80.3%