fix(gateway): wait for Telegram polling readiness before restart notification - #69530
Closed
webtecnica wants to merge 1 commit into
Closed
fix(gateway): wait for Telegram polling readiness before restart notification#69530webtecnica wants to merge 1 commit into
webtecnica wants to merge 1 commit into
Conversation
…fication Before v0.19.0 (Quicksilver) the gateway's cold-start was slow enough that Telegram's polling path always had time to complete its first getUpdates request before _send_restart_notification() ran. The faster cold-start in v0.19.0 exposes a race: _send_restart_notification() is called while _send_path_degraded is still True, causing the notification to fail with 'send_path_degraded'. The fix adds _wait_adapter_send_ready(), which uses duck-typing to detect platform adapters with a _polling_progress_event (Telegram adapter) and awaits it with a 15-second timeout. The same wait is applied to _send_home_channel_startup_notifications() for consistency. Fixes NousResearch#69370
1 task
Contributor
|
This is an automated hermes-sweeper review. Thanks for identifying the Telegram cold-start race and proposing a bounded readiness synchronization.
Closing as implemented on main. |
This was referenced Jul 30, 2026
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.
Description
Fixes #69370 — Telegram post-restart notification lost on v0.19.0 (Quicksilver).
Root Cause
The v0.19.0 faster cold-start reaches
_send_restart_notification()before Telegram's polling path completes its first successfulgetUpdatesrequest. At that point_send_path_degradedis stillTrue, soadapter.send()returnsSendResult(success=False, error="send_path_degraded")and the notification is lost. Normal messaging works moments later once polling makes progress.Fix
Introduces
_wait_adapter_send_ready()on the gateway runner, which uses duck-typing to detect platform adapters exposing a_polling_progress_event(Telegram adapter) and awaits it with a 15-second bounded timeout before sending lifecycle notifications.The wait is applied in two places:
_send_restart_notification()— the chat-originated /restart reply_send_home_channel_startup_notifications()— the planned-restart home-channel broadcastDesign Notes
isinstancechecks, keeping the gateway runner platform-agnostic. Other adapters (Discord, WhatsApp, etc.) have no_polling_progress_eventand are no-ops.start()(line 8057) rather than replacing it._wait_adapter_send_readyis a no-op when no_polling_progress_eventis set, and existing Telegram adapter tests already cover the_polling_progress_eventlifecycle (tests/gateway/test_telegram_polling_progress.py).Testing
Validated by the reporter's local mitigation (commit 1f3aa26b53) which used the same mechanism. This upstream fix mirrors that approach with a bounded timeout and broader coverage.
Co-authored-by: Marcos (webtecnica) marcos@webtecnica.com.br