Skip to content

fix(whatsapp): hide bridge console window on Windows - #60605

Closed
vqardy wants to merge 1 commit into
NousResearch:mainfrom
vqardy:fix/whatsapp-bridge-hidden-window
Closed

fix(whatsapp): hide bridge console window on Windows#60605
vqardy wants to merge 1 commit into
NousResearch:mainfrom
vqardy:fix/whatsapp-bridge-hidden-window

Conversation

@vqardy

@vqardy vqardy commented Jul 8, 2026

Copy link
Copy Markdown

Summary

On Windows the WhatsApp bridge (node.exe ... whatsapp-bridge/bridge.js) is spawned with start_new_session=True, which is a no-op on Windowssubprocess accepts the kwarg but ignores it, so the long-lived bridge pops a visible black console window. Closing it kills the bridge, and the gateway's reconnection watcher relaunches it, so it never stays closed.

Other subprocess calls in the same file (_kill_stale_bridge_by_pidfile, _kill_port_process) already use windows_hide_flags() (CREATE_NO_WINDOW); the bridge spawn simply omitted it.

Change

Add creationflags=windows_hide_flags() to the bridge Popen. windows_hide_flags() returns 0 on POSIX, so this is a no-op there. Bridge output still routes to the log file, so stdio capture is unaffected.

Verification

  • Live bridge now reports MainWindowHandle=0 (no window) and the gateway logs ✓ whatsapp connected.
  • tests/gateway/test_whatsapp_connect.py (29 tests), test_whatsapp_stale_bridge.py, test_whatsapp_reply_prefix.py pass.
  • test_whatsapp_bridge_pidfile.py::TestKillPortProcess::test_kill_port_spares_client_process is pre-existing flaky on Windows (real socket + taskkill timing) — fails identically on unmodified code.

🤖 Generated with Hermes Agent

The Node WhatsApp bridge is spawned with start_new_session=True, which is
a no-op on Windows (subprocess silently ignores it), so the long-lived
bridge pops a visible black console window. Other subprocess calls in this
file already use windows_hide_flags() (CREATE_NO_WINDOW); apply it to the
bridge spawn too. Returns 0 on POSIX, so it is a no-op there.

Output still routes to the bridge log file, so stdio capture is unaffected.
@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins platform/whatsapp WhatsApp Business adapter platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows P3 Low — cosmetic, nice to have labels Jul 8, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Competing fix cluster for the WhatsApp bridge console window on Windows (issue #60508 / closed #29715). Three OPEN PRs:

All fix the same symptom; #59285 is the more complete fix (hide + detach addresses the crash-loop, not just the visible window). Flagging for a maintainer to pick one.

@teknium1

teknium1 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for this PR — the underlying bug (WhatsApp bridge spawning Node with a visible console window on Windows) is now fixed on main via #60924, a salvage of #60647 which swaps the bare start_new_session=True for the shared windows_detach_popen_kwargs() helper. Several PRs targeted this same symptom; we merged the minimal variant that reuses the sanctioned helper. Your report/fix helped confirm the bug class — appreciated. Closing as superseded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/whatsapp WhatsApp Business adapter platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants