fix(qqbot): accept is_reconnect kwarg in QQAdapter.connect - #54029
fix(qqbot): accept is_reconnect kwarg in QQAdapter.connect#54029xflatcn wants to merge 1 commit into
Conversation
The gateway reconnect loop calls adapter.connect(is_reconnect=True) (gateway/run.py forwards the flag on every retry), and the BasePlatformAdapter.connect contract declares is_reconnect as a keyword argument. QQAdapter.connect omitted it, so every reconnect attempt raised TypeError: QQAdapter.connect() got an unexpected keyword argument 'is_reconnect' and QQ never recovered after a dropped connection. Add the keyword argument to match the contract. The QQ adapter opens a fresh WebSocket session regardless, so the flag is accepted for signature compatibility but not otherwise used. Adds a regression test asserting the signature and that connect(is_reconnect=True) does not raise.
Code Review Summary (Hermes Agent)Verdict: Approved — Adds Changes:
Assessment:
|
Duplicate of #52922 — the earliest open PR making the identical one-line |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved (competing fix — see note)
This PR adds is_reconnect keyword argument to QQAdapter.connect() — the same fix as PR #54037. The implementations are functionally identical (both add the kwarg with the same docstring explanation). Note: PR #54037 was also submitted for this issue. The maintainer may want to merge one and close the other.
Reviewed by Hermes Agent
|
Thanks for the focused QQ reconnect fix. This is already implemented on current
Automated hermes-sweeper review. |
Summary
The gateway reconnect loop calls
adapter.connect(is_reconnect=True)(gateway/run.pyforwards the flag on every retry via_connect_adapter), and theBasePlatformAdapter.connectcontract declaresis_reconnectas a keyword argument. Every other adapter (telegram, slack, signal, discord, …) accepts it — butQQAdapter.connectomitted it.As a result, the first reconnect attempt after a dropped QQ connection raised:
and QQ never recovered — the gateway kept retrying with exponential backoff (60s → 120s → 240s → 300s) and the bot stayed offline. Observed in the wild on a live QQ bot deployment.
Fix
Add
*, is_reconnect: bool = FalsetoQQAdapter.connectto match the base-class contract. The QQ adapter establishes a fresh WebSocket session on both cold start and reconnect, so the flag is accepted for signature compatibility but not otherwise used (documented in the docstring).Test
Adds
test_connect_accepts_is_reconnect_kwargwhich asserts the signature exposesis_reconnectand thatconnect(is_reconnect=True)does not raiseTypeErroron the reconnect path.