fix: cool down unhealthy telegram transports#78097
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: Do we have a high-confidence way to reproduce the issue? Yes at source level: current main still has a test proving the pinned fallback remains sticky after all attempts fail, and the linked report plus PR proof exercise the same blackholed Telegram route behavior. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the Telegram-local cooldown after the unrelated CI failures are understood or cleared, and leave configurable cross-channel circuit-breaker/backoff work to a separate product discussion. Do we have a high-confidence way to reproduce the issue? Do we have a high-confidence way to reproduce the issue? Yes at source level: current main still has a test proving the pinned fallback remains sticky after all attempts fail, and the linked report plus PR proof exercise the same blackholed Telegram route behavior. Is this the best way to solve the issue? Is this the best way to solve the issue? Yes for this PR's scope: a Telegram-owned cooldown in What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 4c1e6ba2f03b. |
c23f555 to
ab8ef1c
Compare
ab8ef1c to
1e8ca26
Compare
1e8ca26 to
b4299a6
Compare
|
Landed via rebase onto main.
Thanks @bryce-d-greybeard! |
Summary
Adds a Telegram-local cooldown for repeatedly failing Bot API transport attempts.
The existing fallback cascade can become sticky on the pinned Telegram IP. If that route is blackholed, every poll cycle keeps paying another failed network attempt. This patch tracks each managed transport attempt, opens a short cooldown after repeated failures, and short-circuits that attempt until the cooldown expires.
Changes
resolveTelegramTransport().TypeError: fetch failedas transport fallback-eligible, while preserving non-retry for unknown explicit codes such asECONNRESET.Real behavior proof (required for external PRs)
b4299a6ffabbac99630c9f61a49e75866df3b5df, real HTTPS requests toapi.telegram.org; only149.154.167.220/32was temporarily marked unreachable.pnpm crabbox:run -- --provider blacksmith-testbox --blacksmith-org openclaw --blacksmith-workflow .github/workflows/ci-check-testbox.yml --blacksmith-job check --blacksmith-ref main --idle-timeout 90m --ttl 90m --timing-json --shell -- '<temp route + resolveTelegramTransport proof script>'status=200instead of continuing to hit149.154.167.220.Testing
git diff --check origin/main...HEAD— passed.bunx pnpm test extensions/telegram/src/fetch.test.ts -- --reporter=dot— passed, 36 tests.Fixes #77900