Skip to content

fix(telegram): clear send_path_degraded on successful reconnect (#35205) - #54076

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-5b183e09
Jun 28, 2026
Merged

fix(telegram): clear send_path_degraded on successful reconnect (#35205)#54076
teknium1 merged 2 commits into
mainfrom
hermes/hermes-5b183e09

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

The Telegram gateway resumes outbound delivery the instant polling reconnects, instead of staying blocked for up to 60 seconds (or indefinitely) after a network blip.

Root cause: _send_path_degraded was set on every polling network error but cleared in exactly one place — _verify_polling_after_reconnect, which runs HEARTBEAT_PROBE_DELAY (60s) after a reconnect and only when that deferred probe is scheduled. A clean start_polling() reconnect reset the error count and was fully healthy again, yet left the flag stuck True, so send() short-circuited and blocked all outbound messages. If the probe was never scheduled, the flag stuck True forever.

Fixes #35205.

Changes

  • plugins/platforms/telegram/adapter.py: clear _send_path_degraded = False the moment start_polling() succeeds — that is the recovery signal. The deferred probe stays as a defensive re-check: if it later detects a silent wedge (PTB running=True but consumer task dead) it re-enters the reconnect ladder, which re-sets the flag.
  • tests/gateway/test_telegram_send_path_health.py: add test_successful_reconnect_clears_flag_without_probe (regression); update the storm test to exercise the genuine flag-stays-True-on-failed-reconnect → probe-clears-after-recovery path.

Validation

Before After
Clean reconnect send path blocked 60s (or forever if probe unscheduled) sends resume immediately
Failed reconnect flag stays True flag stays True (probe clears on later recovery)
Tests 4/4 green

Infographic

infographic

Nous Research

teknium1 added 2 commits June 28, 2026 01:26
_send_path_degraded was cleared only in _verify_polling_after_reconnect,
60s after reconnect and only if scheduled. A clean start_polling() reconnect
left the flag stuck True, short-circuiting send() and blocking all outbound
messages until the deferred probe ran (or forever if it never did).

Clear the flag the moment start_polling() succeeds — that is the recovery
signal. The deferred probe remains a defensive re-check that re-enters the
reconnect ladder (re-setting the flag) if it detects a silent wedge.

Fixes #35205.
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages P1 High — major feature broken, no workaround labels Jun 28, 2026
@teknium1
teknium1 merged commit 2ecb6f7 into main Jun 28, 2026
30 checks passed
@teknium1
teknium1 deleted the hermes/hermes-5b183e09 branch June 28, 2026 08:38
pai-scaffolde pushed a commit to pai-scaffolde/hermes-agent that referenced this pull request Jun 28, 2026
…Research#35205) (NousResearch#54076)

* fix(telegram): clear send_path_degraded on successful reconnect

_send_path_degraded was cleared only in _verify_polling_after_reconnect,
60s after reconnect and only if scheduled. A clean start_polling() reconnect
left the flag stuck True, short-circuiting send() and blocking all outbound
messages until the deferred probe ran (or forever if it never did).

Clear the flag the moment start_polling() succeeds — that is the recovery
signal. The deferred probe remains a defensive re-check that re-enters the
reconnect ladder (re-setting the flag) if it detects a silent wedge.

Fixes NousResearch#35205.

* docs: add infographic for NousResearch#35205 telegram send-path fix
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…Research#35205) (NousResearch#54076)

* fix(telegram): clear send_path_degraded on successful reconnect

_send_path_degraded was cleared only in _verify_polling_after_reconnect,
60s after reconnect and only if scheduled. A clean start_polling() reconnect
left the flag stuck True, short-circuiting send() and blocking all outbound
messages until the deferred probe ran (or forever if it never did).

Clear the flag the moment start_polling() succeeds — that is the recovery
signal. The deferred probe remains a defensive re-check that re-enters the
reconnect ladder (re-setting the flag) if it detects a silent wedge.

Fixes NousResearch#35205.

* docs: add infographic for NousResearch#35205 telegram send-path fix
Jasper6439 pushed a commit to Jasper6439/hermes-agent that referenced this pull request Jul 5, 2026
…Research#35205) (NousResearch#54076)

* fix(telegram): clear send_path_degraded on successful reconnect

_send_path_degraded was cleared only in _verify_polling_after_reconnect,
60s after reconnect and only if scheduled. A clean start_polling() reconnect
left the flag stuck True, short-circuiting send() and blocking all outbound
messages until the deferred probe ran (or forever if it never did).

Clear the flag the moment start_polling() succeeds — that is the recovery
signal. The deferred probe remains a defensive re-check that re-enters the
reconnect ladder (re-setting the flag) if it detects a silent wedge.

Fixes NousResearch#35205.

* docs: add infographic for NousResearch#35205 telegram send-path fix
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
…Research#35205) (NousResearch#54076)

* fix(telegram): clear send_path_degraded on successful reconnect

_send_path_degraded was cleared only in _verify_polling_after_reconnect,
60s after reconnect and only if scheduled. A clean start_polling() reconnect
left the flag stuck True, short-circuiting send() and blocking all outbound
messages until the deferred probe ran (or forever if it never did).

Clear the flag the moment start_polling() succeeds — that is the recovery
signal. The deferred probe remains a defensive re-check that re-enters the
reconnect ladder (re-setting the flag) if it detects a silent wedge.

Fixes NousResearch#35205.

* docs: add infographic for NousResearch#35205 telegram send-path fix
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…Research#35205) (NousResearch#54076)

* fix(telegram): clear send_path_degraded on successful reconnect

_send_path_degraded was cleared only in _verify_polling_after_reconnect,
60s after reconnect and only if scheduled. A clean start_polling() reconnect
left the flag stuck True, short-circuiting send() and blocking all outbound
messages until the deferred probe ran (or forever if it never did).

Clear the flag the moment start_polling() succeeds — that is the recovery
signal. The deferred probe remains a defensive re-check that re-enters the
reconnect ladder (re-setting the flag) if it detects a silent wedge.

Fixes NousResearch#35205.

* docs: add infographic for NousResearch#35205 telegram send-path fix
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…Research#35205) (NousResearch#54076)

* fix(telegram): clear send_path_degraded on successful reconnect

_send_path_degraded was cleared only in _verify_polling_after_reconnect,
60s after reconnect and only if scheduled. A clean start_polling() reconnect
left the flag stuck True, short-circuiting send() and blocking all outbound
messages until the deferred probe ran (or forever if it never did).

Clear the flag the moment start_polling() succeeds — that is the recovery
signal. The deferred probe remains a defensive re-check that re-enters the
reconnect ladder (re-setting the flag) if it detects a silent wedge.

Fixes NousResearch#35205.

* docs: add infographic for NousResearch#35205 telegram send-path fix
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…Research#35205) (NousResearch#54076)

* fix(telegram): clear send_path_degraded on successful reconnect

_send_path_degraded was cleared only in _verify_polling_after_reconnect,
60s after reconnect and only if scheduled. A clean start_polling() reconnect
left the flag stuck True, short-circuiting send() and blocking all outbound
messages until the deferred probe ran (or forever if it never did).

Clear the flag the moment start_polling() succeeds — that is the recovery
signal. The deferred probe remains a defensive re-check that re-enters the
reconnect ladder (re-setting the flag) if it detects a silent wedge.

Fixes NousResearch#35205.

* docs: add infographic for NousResearch#35205 telegram send-path fix
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 sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram gateway: send_path_degraded stays true after successful reconnect, blocking all outbound messages

2 participants