Skip to content

fix(telegram): retry on transient TLS failures during connect and send#1535

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-6360cdf9
Mar 16, 2026
Merged

fix(telegram): retry on transient TLS failures during connect and send#1535
teknium1 merged 1 commit into
mainfrom
hermes/hermes-6360cdf9

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

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 for NetworkError, TimedOut, and OSError — 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.error imports are guarded with try/except ImportError for test environments where the telegram package is mocked.

Test Plan

pytest tests/gateway/ -n0 -q  # 919 passed, 0 failures

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.
@teknium1 teknium1 merged commit b411b97 into main Mar 16, 2026
1 check passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram connection fails intermittently on startup due to transient TLS reset with no retry

1 participant