Bug Description
I added a scheduled reminder task to send a notification via WeChat, but when the reminder is triggered, the gateway exits and cannot be automatically restarted; it can only be restarted manually.
- Hermes Agent v0.10.x
- Python 3.11
- Platform: WeChat via iLink Bot API
When calling send_message with target=weixin, the message fails to send and throws:
Weixin send failed: Timeout context manager should be used inside a task
This error occurs consistently when attempting to send any message to WeChat, regardless of message content or recipient. The asyncio.timeout() context manager is being called outside of an async task context.
Steps to Reproduce
- Connect WeChat account to Hermes
- Send a message via send_message to a WeChat target (e.g., send_message(target="weixin", message="test"))
- Observe the error in logs/response
Expected Behavior
Messages should be sent successfully to WeChat without asyncio context errors.
Actual Behavior
Error: "Timeout context manager should be used inside a task"
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp)
Messaging Platform (if gateway-related)
N/A (CLI only)
Debug Report
2026-04-20 10:00:53,891 INFO agent.auxiliary_client: Vision auto-detect: using main provider alibaba-sub (qwen3.6-plus)
2026-04-20 10:00:54,511 INFO agent.auxiliary_client: Auxiliary auto-detect: using main provider custom (qwen3.6-plus)
2026-04-20 10:08:28,370 INFO gateway.run: Stopping gateway for restart...
2026-04-20 10:08:28,372 INFO gateway.platforms.feishu: [Feishu] Disconnected
2026-04-20 10:08:28,372 INFO gateway.run: ✓ feishu disconnected
2026-04-20 10:08:28,374 INFO gateway.platforms.weixin: [Weixin] Disconnected
2026-04-20 10:08:28,374 INFO gateway.run: ✓ weixin disconnected
2026-04-20 10:08:28,375 INFO gateway.run: Gateway stopped
Operating System
MacOS 25.4.0
Python Version
Python: 3.11.15
Hermes Version
Hermes Agent v0.10.0 (2026.4.16)
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
果然复现了!微信发送失败,错误信息:
Timeout context manager should be used inside a task
这是一个异步上下文的问题——微信发送功能需要在内置 task 中调用,不能直接在外层使用 send_message。这可能就是之前会话中断的原因。
结论:微信通道存在 bug,直接调用 send_message 到微信会抛出异常。这个问题需要修复微信的发送逻辑,让它在非异步上下文中也能正常工作。
Proposed Fix (optional)
No response
Are you willing to submit a PR for this?
Bug Description
I added a scheduled reminder task to send a notification via WeChat, but when the reminder is triggered, the gateway exits and cannot be automatically restarted; it can only be restarted manually.
When calling send_message with target=weixin, the message fails to send and throws:
Weixin send failed: Timeout context manager should be used inside a task
This error occurs consistently when attempting to send any message to WeChat, regardless of message content or recipient. The asyncio.timeout() context manager is being called outside of an async task context.
Steps to Reproduce
Expected Behavior
Messages should be sent successfully to WeChat without asyncio context errors.
Actual Behavior
Error: "Timeout context manager should be used inside a task"
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp)
Messaging Platform (if gateway-related)
N/A (CLI only)
Debug Report
2026-04-20 10:00:53,891 INFO agent.auxiliary_client: Vision auto-detect: using main provider alibaba-sub (qwen3.6-plus) 2026-04-20 10:00:54,511 INFO agent.auxiliary_client: Auxiliary auto-detect: using main provider custom (qwen3.6-plus) 2026-04-20 10:08:28,370 INFO gateway.run: Stopping gateway for restart... 2026-04-20 10:08:28,372 INFO gateway.platforms.feishu: [Feishu] Disconnected 2026-04-20 10:08:28,372 INFO gateway.run: ✓ feishu disconnected 2026-04-20 10:08:28,374 INFO gateway.platforms.weixin: [Weixin] Disconnected 2026-04-20 10:08:28,374 INFO gateway.run: ✓ weixin disconnected 2026-04-20 10:08:28,375 INFO gateway.run: Gateway stoppedOperating System
MacOS 25.4.0
Python Version
Python: 3.11.15
Hermes Version
Hermes Agent v0.10.0 (2026.4.16)
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
果然复现了!微信发送失败,错误信息:
Timeout context manager should be used inside a task
这是一个异步上下文的问题——微信发送功能需要在内置 task 中调用,不能直接在外层使用 send_message。这可能就是之前会话中断的原因。
结论:微信通道存在 bug,直接调用 send_message 到微信会抛出异常。这个问题需要修复微信的发送逻辑,让它在非异步上下文中也能正常工作。
Proposed Fix (optional)
No response
Are you willing to submit a PR for this?