Skip to content

fix(send_message): fix weixin aiohttp timeout and add gateway bridge fallback - #16074

Closed
JianFeiGan wants to merge 1 commit into
NousResearch:mainfrom
JianFeiGan:fix/weixin-aiohttp-timeout
Closed

fix(send_message): fix weixin aiohttp timeout and add gateway bridge fallback#16074
JianFeiGan wants to merge 1 commit into
NousResearch:mainfrom
JianFeiGan:fix/weixin-aiohttp-timeout

Conversation

@JianFeiGan

Copy link
Copy Markdown

Problem

When calling send_message from CLI or cron sessions to Weixin, the following error occurs:

Timeout context manager should be used inside a task

This is caused by aiohttp 3.10+ using asyncio.timeout() internally in ClientTimeout, which is incompatible with loop.run_until_complete() execution mode used by the Hermes CLI tool orchestration.

Solution

  1. Fix aiohttp timeout: Replace aiohttp.ClientTimeout(total=30) with asyncio.wait_for(..., timeout=30) wrapping the HTTP request.

  2. Add gateway bridge fallback: The _send_weixin function now attempts to send messages through the local Gateway HTTP Bridge first.

Impact

  • Fixes Weixin message delivery from CLI and cron jobs.
  • No breaking changes to existing behavior.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets platform/wecom WeCom / WeChat Work adapter labels Apr 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to multiple open PRs targeting the same Weixin aiohttp cross-loop bug: #14530, #12810, #13350, #13520. Consider consolidating.

@teknium1

teknium1 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for surfacing the weixin aiohttp timeout issue — it's real. The gateway-bridge fallback approach here is substantive enough (adds a new cross-process coordination path with assumptions about bridge availability, port discovery, HTTP retry semantics) that it needs a proper design review rather than an in-batch salvage. Closing for now; if you'd like to push this forward, the narrower "escape the aiohttp-needs-a-task context" fix in _send_weixin would probably land easier as a separate PR (e.g. wrapping in asyncio.ensure_future). The gateway bridge idea is worth a design doc / issue discussion first.

@teknium1 teknium1 closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists platform/wecom WeCom / WeChat Work adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants