Skip to content

fix(qqbot): accept is_reconnect kwarg in QQAdapter.connect() - #59297

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

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

Conversation

@qiyin-code

Copy link
Copy Markdown

Problem

QQAdapter.connect() was defined without the is_reconnect keyword argument:

async def connect(self) -> bool:

But the gateway calls it with is_reconnect (in _connect_adapter_with_timeout, gateway/run.py:3395):

return await adapter.connect(is_reconnect=is_reconnect)

Every other platform adapter (base.py, signal.py, webhook.py, yuanbao.py, msgraph_webhook.py, api_server.py, bluebubbles.py, whatsapp_cloud.py, weixin.py) accepts this parameter:

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

This causes a TypeError on every connection attempt:

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

The QQ bot can never connect — every reconnect attempt (every 5 min by the watcher) fails with the same error. The adapter enters a retry loop that can never succeed.

Fix

Add *, is_reconnect: bool = False to QQAdapter.connect(), matching the BasePlatformAdapter.connect() contract. The parameter is accepted but not yet used internally (the QQ adapter does not currently differentiate cold boot from reconnect), which is the same approach other adapters take when they accept the kwarg without acting on it.

Reproduction

  1. Configure a QQ bot with valid QQ_APP_ID and QQ_CLIENT_SECRET
  2. Start the gateway: hermes gateway run --replace
  3. Observe the error in gateway_state.json:
    "qqbot": {
      "state": "retrying",
      "error_message": "QQAdapter.connect() got an unexpected keyword argument 'is_reconnect'"
    }
  4. Logs show endless retry loop (every 300s) with the same TypeError

Test Plan

  • QQ bot connects successfully after this change
  • gateway_state.json shows qqbot.state: "connected" after gateway start
  • No regression in other platform adapters (they already accept this kwarg)

The gateway's _connect_adapter_with_timeout calls adapter.connect(is_reconnect=...)
(see gateway/run.py:3395,3398). Every other platform adapter accepts this keyword
argument, but QQAdapter.connect() was defined as
without the parameter, causing:

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

This prevents the QQ bot from ever connecting — every reconnect attempt (every 5 min
by the watcher) fails with the same TypeError. The adapter enters a retry loop that
can never succeed.

Fix: add  to the connect() signature, matching the
BasePlatformAdapter contract. The parameter is accepted but not yet used internally
(the QQ adapter does not differentiate cold boot from reconnect), which is the same
approach taken by other adapters that accept the kwarg without acting on it.
@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 6, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Duplicate of #52966 (the earliest still-open canonical fix for #52914). This is the identical one-line is_reconnect signature fix as the saturated QQBot cluster; verified the fix is not yet on main (gateway/platforms/qqbot/adapter.py still has the bare async def connect(self)). Prior anchor #52922 is closed/unmerged, so #52966 is canonical.

@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for the focused QQBot reconnect fix. This is an automated hermes-sweeper review; the same behavioral fix is already on current main.

  • gateway/platforms/qqbot/adapter.py:281 now defines connect(self, *, is_reconnect: bool = False).
  • tests/gateway/test_qqbot.py:193 covers both the default and explicit reconnect call forms.
  • The implementation landed in 276542c729c10ff9d093760897f4c2d1256a79ce (fix(qqbot): add is_reconnect param to QQAdapter.connect for gateway reconnect compat).
  • This also aligns with the earlier discussion pointing to the canonical QQ reconnect fix; the current code and regression coverage satisfy this PR's request.

@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