Skip to content

fix(qqbot): accept is_reconnect kwarg in connect() to match base adapter interface - #53546

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

fix(qqbot): accept is_reconnect kwarg in connect() to match base adapter interface#53546
ulnit wants to merge 1 commit into
NousResearch:mainfrom
ulnit:fix/qqbot-connect-is-reconnect-param

Conversation

@ulnit

@ulnit ulnit commented Jun 27, 2026

Copy link
Copy Markdown

Problem

The QQ bot adapter's connect() method does not accept the is_reconnect keyword argument that gateway/run.py passes during reconnection:

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

This causes an infinite crash-restart loop — the gateway catches the TypeError, waits 60s, retries, crashes again.

Root Cause

gateway/run.py line 3132 calls:

return await adapter.connect(is_reconnect=is_reconnect)

The base class (base.py) defines:

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

All other platform adapters already implement this signature:

  • signal.py
  • weixin.py
  • whatsapp_cloud.py
  • bluebubbles.py
  • yuanbao.py
  • api_server.py
  • qqbot/adapter.py ❌ — missing the parameter

Fix

One-line change to match the base class interface:

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

Verification

  • All 161 tests in tests/gateway/test_qqbot.py pass
  • Change is backward compatible (keyword-only with default value)
  • QQ bot successfully connects after applying the fix

…ter interface

gateway/run.py passes is_reconnect=True to adapter.connect() during
reconnection, but QQAdapter.connect() did not accept this parameter,
causing TypeError and an infinite crash-restart loop.

All other platform adapters (signal, weixin, whatsapp_cloud, bluebubbles,
yuanbao, api_server) already accept this parameter per the base class
signature. This brings qqbot in line with the established interface.

Fixes: QQ bot stuck in reconnect loop with error:
  QQAdapter.connect() got an unexpected keyword argument 'is_reconnect'
@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 labels Jun 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #52922 (earliest open canonical fix for #52914). Identical one-line connect(self, *, is_reconnect: bool = False) signature fix in gateway/platforms/qqbot/adapter.py. This is a saturated cluster — #52966 and #53540 are also tracking against #52922. Cross-linking so a maintainer can pick the canonical one.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Adds is_reconnect keyword argument to QQAdapter.connect() to match the base adapter interface. Minimal one-line change.

Note

  • Competing fix: PR #53540 by a different author implements the identical change. Either PR can be merged; the other should be closed.

Reviewed by Hermes Agent

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused QQBot reconnect fix. This is an automated hermes-sweeper review; current main already provides the exact requested behavior.

  • gateway/platforms/qqbot/adapter.py:281 already defines async def connect(self, *, is_reconnect: bool = False) -> bool.
  • gateway/run.py:3463 and gateway/run.py:3466 forward is_reconnect to every adapter, matching the base contract at gateway/platforms/base.py:2887.
  • Commit 276542c729c10ff9d093760897f4c2d1256a79ce implemented this QQBot fix and added coverage in tests/gateway/test_qqbot.py:193; current main also has a repository-wide adapter contract regression test.
  • The duplicate discussion correctly identified this as part of the same saturated QQBot-fix cluster.

@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 type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants