#14741: feat: telegram resilience utilities
docs
channel: telegram
stale
size: M
Cluster:
Webhook Configuration and Resilience
Add health monitoring, retry with backoff, and circuit breaker for telegram integration.
Addresses stability issues for channel connections:
- Handles transient getUpdates timeouts with exponential backoff
- Prevents cascading failures with circuit breaker pattern
- Rate limit (429) errors back off naturally, don't trip breaker permanently
- Integrates with existing channels.telegram.timeoutSeconds + retry config
Components:
- BotHealthCheck: periodic health checks with failure callbacks
- retryWithBackoff: exponential backoff retry with jitter
- Circuit: state machine (closed → open → half-open) with logging
Sources:
- https://github.com/openclaw/openclaw/issues/4617
- https://github.com/openclaw/openclaw/issues/8140
- https://docs.openclaw.ai/channels/telegram
Tested locally with unit tests covering health, retry, and circuit state transitions.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Adds new Telegram resilience primitives: a `Circuit` circuit-breaker state machine (`src/telegram/circuit.ts`), a `BotHealthCheck` periodic health monitor (`src/telegram/health.ts`), and accompanying unit tests (`src/telegram/resilience.test.ts`). Also introduces a docs page describing intended usage (`docs/TELEGRAM_RESILIENCE.md`).
The code is largely self-contained under `src/telegram/`, but the docs example currently diverges from the actual TS APIs, and the health-check timeout implementation leaks timers on successful checks.
<h3>Confidence Score: 3/5</h3>
- Moderately safe to merge after fixing a couple correctness issues in docs and health-check timeout handling.
- Core changes are small and localized, but the docs example currently references non-existent options/methods and `BotHealthCheck.check()` leaves a pending timeout on success, which can accumulate timers in long-running processes.
- docs/TELEGRAM_RESILIENCE.md, src/telegram/health.ts
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#6463: fix(telegram): improve timeout handling and prevent channel exits
by ai-fanatic · 2026-02-01
81.8%
#8166: fix(telegram): lifecycle fixes for duplicate messages and auto-reco...
by cheenu1092-oss · 2026-02-03
79.2%
#10865: telegram: fast-ACK webhook and retry bind on EADDRINUSE
by u9733037 · 2026-02-07
78.0%
#7141: fix(telegram): unify network error detection to prevent poll crashes
by hclsys · 2026-02-02
77.9%
#5561: fix(telegram): auto-restart on timeout + lower API timeout to 60s
by jesseproudman · 2026-01-31
77.3%
#3186: fix(telegram): sanitize update offset + lock polling
by daxiong888 · 2026-01-28
77.0%
#11132: fix(telegram): guard command menu overflow and doctor warnings
by kiminbean · 2026-02-07
75.6%
#11688: feat(telegram): add health check watchdog for long-polling
by rmfalco89 · 2026-02-08
75.3%
#6447: fix(telegram): auto-restart polling when grammY runner exits silently
by AugmentAdvertise · 2026-02-01
75.0%
#12870: fix: recover from telegram fetch errors (issue #12835)
by ambicuity · 2026-02-09
74.9%