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
fix(whatsapp): prevent duplicate startup sockets and add diagnostics #687
After restarting Flo Cafe on macOS with WhatsApp already paired, the app can report that it is disconnected until the user manually disconnects and reconnects. The fallback share flow can also report that WhatsApp failed to open.
Findings
WhatsApp initialization is currently reachable from two startup paths.
Socket creation checks for an existing socket before asynchronous auth and Baileys setup completes, allowing concurrent sockets to share one auth state.
The renderer fallback uses window.open while Electron opens external URLs asynchronously, so the renderer cannot observe an external-open failure.
Existing packaged logs do not contain enough WhatsApp lifecycle detail to diagnose the failure.
Scope
Keep one WhatsApp startup owner and serialize socket startup/reconnect work.
Add redacted lifecycle, phase, connection, reconnect, and send-result diagnostics.
Keep credentials, QR data, message bodies, phone numbers, and tokens out of logs.
Add a result-bearing and wa.me-constrained external-open path.
Add regression and integration coverage for the startup race and opener result.
Acceptance criteria
A cold restart with persisted WhatsApp credentials creates one socket attempt and reaches connected without manual reconnect.
Concurrent startup requests create one socket.
Reconnect and startup failures produce stable status reasons and useful redacted logs.
WhatsApp share failures are reported only when the system opener fails.
Tests cover the new behavior and existing WhatsApp flows remain green.
Work in progress. Investigation found duplicate WhatsApp initialization during startup, allowing concurrent Baileys sockets to use the same persisted auth state. The fix will serialize socket startup, add redacted lifecycle diagnostics, and make external WhatsApp-open failures observable.
Activity
khaira777 commentedon Sep 9, 2026
Work in progress. Investigation found duplicate WhatsApp initialization during startup, allowing concurrent Baileys sockets to use the same persisted auth state. The fix will serialize socket startup, add redacted lifecycle diagnostics, and make external WhatsApp-open failures observable.
khaira777 commentedon Sep 10, 2026
closed in #688