fix(telegram): route conflict-retry start_polling failure into network reconnect ladder - #25285
Closed
shanewas wants to merge 2 commits into
Closed
fix(telegram): route conflict-retry start_polling failure into network reconnect ladder#25285shanewas wants to merge 2 commits into
shanewas wants to merge 2 commits into
Conversation
…k reconnect ladder Fixes #25221 When the retry start_polling() call inside _handle_polling_conflict() raises, the exception was only logged before returning silently — no reconnect was scheduled, leaving the gateway alive but with dead polling. The fix mirrors _handle_polling_network_error (lines 814-823): schedule a background task calling _handle_polling_network_error(retry_err) so the failure is routed through the exponential-backoff reconnect ladder. Tests: tests/gateway/test_telegram_polling_conflict_retry.py (4 tests)
Collaborator
|
Duplicate of #25232. Both PRs apply the identical fix to |
Author
This was referenced Aug 3, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #25221 — Telegram gateway stays alive with dead polling after the conflict-retry
start_pollingcall fails.The Bug
In
_handle_polling_conflict(), when the retrystart_pollingcall (line 896) raises an exception, the handler only logged the error and returned silently — no reconnect was scheduled, no further retry was triggered. This left the gateway process alive but with dead Telegram polling, requiring a manual restart.The Fix
The fix mirrors what
_handle_polling_network_erroralready does for network failures (lines 814-823): whenstart_pollingfails in the conflict-retry path, schedule a background task that calls_handle_polling_network_error(retry_err). This routes the failure through the exponential-backoff reconnect ladder so the adapter recovers automatically instead of going silent.Changed file:
gateway/platforms/telegram.py(lines 904-916)Tests
tests/gateway/test_telegram_polling_conflict_retry.py— 4 regression tests:test_conflict_retry_start_polling_failure_schedules_network_reconnect— core fix validationtest_conflict_retry_start_polling_failure_does_not_set_fatal_immediately— confirms transient pathtest_conflict_retry_start_polling_failure_leaves_adapter_alive— adapter stays runningtest_successful_conflict_retry_resets_conflict_count— conflict count resets on successAll 4 pass. Run:
pytest tests/gateway/test_telegram_polling_conflict_retry.py -v