Skip to content

fix(qqbot): accept is_reconnect kwarg on QQAdapter.connect - #60590

Closed
Linductor-alkaid wants to merge 1 commit into
NousResearch:mainfrom
Linductor-alkaid:fix/qqbot-accept-is-reconnect-kwarg
Closed

Linductor-alkaid wants to merge 1 commit into
NousResearch:mainfrom
Linductor-alkaid:fix/qqbot-accept-is-reconnect-kwarg

Conversation

@Linductor-alkaid

Copy link
Copy Markdown

Summary

The gateway reconnect watcher (gateway/run.py:7784) calls
adapter.connect(is_reconnect=True) after a prolonged outage so adapters with a
server-side update queue can preserve it (#46621). BasePlatformAdapter.connect
already declares the keyword (gateway/platforms/base.py:2864), and ~30 sibling
adapters implement the signature.

QQAdapter.connect was missed during that rollout: its signature still took no
arguments, so the keyword-only kwarg crashed with
TypeError: QQAdapter.connect() got an unexpected keyword argument 'is_reconnect'.
On a cold first boot the watcher does not pass the flag and the adapter connects
fine, but every reconnect attempt after an outage would throw before the WebSocket
opened, leaving QQ stuck disconnected until the gateway restarted.

Accept the kwarg for contract compliance. QQ Bot has no server-side queue
concept, so is_reconnect does not alter connection behaviour; this is a pure
signature fix that aligns the adapter with the abstract contract.

No behaviour change. No body changes.

Diff

-    async def connect(self) -> bool:
-        """Authenticate, obtain gateway URL, and open the WebSocket."""
+    async def connect(self, *, is_reconnect: bool = False) -> bool:
+        """Authenticate, obtain gateway URL, and open the WebSocket.
+
+        ``is_reconnect`` is part of the ``BasePlatformAdapter.connect``
+        contract (see ``#46621``). ..."""
         if not AIOHTTP_AVAILABLE:
             ...

Verification (planned before merge)

  • pytest tests/gateway/test_qqbot.py -q passes
  • Cold first boot of the QQ adapter still connects (no kwargs path)
  • Reconnect path no longer raises TypeError (is_reconnect=True accepted)

Refs #46621

The gateway reconnect watcher (gateway/run.py:7784) calls
`adapter.connect(is_reconnect=True)` on platforms that dropped after a
prolonged outage, so adapters with a server-side update queue can
preserve it (NousResearch#46621). `BasePlatformAdapter.connect` already declares
the keyword (gateway/platforms/base.py:2864), and ~30 sibling adapters
implement the signature.

`QQAdapter.connect` was missed during that rollout: its signature
still took no arguments, so the keyword-only kwarg crashed with
`TypeError: QQAdapter.connect() got an unexpected keyword argument
'is_reconnect'`. On a cold first boot the watcher doesn't pass the
flag and the adapter connects fine, but every reconnect attempt
after an outage would throw before the WebSocket opened, leaving QQ
stuck "disconnected" until the gateway restarted.

Accept the kwarg for contract compliance. QQ Bot has no server-side
queue concept, so `is_reconnect` does not alter connection
behaviour; this is a pure signature fix that aligns the adapter with
the abstract contract.

No behaviour change. No body changes.
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/qqbot QQ Bot adapter sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels Jul 8, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Duplicate of #52966 (earliest still-open canonical fix for #52914). This is the same one-line QQAdapter.connect(self, *, is_reconnect: bool = False) signature fix that the whole QQBot reconnect cluster addresses; gateway/platforms/qqbot/adapter.py on main still has the bare async def connect(self) -> bool signature, so the fix has not landed yet. The originally-cited anchor #52922 is CLOSED/unmerged, so #52966 is the canonical open target.

@Linductor-alkaid

Copy link
Copy Markdown
Author

Closing as a duplicate of #52966, which is the canonical fix for this issue:

Superseded by #52966. Keeping the local branch around in case anything
specifically diverges; happy to close that too if not needed.

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: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.

2 participants