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
{{ message }}
Repository navigation
bug(macos): WhatsApp reconnect flow on Mac (needs repro) #1346
Parent: #830 (chat leftovers, 9 Sep report). Needs repro. platform: macOS. Verified against main @ 8e39053.
Report
WhatsApp reconnection is confusing or broken on Mac.
What we know
The reconnect logic is unchanged since the report: main/services/whatsapp.ts ~L915-945. A 401 (logged out) wipes the auth and forces a re-pair (new QR). Anything else auto-reconnects after RECONNECT_DELAY_MS.
queueCredentialWrite() queued saveCreds() asynchronously on creds.update, allowing an immediate 515 restartRequired reconnect or requestShutdown() to read stale/incomplete auth state before the write flushed. flushCredentialWrites() is now awaited before reconnect and during shutdown.
515 restartRequired vs 408 unpaired QR timeout:
Status 515 now triggers an immediate ~250ms reconnect without incrementing reconnectAttempts or setting lastError.
When 408 occurs with no registered credentials (creds.me?.id absent), the service stops background retry loops and transitions cleanly to disconnected so the user can explicitly generate a new QR code.
Reconnect vs re-pair UI state & pairing-code timer:
Status API now exposes hasRegisteredCredentials so the UI distinguishes transient reconnects from unpaired re-pair flows.
The 60s QR timeout timer skips waiting_pairing and restores pairingMode cleanly if a pairing-code request fails.
Activity
khaira777 commentedon Oct 26, 2026
Looking into this issue now.
khaira777 commentedon Oct 26, 2026
Reproduction and verification results for macOS WhatsApp reconnect and re-pair flow (addressed in #1385):
515 restartRequired& app quit):queueCredentialWrite()queuedsaveCreds()asynchronously oncreds.update, allowing an immediate515 restartRequiredreconnect orrequestShutdown()to read stale/incomplete auth state before the write flushed.flushCredentialWrites()is now awaited before reconnect and during shutdown.515 restartRequiredvs408unpaired QR timeout:515now triggers an immediate ~250ms reconnect without incrementingreconnectAttemptsor settinglastError.408occurs with no registered credentials (creds.me?.idabsent), the service stops background retry loops and transitions cleanly todisconnectedso the user can explicitly generate a new QR code.hasRegisteredCredentialsso the UI distinguishes transient reconnects from unpaired re-pair flows.waiting_pairingand restorespairingModecleanly if a pairing-code request fails.