Skip to content

fix(qqbot): raise RuntimeError in _read_events when WebSocket is closed - #31151

Closed
ilonagaja509-glitch wants to merge 1 commit into
NousResearch:mainfrom
ilonagaja509-glitch:fix/qqbot-reconnect
Closed

ilonagaja509-glitch wants to merge 1 commit into
NousResearch:mainfrom
ilonagaja509-glitch:fix/qqbot-reconnect

Conversation

@ilonagaja509-glitch

Copy link
Copy Markdown
Contributor

When reconnect fails (e.g., _get_gateway_url() times out), the old closed WebSocket object was not None but had closed=True. The guard if not self._ws passed, but the while loop while self._ws and not self._ws.closed never executed, causing _read_events to return silently. This led to an infinite silent loop with no retry attempts.

Fix by checking both not self._ws and self._ws.closed in the guard.

Fixes #31101

Checklist

  • I have read the CONTRIBUTING.md guidelines
  • Code compiles without warnings
  • Tests pass locally
  • New tests added for the fix

When reconnect fails (e.g., _get_gateway_url() times out), the old closed
WebSocket object was not None but had closed=True. The guard
passed, but the while loop  never
executed, causing _read_events to return silently. This led to an infinite
silent loop with no retry attempts.

Fix by checking both  and  in the guard.

Fixes NousResearch#31101
@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/qqbot QQ Bot adapter duplicate This issue or pull request already exists labels May 23, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

Duplicate of #17704 (oldest open fix for #17703). Also duplicates #25070 and #20994. All add self._ws.closed check to _read_events() guard in qqbot/adapter.py to prevent silent loop after failed reconnect.

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 duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/qqbot QQ Bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QQ Bot adapter: _read_events() silent loop after reconnect failure prevents further retries

2 participants