Skip to content

fix(qqbot): keep reconnecting after closed websocket#17704

Closed
hoaresky wants to merge 1 commit into
NousResearch:mainfrom
hoaresky:fix/qqbot-closed-ws-reconnect
Closed

fix(qqbot): keep reconnecting after closed websocket#17704
hoaresky wants to merge 1 commit into
NousResearch:mainfrom
hoaresky:fix/qqbot-closed-ws-reconnect

Conversation

@hoaresky

Copy link
Copy Markdown

Summary

  • Treat an already-closed QQBot websocket as an error in _read_events()
  • Keep the listener on the existing reconnect path after a failed reconnect leaves self._ws closed
  • Add a regression test for closed-but-present websocket objects

Fixes #17703

Test Plan

  • python -m pytest tests/gateway/test_qqbot.py -q

@teknium1

Copy link
Copy Markdown
Contributor

This looks implemented on current main. Automated hermes-sweeper review found that PR #17704’s closed-websocket reconnect fix is already present, with regression coverage.

Evidence:

  • gateway/platforms/qqbot/adapter.py:684 now checks self._ws.closed on entry to _read_events() and raises RuntimeError("WebSocket closed").
  • gateway/platforms/qqbot/adapter.py:639 routes that exception through the existing reconnect path, including _mark_transport_disconnected(), pending-future failure handling, and _reconnect(backoff_idx).
  • tests/gateway/test_qqbot.py:2210 covers the closed-but-present websocket case by setting adapter._ws = SimpleNamespace(closed=True) and asserting _read_events() raises.
  • The implementation landed in 3eeca4613d618618093db416b564a2b9ef8dbe6a (fix(qqbot): stop 100% CPU spin when WebSocket is closed but not None (#31193, #31771) (#40574)).

Thanks for the original report and patch — this path is now covered on main.

@teknium1 teknium1 closed this Jun 10, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jun 10, 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/qqbot QQ Bot adapter sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QQBot stops reconnecting after failed reconnect leaves websocket closed

3 participants