mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
WhatsApp always closes the pairing socket with DisconnectReason.restartRequired (515) right after a successful QR scan, so the login flow treated every successful scan as "connection closed". Recreate the socket with the saved credentials and keep waiting for the open event instead, matching the openclaw reference behavior. Also restart on QR rotation timeout (408) to serve a fresh QR, bounded by a restart limit. Tested: - cd adapters && bun test (397 pass) - cd adapters && bunx tsc --noEmit -p tsconfig.json - bun test src/server/__tests__/adapters.test.ts