Skip to content

fix(telegram): send resilience — retry transient tool sends + increase cold-boot budget (#9101, #5770)#10947

Merged
teknium1 merged 2 commits into
mainfrom
salvage/telegram-send-resilience
Apr 16, 2026
Merged

fix(telegram): send resilience — retry transient tool sends + increase cold-boot budget (#9101, #5770)#10947
teknium1 merged 2 commits into
mainfrom
salvage/telegram-send-resilience

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Two complementary Telegram resilience fixes from the community, combined into one PR.

Commit 1: Retry transient tool-send failures (from #9101 by @corazzione)

The gateway adapter already retries transient send failures, but the send_message tool's direct _send_telegram() path had zero retry logic. A transient 502/429 killed the send silently.

  • Adds _telegram_retry_delay() — classifies exceptions as retryable (502, 429, 503, 504, bad gateway, too many requests) with exponential backoff, respects retry_after header, excludes timeouts
  • Adds _send_telegram_message_with_retry() — up to 3 attempts with asyncio.sleep
  • Replaces bare bot.send_message() calls in _send_telegram() with the retry wrapper
  • 1 new test

Files: tools/send_message_tool.py, tests/tools/test_send_message_tool.py

Commit 2: Increase cold-boot retry budget (from #5770 by @Bartok9)

Connect retry attempts bumped from 3 → 8, exponential backoff capped at 15s. Old budget: ~7s total (insufficient for cold boot on slow networks). New: ~60s total.

File: gateway/platforms/telegram.py (2 lines changed)

Test results

55 passed in 1.00s (send_message_tool tests)

Merge via rebase to preserve both contributors' authorship.

corazzione and others added 2 commits April 16, 2026 03:02
Bump connect retry attempts from 3 to 8 and cap exponential backoff at
15 seconds. Old budget: 3 attempts, 1+2+4=7s total — insufficient for
cold boot on slow networks or embedded devices. New budget: 8 attempts,
1+2+4+8+15+15+15=~60s total.

Inspired by PR #5770 by @Bartok9 (re-implemented against current main
since original was 913 commits stale with conflicts).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants