fix(gateway): add request timeout to SMS adapter HTTP session#3201
Closed
binhnt92 wants to merge 1 commit intoNousResearch:mainfrom
Closed
fix(gateway): add request timeout to SMS adapter HTTP session#3201binhnt92 wants to merge 1 commit intoNousResearch:mainfrom
binhnt92 wants to merge 1 commit intoNousResearch:mainfrom
Conversation
SmsAdapter created aiohttp.ClientSession() without a timeout, so a slow or unresponsive Twilio API could hang the gateway event loop indefinitely. The send_message_tool already uses ClientTimeout(total=30) for its Twilio calls — this applies the same default to the gateway SMS adapter.
teknium1
added a commit
that referenced
this pull request
Mar 26, 2026
…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>
Contributor
|
Merged via PR #3258 — your SMS adapter timeout was cherry-picked onto current main. We also patched the fallback ClientSession in send() (line 147) which was missing a timeout. Thanks for including tests! |
teknium1
added a commit
that referenced
this pull request
Mar 26, 2026
…ters (#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 #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>
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>
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 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>
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 28, 2026
…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 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.
SmsAdapter created aiohttp.ClientSession() without a timeout, so a slow or unresponsive Twilio API could hang the gateway event loop indefinitely. The send_message_tool already uses ClientTimeout(total=30) for its Twilio calls — this just applies the same default to the gateway SMS adapter.
Changes Made
gateway/platforms/sms.py: addtimeout=aiohttp.ClientTimeout(total=30)to ClientSession constructor inconnect()tests/gateway/test_sms_timeout.py: new test file — verifies session timeout on connect and sendHow to Test
pytest tests/gateway/test_sms_timeout.py -v— 2 tests passpytest tests/gateway/ -v— full gateway suite passes (1454 passed, 3 pre-existing failures unrelated)Checklist
pytest tests/ -qand all tests pass