Skip to content

fix(photon): hide sidecar console window on Windows - #56610

Closed
xIGBClutchIx wants to merge 1 commit into
NousResearch:mainfrom
xIGBClutchIx:fix/photon-sidecar-hide-window
Closed

fix(photon): hide sidecar console window on Windows#56610
xIGBClutchIx wants to merge 1 commit into
NousResearch:mainfrom
xIGBClutchIx:fix/photon-sidecar-hide-window

Conversation

@xIGBClutchIx

Copy link
Copy Markdown

Summary

The Photon platform adapter spawns a Node sidecar (node.exe) via subprocess.Popen but was missing creationflags=windows_hide_flags(). Every other subprocess spawn in the codebase uses this flag; the Photon adapter was the only one that missed it.

On Windows, when pythonw.exe (the gateway process) spawns node.exe without CREATE_NO_WINDOW, Windows allocates a new console for the child process. This console window appears visibly on the user's desktop, titled with the node binary path (e.g. C:\Users\camer\.vite-plus\bin\node.EXE).

Fix

Two-line change in plugins/platforms/photon/adapter.py:

  1. Import windows_hide_flags from hermes_cli._subprocess_compat (the same helper used by 20+ other call sites across the codebase).
  2. Pass creationflags=windows_hide_flags() to the subprocess.Popen call at _start_sidecar().

Test Plan

  • On Windows with Photon enabled, restart the gateway and confirm no visible node.exe console window appears on the desktop
  • Confirm the Photon sidecar still starts and /healthz comes up normally
  • Confirm iMessage send/receive still works through the sidecar

The Photon sidecar's subprocess.Popen was missing creationflags=windows_hide_flags(),
unlike every other subprocess spawn in the codebase. On Windows, pythonw.exe spawning
node.exe without CREATE_NO_WINDOW causes a visible console window to appear on the
desktop titled with the node binary path.
@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have labels Jul 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #55554 — both add windows_hide_flags() / CREATE_NO_WINDOW to the Photon Node sidecar subprocess.Popen in _start_sidecar() (plugins/platforms/photon/adapter.py), same code site and mechanism. #55554 is the earlier canonical PR and also covers the sidecar-patch subprocess.run call. Also related to #54565, which is the broader superset (core gateway/status.py ps-fallback popup-storm guard plus the same photon-adapter hidden-flag change).

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for addressing the persistent Photon sidecar window. The Popen change is correct: windows_hide_flags() returns CREATE_NO_WINDOW on Windows and preserves the sidecar's stdio pipes (hermes_cli/_subprocess_compat.py:186).

Problems

  • PhotonAdapter._start_sidecar() also invokes the Node patch script through subprocess.run at plugins/platforms/photon/adapter.py:948. That call has no creationflags, so it can still flash a console on each sidecar start. Please apply the same helper there.
  • Please add a Photon-specific behavioral regression test covering both child-process calls. The current Photon test directory has no headless/creationflags test.

Suggested changes

  • Pass creationflags=windows_hide_flags() to the patch subprocess.run and the persistent sidecar subprocess.Popen.
  • Mock those calls in a lifecycle test and assert both receive the Windows hide flag.

Automated hermes-sweeper review.

@teknium1 teknium1 added the sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users label Jul 15, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the fix — this was a real bug, confirmed on main. It was independently fixed by five contributors; we merged the earliest submission (#54565 by @lEWFkRAD, Jun 29) via PR #65441, which uses the repo's shared windows_hide_flags() helper from hermes_cli/_subprocess_compat.py and covers the npm self-heal spawn sites as well. Your PR is credited in the merged PR body. Closing as a duplicate — thanks again!

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 duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have platform/windows Native Windows-specific behavior or breakage sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users 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