Skip to content

fix(gateway): add request timeouts to HA, Email, Mattermost, SMS adapters#3258

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-93060758
Mar 26, 2026
Merged

fix(gateway): add request timeouts to HA, Email, Mattermost, SMS adapters#3258
teknium1 merged 1 commit intomainfrom
hermes/hermes-93060758

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

Add timeout=30 to all bare ClientSession, IMAP4_SSL, smtplib.SMTP, and ws_connect calls across four gateway platform adapters that previously had no timeout. Prevents indefinite hangs when an external server is slow or unresponsive.

Adapters hardened

Adapter What gets a timeout
HomeAssistant REST + WS session creation, ws_connect handshake (30s)
Email All IMAP4_SSL (×2) and smtplib.SMTP (×3) calls (30s)
Mattermost Session creation, _api_get, _api_post (30s), _upload_file (60s)
SMS Session creation in connect() + fallback session in send() (30s)

Follow-up fix

SMS adapter line 147 (session = self._http_session or aiohttp.ClientSession()) also patched — the fallback ClientSession was 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

…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>
@teknium1 teknium1 merged commit 3a86328 into main Mar 26, 2026
1 of 2 checks passed
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>
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.

1 participant