fix(telegram): retry on transient TLS failures during connect and send#1535
Merged
Conversation
Add exponential-backoff retry (3 attempts) around initialize() to handle transient TLS resets during gateway startup. Also catches TimedOut and OSError in addition to NetworkError. Add exponential-backoff retry (3 attempts) around send_message() for NetworkError during message delivery, wrapping the existing Markdown fallback logic. Both imports are guarded with try/except ImportError for test environments where telegram is mocked. Based on PR #1527 by cmd8. Closes #1526.
4 tasks
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
NousResearch#1535) fix(telegram): retry on transient TLS failures during connect and send
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
NousResearch#1535) fix(telegram): retry on transient TLS failures during connect and send
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
NousResearch#1535) fix(telegram): retry on transient TLS failures during connect and send
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
NousResearch#1535) fix(telegram): retry on transient TLS failures during connect and send
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
Adds exponential-backoff retry (3 attempts) for transient network failures in the Telegram adapter.
Based on PR #1527 by @cmd8. Closes #1526.
Connect retry
Wraps
initialize()with retry forNetworkError,TimedOut, andOSError— handles TLS handshake resets during gateway startup.Send retry
Wraps the existing Markdown-fallback send logic with retry for
NetworkError— handles transient failures during message delivery without interfering with the Markdown → plain text fallback.Test safety
Both
telegram.errorimports are guarded withtry/except ImportErrorfor test environments where the telegram package is mocked.Test Plan
pytest tests/gateway/ -n0 -q # 919 passed, 0 failures