fix(gateway): add request timeouts to HA, Email, Mattermost, SMS adapters#3258
Merged
fix(gateway): add request timeouts to HA, Email, Mattermost, SMS adapters#3258
Conversation
…ters Add timeout=30 to all bare ClientSession, IMAP4_SSL, smtplib.SMTP, and ws_connect calls that previously had no timeout, preventing indefinite hangs when an external server is slow or unresponsive. Adapters hardened: - HomeAssistant: REST + WS session creation, ws_connect handshake - Email: all IMAP4_SSL (x2) and smtplib.SMTP (x3) calls - Mattermost: session creation, _api_get, _api_post, _upload_file (60s) - SMS: session creation in connect() + fallback session in send() Salvaged from PRs #3161, #3168, #3170 (memosr) and #3201 (binhnt92). SMS fallback ClientSession on send() also patched (missed in #3201). Co-authored-by: memosr <memosr@users.noreply.github.com> Co-authored-by: nguyen binh <binhnt92@users.noreply.github.com>
This was referenced Mar 26, 2026
StreamOfRon
pushed a commit
to StreamOfRon/hermes-agent
that referenced
this pull request
Mar 29, 2026
…ters (NousResearch#3258) Add timeout=30 to all bare ClientSession, IMAP4_SSL, smtplib.SMTP, and ws_connect calls that previously had no timeout, preventing indefinite hangs when an external server is slow or unresponsive. Adapters hardened: - HomeAssistant: REST + WS session creation, ws_connect handshake - Email: all IMAP4_SSL (x2) and smtplib.SMTP (x3) calls - Mattermost: session creation, _api_get, _api_post, _upload_file (60s) - SMS: session creation in connect() + fallback session in send() Salvaged from PRs NousResearch#3161, NousResearch#3168, NousResearch#3170 (memosr) and NousResearch#3201 (binhnt92). SMS fallback ClientSession on send() also patched (missed in NousResearch#3201). Co-authored-by: memosr <memosr@users.noreply.github.com> Co-authored-by: nguyen binh <binhnt92@users.noreply.github.com>
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
Add
timeout=30to all bareClientSession,IMAP4_SSL,smtplib.SMTP, andws_connectcalls across four gateway platform adapters that previously had no timeout. Prevents indefinite hangs when an external server is slow or unresponsive.Adapters hardened
Follow-up fix
SMS adapter line 147 (
session = self._http_session or aiohttp.ClientSession()) also patched — the fallbackClientSessionwas missing a timeout in the original PR.Tests
Full suite passes (6226 passed, 1 pre-existing unrelated failure in
test_anthropic_error_handling).Salvaged from PRs #3161, #3168, #3170 (memosr) and #3201 (binhnt92). Credit to both contributors.
Closes #3161, closes #3168, closes #3170, closes #3201