fix(qqbot): accept is_reconnect kwarg in QQAdapter.connect() - #59297
Closed
qiyin-code wants to merge 1 commit into
Closed
qiyin-code wants to merge 1 commit into
qiyin-code wants to merge 1 commit into
Conversation
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.
Contributor
Duplicate of #52966 (the earliest still-open canonical fix for #52914). This is the identical one-line |
Collaborator
|
Thanks for the focused QQBot reconnect fix. This is an automated hermes-sweeper review; the same behavioral fix is already on current
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
QQAdapter.connect()was defined without theis_reconnectkeyword argument:But the gateway calls it with
is_reconnect(in_connect_adapter_with_timeout,gateway/run.py:3395):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:This causes a
TypeErroron every connection attempt: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 = FalsetoQQAdapter.connect(), matching theBasePlatformAdapter.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
QQ_APP_IDandQQ_CLIENT_SECREThermes gateway run --replacegateway_state.json:Test Plan
gateway_state.jsonshowsqqbot.state: "connected"after gateway start