fix(weixin): replace aiohttp ClientTimeout with asyncio.wait_for in _api_post/_api_get - #31853
Closed
caojiguang wants to merge 1 commit into
Closed
Conversation
…api_post/_api_get Cron delivery to WeChat fails with 'Timeout context manager should be used inside a task' because _api_post and _api_get use aiohttp's ClientTimeout directly. When the cron scheduler calls send() via asyncio.run_coroutine_threadsafe(), aiohttp cannot find a running task and raises RuntimeError. _upload_media, _download_bytes, and _download_remote_media already use asyncio.wait_for() to avoid this. Apply the same pattern to _api_post and _api_get — the two remaining iLink API helpers that still use the raw ClientTimeout approach. This fixes cron delivery errors seen on the WeChat platform adapter when meyo-external cron jobs attempt to deliver output to WeChat.
|
Hi @caojiguang, nice fix! I independently found the same issue and wrote a regression test suite ( |
19 tasks
banditburai
added a commit
to banditburai/hermes-agent
that referenced
this pull request
May 30, 2026
The fix commit preserves @caojiguang's authorship (from NousResearch#31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
teknium1
pushed a commit
that referenced
this pull request
Jun 2, 2026
The fix commit preserves @caojiguang's authorship (from #31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
changman
pushed a commit
to changman/hermes-agent
that referenced
this pull request
Jun 10, 2026
The fix commit preserves @caojiguang's authorship (from NousResearch#31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
alt-glitch
pushed a commit
that referenced
this pull request
Jun 14, 2026
The fix commit preserves @caojiguang's authorship (from #31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
kossteg
pushed a commit
to kossteg/hermes-agent
that referenced
this pull request
Jun 16, 2026
The fix commit preserves @caojiguang's authorship (from NousResearch#31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
T02200059
pushed a commit
to T02200059/hermes-agent
that referenced
this pull request
Jun 18, 2026
The fix commit preserves @caojiguang's authorship (from NousResearch#31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
xyshanren
pushed a commit
to xyshanren/hermes-agent-cn
that referenced
this pull request
Jun 25, 2026
The fix commit preserves @caojiguang's authorship (from NousResearch#31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
The fix commit preserves @caojiguang's authorship (from NousResearch#31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
Contributor
|
Thanks for the focused Weixin timeout fix. This is already implemented on
|
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
The fix commit preserves @caojiguang's authorship (from NousResearch#31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
donbowman
pushed a commit
to donbowman/hermes-agent
that referenced
this pull request
Jul 13, 2026
The fix commit preserves @caojiguang's authorship (from NousResearch#31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
The fix commit preserves @caojiguang's authorship (from NousResearch#31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
The fix commit preserves @caojiguang's authorship (from NousResearch#31853); the release-notes AUTHOR_MAP gate requires their email to map to a GitHub username.
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.
Problem
Cron delivery to WeChat fails with:
This happens because
_api_postand_api_getuse aiohttp'sClientTimeoutdirectly. When the cron scheduler callssend()viaasyncio.run_coroutine_threadsafe(), aiohttp cannot find a running task and raisesRuntimeError.Fix
Replace
aiohttp.ClientTimeoutwithasyncio.wait_for()in_api_postand_api_get, following the same pattern already applied to_upload_media,_download_bytes, and_download_remote_media.The three helper functions above were already fixed to avoid this error (with comments explaining why).
_api_postand_api_getwere the remaining two iLink API helpers still using the rawClientTimeoutapproach.Notes
_send_sessionalready disables aiohttp timeouts entirely (total=None) to letasyncio.wait_for()manage timeouts externally — this is correct and unchanged.ClientTimeoutusage in weixin.py. Only the intentionally-disabled one on_send_sessionremains.