fix(qqbot): accept is_reconnect kwarg in QQAdapter.connect - #58128
fix(qqbot): accept is_reconnect kwarg in QQAdapter.connect#58128Timeral wants to merge 1 commit into
Conversation
Duplicate of #52966 -- identical one-line contract-conformance fix adding the keyword-only |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved (LGTM)
Contract conformance fix for QQAdapter.connect(). Adds is_reconnect kwarg to match the BasePlatformAdapter interface, with clear explanation of why no special reconnect logic is needed for QQBot. Clean and minimal.
What Looks Good
- Minimal, targeted change
- Clear explanation of design rationale
- No security or debug artifacts
Reviewed by Hermes Agent
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
Tiny fix (+7/-2) accepting is_reconnect kwarg in QQAdapter.connect.
Looks Good
- Minimal change, correct pattern
- No security or performance concerns
Reviewed by Hermes Agent
tonydwb
left a comment
There was a problem hiding this comment.
Supplementary review: confirms LGTM. QQAdapter is_reconnect kwarg fix is a small, clean addition. Prior COMMENT found no issues. No additional concerns.
Reviewed by Hermes Agent
|
Thanks for the focused QQBot contract fix. The requested behavior is already on current
This is an automated hermes-sweeper review. |
Summary
QQAdapter.connect()violated theBasePlatformAdapter.connect(*, is_reconnect: bool = False)contract introduced in #52844 — it was bareasync def connect(self). The gateway's reconnect watcher (gateway/run.py) recovers a platform after a fatal adapter error by building a fresh adapter and callingconnect(is_reconnect=True). For QQBot, that call raised:so the watcher could never re-establish QQBot through the fatal-recovery path.
Live symptom
After a fatal QQBot adapter error (e.g. WebSocket close that exhausts the in-process retry ladder), the watcher's
Reconnecting qqbot (attempt N)...step crashes with theTypeError. QQBot never comes back online, and the bot stops responding to messages until a full gateway restart.Why QQBot doesn't need special reconnect logic for the flag (contract conformance only)
is_reconnectexists so adapters with a server-side update queue (e.g. Telegram's Bot API) preserve that queue across an outage instead of dropping it (#52844). QQBot has no such queue — the QQ gateway delivers messages over the live WebSocket connection, and the adapter re-authenticates with a fresh/gatewayrequest on every connect(). There is no server-side state to preserve, and the watcher already disconnects the old adapter (cancelling the WebSocket supervisor) before building a fresh one.So QQBot must accept the kwarg for contract conformance, and correctly has nothing special to do with it at the adapter layer — the existing
connect()body already handles both cold boot and reconnect correctly once theTypeErroris removed.Changes
gateway/platforms/qqbot/adapter.py: Added*, is_reconnect: bool = FalsetoQQAdapter.connect()to match theBasePlatformAdaptercontract. Updated docstring to document the parameter.Tests
Existing
test_connect_uses_redirect_guard_hookcallsadapter.connect()withoutis_reconnect, which continues to work (the parameter defaults toFalse). No regression risk.