Skip to content

fix(qqbot): accept is_reconnect kwarg in connect() matching base-class contract (#59272) - #59317

Closed
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/59272-qqbot-connect-is-reconnect-v2
Closed

fix(qqbot): accept is_reconnect kwarg in connect() matching base-class contract (#59272)#59317
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/59272-qqbot-connect-is-reconnect-v2

Conversation

@Tranquil-Flow

Copy link
Copy Markdown
Contributor

Summary

Fixes #59272QQAdapter.connect() raises TypeError: QQAdapter.connect() got an unexpected keyword argument 'is_reconnect' on every first connect, sending QQ into a permanent exponential-backoff reconnect loop (60s → 120s → 240s → 300s) until the platform is patched locally.

Root Cause

Commit 43b8ba418 (fix(telegram): preserve Bot API update queue on watcher reconnect) changed the abstract base class signature in gateway/platforms/base.py:

async def connect(self, *, is_reconnect: bool = False) -> bool:

Every other platform adapter (bluebubbles, signal, webhook, weixin, whatsapp_cloud, yuanbao, msgraph_webhook, api_server) was updated to match. QQAdapter was missed:

# gateway/platforms/qqbot/adapter.py:281
async def connect(self) -> bool:  # ← missing is_reconnect parameter

The gateway call sites at gateway/run.py:3395 and :3398 pass connect(is_reconnect=...), so QQAdapter raises TypeError immediately and never starts.

Fix

One-line signature change in gateway/platforms/qqbot/adapter.py:281:

- async def connect(self) -> bool:
+ async def connect(self, *, is_reconnect: bool = False) -> bool:

QQ is a stateless adapter — every connect performs a full fresh auth + WebSocket. Accepting and ignoring is_reconnect is the documented safe choice, identical to the WhatsApp / WeChat pattern.

Verification

Files Changed

 gateway/platforms/qqbot/adapter.py |  2 +-
 tests/gateway/test_qqbot.py        | 45 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 1 deletion(-)

Auto-published by Moonsong via Path B automated pipeline.

…s contract (NousResearch#59272)

QQAdapter.connect() was missed in the refactor that added
the keyword-only is_reconnect parameter to the base class
(commit 43b8ba4).  The gateway always passes
connect(is_reconnect=...) at gateway/run.py:3395 and :3398,
so QQ fails with TypeError on every first connect and enters
a permanent exponential-backoff reconnect loop.

The one-line signature fix adds
to match the base class and every other platform adapter.
QQ is a stateless adapter that does a full fresh auth on every
connect, so accepting and ignoring is_reconnect is safe —
the same pattern used by WhatsApp, WeChat, and other
stateless platforms.
@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 duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists labels Jul 6, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #52966 (earliest still-open canonical fix for the same QQAdapter.connect() is_reconnect signature gap, issue #52914). The cited earlier anchor #52922 is closed/unmerged, so the canonical shifts to the earliest open fix. Identical one-line signature change; part of a saturated cluster (#53540/#53546/#53948/#54029/#54037/#55494/#57677).

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused QQ reconnect-contract fix. This is now already implemented on current main.

  • 276542c729c10ff9d093760897f4c2d1256a79ce added is_reconnect: bool = False to QQAdapter.connect() in gateway/platforms/qqbot/adapter.py:281.
  • The merged change includes the equivalent QQ regression coverage in tests/gateway/test_qqbot.py:193, exercising both connect() and connect(is_reconnect=True).
  • The gateway still forwards this keyword through gateway/run.py:3500; the current implementation satisfies that contract.
  • This also confirms the duplicate-cluster context noted in the prior triage comment.

Automated hermes-sweeper review.

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

fix(qqbot): QQAdapter.connect() missing is_reconnect parameter — TypeError on reconnect

3 participants