Skip to content

fix(qqbot): accept is_reconnect parameter in QQAdapter.connect() - #57652

Closed
Minervaowl7 wants to merge 1 commit into
NousResearch:mainfrom
Minervaowl7:fix/qqbot-adapter-connect-is-reconnect
Closed

Minervaowl7 wants to merge 1 commit into
NousResearch:mainfrom
Minervaowl7:fix/qqbot-adapter-connect-is-reconnect

Conversation

@Minervaowl7

Copy link
Copy Markdown

Description

QQAdapter.connect() overrides BasePlatformAdapter.connect() but drops the is_reconnect keyword-only argument that the base class supports (and passes to every adapter on reconnection attempts).

When the gateway disconnects and attempts to reconnect, it calls adapter.connect(is_reconnect=True), which raises:

TypeError: QQAdapter.connect() got an unexpected keyword argument 'is_reconnect'

The adapter never connects, and the gateway loops forever with 5-minute reconnect intervals.

Fix

Add *, is_reconnect: bool = False to the connect() signature, matching the base class pattern already used by api_server.py and bluebubbles.py.

Testing

Confirmed on a live Hermes 0.18.0 gateway. Before the patch, the log shows 23 failed reconnect attempts with the TypeError. After the patch:

✓ [QQBot] Connected
✓ [QQBot] Identify sent
✓ [QQBot] Ready, session_id=...
✓ qqbot connected
Gateway running with 3 platform(s)

Closes #...

QQAdapter.connect() overrides BasePlatformAdapter.connect() but drops
the `is_reconnect` keyword-only argument that the base class supports.
When the gateway reconnects after a disconnect, it calls
adapter.connect(is_reconnect=True), causing a TypeError.

Fix by adding `*, is_reconnect: bool = False` to match the base class
signature, consistent with other platform adapters (api_server, bluebubbles).
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/qqbot QQ Bot adapter P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 3, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Duplicate of #52966 (earliest still-open fix PR for #52914). Identical one-line fix adding the keyword-only is_reconnect: bool = False param to QQAdapter.connect() to match BasePlatformAdapter.connect(). The historical canonical PR #52922 is now closed, so #52966 is the current anchor. Related open siblings in the same cluster: #53948, #54037, #54977, #57105. A maintainer should pick one to merge and close the rest.

@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for the focused QQBot reconnect fix. This is already implemented on current main.

  • Automated hermes-sweeper review verified QQAdapter.connect(self, *, is_reconnect: bool = False) at gateway/platforms/qqbot/adapter.py:281.
  • Commit 276542c729c10ff9d093760897f4c2d1256a79ce added the QQBot implementation and tests/gateway/test_qqbot.py:193 regression coverage for connect(is_reconnect=True).
  • The broader merged follow-up, PR fix(gateway): enforce reconnect contract across adapters #61767, also added a repository-wide adapter reconnect-contract test.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 15, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 15, 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 duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/qqbot QQ Bot adapter sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants