You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The BasePlatformAdapter contract requires connect() to accept an is_reconnect keyword argument, forwarded from the gateway reconnect watcher. The QQ adapter's connect() signature didn't include it, causing a TypeError on reconnect attempts.
Fix
Added is_reconnect: bool = False as a keyword-only parameter to QQAdapter.connect(). The parameter is not currently used by the QQ adapter internally, but accepting it satisfies the BasePlatformAdapter contract and prevents a crash when the gateway attempts to reconnect a dropped QQ bot session.
Scope note for reviewers: this PR is titled/described as the QQBot connect(is_reconnect=...) contract fix, but the diff also bundles an undisclosed access-control change in gateway/platforms/qqbot/adapter.py: it introduces a pairing policy and flips the defaultdm_policy and group_policy from open to pairing (fail-closed), reworking _is_dm_allowed/_is_group_allowed and adding _is_dm_intake_allowed()/_open_dm_opted_in() (the open DM policy now requires a GATEWAY_ALLOW_ALL_USERS/QQ_ALLOW_ALL_USERS opt-in). That is a behavior change on upgrade and should be reviewed/decided on its own merits. The one-line reconnect fix itself is the same as the #52966 cluster (#56741, #54029, etc.); this PR is related, not a clean duplicate, because of the extra ACL scope.
@alt-glitch Thanks for the thorough review — you're right that the ACL changes are unrelated to the is_reconnect fix and should not have been bundled in the same PR.
I'll split this PR: keep the one-line connect(is_reconnect=...) contract fix here, and submit the ACL/pairing policy changes as a separate PR with its own rationale and discussion. Updating the branch shortly.
Thanks for the targeted reconnect-contract fix. This automated hermes-sweeper review found that current main already implements and tests the exact guarantee.
gateway/run.py:8011-8013 invokes the reconnect path with is_reconnect=True.
Commit 276542c729c10ff9d093760897f4c2d1256a79ce added this implementation and tests/gateway/test_qqbot.py:193-206 covers both default and explicit reconnect calls.
The current PR diff is not usable as a replacement: it deletes the adapter body and leaves RESTORE_PLACEHOLDER.
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
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
The
BasePlatformAdaptercontract requiresconnect()to accept anis_reconnectkeyword argument, forwarded from the gateway reconnect watcher. The QQ adapter'sconnect()signature didn't include it, causing aTypeErroron reconnect attempts.Fix
Added
is_reconnect: bool = Falseas a keyword-only parameter toQQAdapter.connect(). The parameter is not currently used by the QQ adapter internally, but accepting it satisfies theBasePlatformAdaptercontract and prevents a crash when the gateway attempts to reconnect a dropped QQ bot session.