Skip to content

[WeChat] asyncio.timeout bug and session expiration not handled gracefully #12154

@lxgxdx

Description

@lxgxdx

Bug Description

Two related issues with the WeChat (Weixin) platform integration in Hermes Gateway:

Issue 1: asyncio.timeout used outside task context

Error log:

[Weixin] send chunk failed to=o9cq808U attempt=1/3, retrying in 1.00s: Timeout context manager should be used inside a task
[Weixin] send chunk failed to=o9cq808U attempt=2/3, retrying in 2.00s: Timeout context manager should be used inside a task
[Weixin] send failed to=o9cq808U: Timeout context manager should be used inside a task

This error occurs when trying to send messages via WeChat. The asyncio.timeout() context manager is being used outside of an async task, which causes the error and prevents message delivery.

Issue 2: iLink session token expiration not handled gracefully

Error log:

[Weixin] Session expired; pausing for 10 minutes

When the iLink Bot API session/token expires, the system pauses for 10 minutes rather than attempting to re-authenticate or notify the user. The session expiration is not handled gracefully - users need to manually re-scan the QR code to re-authenticate.

Environment

  • Hermes Agent v0.10.0 (2026.4.16)
  • Python 3.11.15
  • Platform: WeChat via iLink Bot API

Expected Behavior

  1. Fix the asyncio.timeout bug so messages can be sent successfully
  2. Handle iLink session expiration more gracefully (auto-retry re-authentication or user notification)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsplatform/wecomWeCom / WeChat Work adaptertype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions