Skip to content

fix: avoid cross-loop session reuse in Weixin direct sends - #14384

Closed
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix/weixin-cross-loop-send-file-13305
Closed

fix: avoid cross-loop session reuse in Weixin direct sends#14384
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix/weixin-cross-loop-send-file-13305

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Summary

  • only reuse the live Weixin adapter when its send session belongs to the current event loop
  • fall back to a fresh one-shot aiohttp session for cross-loop media sends
  • add regression coverage for same-loop reuse and cross-loop fallback

Testing

  • python3 -m pytest -o addopts='' tests/gateway/test_weixin.py

Closes #13305.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/wecom WeCom / WeChat Work adapter labels Apr 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing fix with #13350, #13520, #12810 — all address same cross-loop Weixin session reuse bug. Maintainers should pick one.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing fix with #13350, #13520, #12810.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused regression fix. The member discussion correctly identified this as one of several competing fixes; current main already implements the requested behavior.

Automated hermes-sweeper review evidence:

  • a22465e07ab4b71019f711e7a6463f6590c50742 (fix(weixin): send_weixin_direct cross-loop session check) fixes the same aiohttp cross-loop TimerContext failure described here.
  • gateway/platforms/weixin.py:2307-2336 reuses the live adapter only when send_session._loop is asyncio.get_running_loop(); a different-loop session falls through to a new aiohttp.ClientSession for text and media delivery.
  • The fix shipped in v2026.5.7.

Closing as already implemented on current main.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/wecom WeCom / WeChat Work adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: weixin send file failed

3 participants