fix(telegram): log the first confirmed getUpdates progress per generation - #90560
Merged
kshitijk4poor merged 2 commits intoAug 20, 2026
Conversation
…tion Both polling reconnect paths end on the same 'health pending getUpdates progress' line, and _record_polling_progress completed silently — so the log stream for 'reconnected and healthy' was byte-identical to 'reconnected and hung', and a wedged long-poll (NousResearch#87057 / NousResearch#69314 / NousResearch#71239 class) stayed invisible until a user noticed silence. The only detection method was sending the bot a test message (NousResearch#90504). Emit one INFO on the first confirmed getUpdates round-trip of each generation, inside the existing event-set branch so steady-state polling adds no log volume. This turns the pending line into a resolvable pair ('health pending' -> 'confirmed healthy') whose absence after a reconnect is a reliable hung-poll signature. Fixes NousResearch#90504
Follow-up cleanup from simplify-code review on PR NousResearch#90521 salvage.
kshitijk4poor
enabled auto-merge (rebase)
August 20, 2026 05:53
kshitijk4poor
added a commit
to kshitijk4poor/hermes-agent
that referenced
this pull request
Aug 21, 2026
…eway tests tests/gateway/conftest.py already installs a comprehensive telegram mock at collection time (line 330), before any test module's imports run. The per-file copies were fully redundant — each was a simpler subset (plain strings, setdefault, fewer error classes) of the conftest version (which uses _fake_str_enum for PTB-faithful StrEnum semantics, sys.modules overwrite to win over partial/broken imports, and a full error hierarchy including BadRequest, Forbidden, RetryAfter, Conflict, InvalidToken). Removed: function def + module-level call + now-unused imports (sys, MagicMock where no longer referenced) + dangling comment blocks that referenced the deleted mock, in 27 test files. Left untouched: tests/gateway/conftest.py (canonical source) and tests/e2e/conftest.py (separate conftest tree that may run in isolation). Found by /simplify-code review of PR NousResearch#90560.
melon-xf
added a commit
to melon-xf/hermes-agent
that referenced
this pull request
Sep 3, 2026
…eway tests tests/gateway/conftest.py already installs a comprehensive telegram mock at collection time (line 330), before any test module's imports run. The per-file copies were fully redundant — each was a simpler subset (plain strings, setdefault, fewer error classes) of the conftest version (which uses _fake_str_enum for PTB-faithful StrEnum semantics, sys.modules overwrite to win over partial/broken imports, and a full error hierarchy including BadRequest, Forbidden, RetryAfter, Conflict, InvalidToken). Removed: function def + module-level call + now-unused imports (sys, MagicMock where no longer referenced) + dangling comment blocks that referenced the deleted mock, in 27 test files. Left untouched: tests/gateway/conftest.py (canonical source) and tests/e2e/conftest.py (separate conftest tree that may run in isolation). Found by /simplify-code review of PR NousResearch#90560.
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
After a Telegram polling reconnect, the log stream for "reconnected and healthy" was byte-identical to "reconnected and hung" — a wedged long-poll (#87057 / #69314 / #71239 class) was invisible until a user noticed silence. This PR emits one INFO log line on the first confirmed getUpdates round-trip of each polling generation, turning the pending line into a resolvable pair whose absence after a reconnect is a reliable hung-poll signature.
Fixes #90504
Changes
plugins/platforms/telegram/adapter.py—_record_polling_progress: when the generation's progress event transitions unset → set, logTelegram polling confirmed healthy: getUpdates progressing (generation N). No behavior change beyond the log line; counters/degraded-flag resets are untouched. Placed inside the existingnot event.is_set()branch so steady-state polling adds zero log volume.tests/gateway/test_telegram_polling_health_confirmation.py— 4 tests: first progress emits the confirmation (with generation number), subsequent progress in the same generation is silent, a new generation re-emits after a reconnect, and progress from a stale generation neither logs nor sets the current event.Salvage of #90521 by @liuhao1024 — cherry-picked with authorship preserved. Follow-up: removed unused
import pytestfrom the test file.Validation
_record_polling_progresscompletes silentlyconfirmed healthyconfirmed healthyafter reconnect