From 65f4d2d09989baa6c7ddd9431e6505173bf1e297 Mon Sep 17 00:00:00 2001 From: yiekheng Date: Sun, 10 May 2026 08:58:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(bot):=20revert=20qrTimeout=20=E2=80=94=20ke?= =?UTF-8?q?ep=20Baileys'=20native=2060/20s=20rotation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The earlier "QR refreshes every 5 s" bug was the session-manager auto-reconnect loop (commit 4d10c72), not the QR cadence. Baileys' default QR rotation (60 s first ref, then ~20 s per subsequent ref) is the correct native behaviour — each rotation just refreshes the displayed QR via SSE. Forcing qrTimeout=60s suppressed those legitimate rotations and made the QR feel stuck. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/bot/src/whatsapp/session.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/bot/src/whatsapp/session.ts b/apps/bot/src/whatsapp/session.ts index 88181d8..6cd2572 100644 --- a/apps/bot/src/whatsapp/session.ts +++ b/apps/bot/src/whatsapp/session.ts @@ -46,11 +46,11 @@ export async function startSession(params: { auth: state, browser: Browsers.macOS("Safari"), syncFullHistory: false, - // Default: 60 s for the first QR, 20 s for subsequent ones (~5 refs ≈ - // 2.5 min total before Baileys gives up). Set both legs to 60 s so - // the operator has the full ~5 min pairing window to scan, matching - // pair-handler's PAIR_TIMEOUT_MS. - qrTimeout: 60_000, + // Use Baileys' default QR cadence (60 s for the first ref, ~20 s for + // each subsequent ref) — that's the native WhatsApp Web cadence and + // each rotation just refreshes the displayed QR. The earlier "QR + // refresh every 5 s" bug was the session-manager reconnect loop, + // not the cadence. logger: logger.child({ accountId, component: "baileys" }) as never, });