fix(telegram): recover from post-update polling conflict without entering limbo (closes #23783) - #28486
Merged
Conversation
Contributor
🔎 Lint report:
|
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.
Salvage of #25630 (@CryptoByz).
Summary
hermes updatewhile the gateway is active leaves Telegram broken in two ways:Stage 1 — 409 Conflict on startup. Telegram keeps its getUpdates long-poll session open ~30s after the old process exits. The watcher respawns with no delay → 409 from Telegram's API before the server-side session expires.
Stage 2 — Silent limbo after failed retry (worse bug).
_handle_polling_conflictwould sleep 10s, retrystart_polling(). If that retry itself raised, the method silently returned.updater.running=False, no fatal error set, gateway reports 'connected', no messages flow. Only recovery was a manual restart.Changes
gateway/platforms/telegram.py:MAX_CONFLICT_RETRIES3→5, exponential backoff10 + count*10, self-rescheduling on retry failure (no more silent limbo).hermes_cli/main.py: add startup grace delay for the watcher respawn.Validation
scripts/run_tests.sh tests/gateway/test_telegram_conflict.py -q→ 6/6 passing.Follow-up commit updates
test_polling_conflict_becomes_fatal_after_retriesto match the new MAX=5 invariant (was hardcoded against MAX=3).Also supersedes #23806 (@im-kris) and #27099 (@randiri100) — both fixed subsets of this — closed with credit.
Authorship preserved via cherry-pick. AUTHOR_MAP entry added in follow-up.