From ec7e92082d15074339c8e7449eebf7b8ede3bd4d Mon Sep 17 00:00:00 2001 From: fengtianyu88 Date: Mon, 20 Apr 2026 22:48:12 +0800 Subject: [PATCH] fix(qqbot): add backoff upper-bound check for QQCloseError reconnect path The QQCloseError (non-4008) reconnect path in _listen_loop was missing the MAX_RECONNECT_ATTEMPTS upper-bound check that exists in both the Exception handler (line 546) and the 4008 rate-limit handler (line 486). Without this check, if _reconnect() fails permanently for any non-4008 close code, backoff_idx grows indefinitely and the bot retries forever at 60-second intervals instead of giving up cleanly. Fix: add the same guard after backoff_idx += 1 in the general QQCloseError branch, consistent with the existing Exception path. --- gateway/platforms/qqbot/adapter.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gateway/platforms/qqbot/adapter.py b/gateway/platforms/qqbot/adapter.py index df3987f2eb..9328464584 100644 --- a/gateway/platforms/qqbot/adapter.py +++ b/gateway/platforms/qqbot/adapter.py @@ -535,6 +535,9 @@ class QQAdapter(BasePlatformAdapter): quick_disconnect_count = 0 else: backoff_idx += 1 + if backoff_idx >= MAX_RECONNECT_ATTEMPTS: + logger.error("[%s] Max reconnect attempts reached (QQCloseError)", self._log_tag) + return except Exception as exc: if not self._running: