Skip to content

fix(telegram): clear send_path_degraded immediately on successful reconnect - #35285

Closed
annguyenNous wants to merge 1 commit into
NousResearch:mainfrom
annguyenNous:fix/telegram-send-path-degraded
Closed

fix(telegram): clear send_path_degraded immediately on successful reconnect#35285
annguyenNous wants to merge 1 commit into
NousResearch:mainfrom
annguyenNous:fix/telegram-send-path-degraded

Conversation

@annguyenNous

Copy link
Copy Markdown
Contributor

Fixes #35205

Problem

After a transient network interruption, the Telegram gateway successfully reconnects polling but _send_path_degraded remains True for up to 60 seconds (until the heartbeat probe runs in _verify_polling_after_reconnect()), blocking all outbound send() calls during that window.

Root Cause

In _handle_polling_network_error(), the reconnect ladder at line ~964 resets _polling_network_error_count = 0 but does NOT clear _send_path_degraded. The flag is only cleared inside _verify_polling_after_reconnect() (line ~1024) which runs after a 60-second HEARTBEAT_PROBE_DELAY.

Fix

Clear _send_path_degraded immediately when start_polling() succeeds in the reconnect ladder, restoring the send path without waiting for the deferred probe. The probe still runs as a safety net and will re-set the flag if the connection is actually wedged.

Changes

  • gateway/platforms/telegram.py: +9 lines — clear _send_path_degraded after successful reconnect with info log

…onnect

After a transient network interruption, the Telegram gateway successfully
reconnects polling but _send_path_degraded remains True for up to 60
seconds (until the heartbeat probe runs), blocking all outbound send()
calls during that window.

This commit clears _send_path_degraded immediately when start_polling()
succeeds in the reconnect ladder, restoring the send path without
waiting for the deferred probe. The probe still runs as a safety net
and will re-set the flag if the connection is actually wedged.

Fixes NousResearch#35205
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter duplicate This issue or pull request already exists labels May 30, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #35286 — both fix #35205 (send_path_degraded stays true after reconnect). #35286 includes test updates; recommend closing this in favor of that PR.

@alpindiay

Copy link
Copy Markdown

Automated Triage: Duplicate Detected

This PR's changes are a strict subset of #35286 (same send_path_degraded fix, same file). #35286 includes the same fix plus test coverage. Recommend closing this PR in favor of #35286.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jun 21, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Automated hermes-sweeper review: this reconnect fix is already present on current main.

Evidence:

  • The Telegram adapter now lives at plugins/platforms/telegram/adapter.py after the gateway platform plugin migration.
  • In _handle_polling_network_error(), a successful start_polling() path clears self._send_path_degraded = False immediately at plugins/platforms/telegram/adapter.py:1776, before the deferred heartbeat probe.
  • Regression coverage exists in tests/gateway/test_telegram_send_path_health.py:106, where the test disables _verify_polling_after_reconnect() and verifies the flag clears plus send() works immediately.
  • The implementation landed in 2ecb6f7fe60f6a240d632bbd51bcbb25ad22c161 (fix(telegram): clear send_path_degraded on successful reconnect (#35205) (#54076)).

Thanks for the focused fix here; the prior duplicate discussion was accurate, and the requested behavior is now covered on main.

@teknium1 teknium1 closed this Jun 29, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jun 29, 2026
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 duplicate This issue or pull request already exists P1 High — major feature broken, no workaround platform/telegram Telegram bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:implemented-on-main Sweeper: behavior already present on current main 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

4 participants