Skip to content

[codex] fix(telegram): retry pool timeout via fresh request fallback#35623

Open
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:codex/fix-telegram-pool-timeout-fallback
Open

[codex] fix(telegram): retry pool timeout via fresh request fallback#35623
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:codex/fix-telegram-pool-timeout-fallback

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Summary

Fixes #35610.

When Telegram's general PTB/httpx request pool is exhausted, send() used to treat the resulting TimedOut as a generic delivery-ambiguous timeout and return failure immediately. That left agent replies and cron/live-adapter sends without the intended send-side recovery path.

This change makes the send path:

  • detect PTB/httpx general-pool exhaustion separately from ordinary timeouts
  • retry once on the existing pool
  • if the pool is still exhausted, resend the same chunk through a fresh one-shot HTTPXRequest session using the same proxy/fallback-IP/custom-base-url config and the same Markdown/plain-text fallback behavior

Testing

  • uv run --frozen --extra dev python -m pytest tests/gateway/test_telegram_thread_fallback.py -o 'addopts=' -q
  • uv run --frozen --extra dev python -m ruff check gateway/platforms/telegram.py tests/gateway/test_telegram_thread_fallback.py
  • git diff --check

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter P1 High — major feature broken, no workaround labels May 31, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Complementary to #35624 (drain both pools proactively). This PR adds send-side retry with fresh HTTPXRequest when the existing pool is exhausted. Fixes #35610. Related: #31599.

@alpindiay

Copy link
Copy Markdown

Automated Triage: Duplicate Detected

This PR's changes are a strict subset of #35664 (same telegram pool-timeout retry, same files). #35664 includes the same fix plus test coverage. Recommend closing this PR in favor of #35664.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P1 High — major feature broken, no workaround platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Telegram: Pool timeout causes silent send failures — no retry or fallback on exhausted general pool

3 participants