fix(photon): launch the iMessage sidecar headless on Windows

plugins/platforms/photon/adapter.py launches the Node sidecar (and the
spectrum-ts mixed-attachment patch run) via subprocess without creationflags.
On Windows this opens a visible console window on every sidecar (re)start --
and because a failed sidecar is retried on a timer, it flashes repeatedly.

Wire windows_hide_flags() (hermes_cli/_subprocess_compat) into both spawns,
the same helper the discord and whatsapp adapters already use for their
sidecar spawns -- photon was the one platform adapter this pattern missed.
CREATE_NO_WINDOW only (no DETACHED_PROCESS) so the persistent sidecar's
stdin/stdout pipes stay usable for the supervisor.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jeff Watts 2026-06-28 22:28:16 -04:00 committed by Teknium
parent 4a69a6620e
commit d8f7b608c9

View file

@ -944,6 +944,10 @@ class PhotonAdapter(BasePlatformAdapter):
# never runs — can't leave it orphaned on the port.
env["PHOTON_SIDECAR_WATCH_STDIN"] = "1"
# Windows: hide the child console (0 elsewhere). Same helper the
# discord/whatsapp adapters use for their sidecar spawns.
from hermes_cli._subprocess_compat import windows_hide_flags
try:
patch = subprocess.run( # noqa: S603
[
@ -955,6 +959,9 @@ class PhotonAdapter(BasePlatformAdapter):
text=True,
timeout=10,
check=False,
# Windows: suppress the brief console flash this short-lived
# node patch run would otherwise pop on every sidecar start.
creationflags=windows_hide_flags(),
)
if patch.returncode != 0:
raise RuntimeError((patch.stderr or patch.stdout or "").strip())
@ -973,6 +980,10 @@ class PhotonAdapter(BasePlatformAdapter):
stderr=subprocess.STDOUT,
env=env,
start_new_session=(sys.platform != "win32"),
# Windows: run the persistent sidecar headless so it does not open
# (or leave) a visible console window. CREATE_NO_WINDOW only (no
# DETACHED_PROCESS) so the stdin/stdout pipes above stay usable.
creationflags=windows_hide_flags(),
)
# Pump sidecar stderr/stdout into our logger so users see crashes.