fix(photon): launch the iMessage sidecar headless on Windows - #54565
fix(photon): launch the iMessage sidecar headless on Windows#54565lEWFkRAD wants to merge 2 commits into
Conversation
c871371 to
2df43ea
Compare
2df43ea to
d8864ff
Compare
b8f1d7a to
a49d068
Compare
|
Rebased onto current main and slimmed to the one fix main still needs. Dropped as already-upstream: the gateway/status.py ps.exe guard (main now has the _IS_WINDOWS gate + psutil fallback via cb982ad/9a0010fd4) and the MoA streaming/reference-cap commit (call_llm streams natively now, and main deliberately imposes no reference cap - not re-adding that). What remains: the photon adapter Popen/patch-run spawns, which were the one messaging adapter missed when discord/whatsapp got windows_hide_flags() - now wired to that same canonical helper instead of a raw CREATE_NO_WINDOW constant. tests/plugins/platforms/photon: 104 passed (4 pre-existing POSIX-only failures reproduce on pristine main); test_windows_subprocess_no_window_flags.py: 15/15. |
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>
a49d068 to
18a50cf
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for narrowing this to the two Photon child-process spawns. The premise remains valid on current main: plugins/platforms/photon/adapter.py:948 and :969 invoke subprocess.run and subprocess.Popen without creationflags. The proposed windows_hide_flags() use matches its documented behavior in hermes_cli/_subprocess_compat.py:186-201: CREATE_NO_WINDOW on Windows, no detachment, and preserved stdio pipes.
Problems
- No PR test protects these two call sites.
tests/plugins/platforms/photon/test_sidecar_lifecycle.py:127-171already captures the sidecarPopenkwargs, but it does not assertcreationflagsand does not exercise the patchsubprocess.runcall.
Suggested changes
- Extend that lifecycle test to simulate the compatibility helper's Windows mode, capture both spawns, and assert both receive
windows_hide_flags().
This is an automated hermes-sweeper review.
| stderr=subprocess.STDOUT, | ||
| env=env, | ||
| start_new_session=(sys.platform != "win32"), | ||
| # Windows: run the persistent sidecar headless so it does not open |
There was a problem hiding this comment.
Please add a Photon-specific regression test that simulates Windows and asserts this Popen call and the patch subprocess.run call both receive creationflags=windows_hide_flags(). The existing lifecycle test already captures Popen kwargs but currently only checks stdin and the EOF-watch environment.
|
Merged via PR #65441 — your two commits were cherry-picked onto current main with your authorship preserved in git log (d8f7b60, d68ac90), plus a small follow-up widening the same fix to the npm dep self-heal spawn sites. You were the earliest of five contributors to fix this bug, and your implementation (shared |
Widen @lEWFkRAD's sidecar-headless fix (PR NousResearch#54565) to the sibling spawn sites: the npm ci / npm install self-heal runs in _reinstall_sidecar_deps also popped a brief console window per run on Windows. Same windows_hide_flags() helper (CREATE_NO_WINDOW only, so capture_output stays usable).
Widen @lEWFkRAD's sidecar-headless fix (PR NousResearch#54565) to the sibling spawn sites: the npm ci / npm install self-heal runs in _reinstall_sidecar_deps also popped a brief console window per run on Windows. Same windows_hide_flags() helper (CREATE_NO_WINDOW only, so capture_output stays usable).
What does this PR do?
On Windows,
plugins/platforms/photon/adapter.pylaunches the Photon (iMessage) Node sidecar — and the spectrum-ts mixed-attachment patch run — viasubprocesswithoutcreationflags. Each spawn opens a visible console window; because a failing sidecar is retried on a timer, that window flashes repeatedly. This addsCREATE_NO_WINDOWonwin32to both spawn sites so the sidecar runs headless. Windows-only; no-op on Linux/macOS. Mirrors the existing pattern inhermes_cli/kanban_db.py.Related Issue
No tracking issue filed. Companion: #43933 already fixes the sibling
gateway/status.py_read_process_cmdline()ps.execonsole-popup, so that file is intentionally excluded here to avoid duplicating it. (#53868 also edits this adapter, but for an unrelated concern — keeping the sidecar alive when the patch fails.)Fixes #
Type of Change
Changes Made
plugins/platforms/photon/adapter.py— addcreationflags=subprocess.CREATE_NO_WINDOW if sys.platform == "win32" else 0to both subprocess spawns in_start_sidecar():subprocess.run([...])), andsubprocess.Popen([...])).How to Test
Get-Process -Id <pid>showsMainWindowHandle = 0) andphotonconnects normally (✓ photon connected — sidecar on 127.0.0.1:8789).Checklist
Code
fix(photon): ...)CREATE_NO_WINDOWto the Photon sidecar spawn; the relatedstatus.pyfix (fix: skip ps.exe on Windows to prevent console window popups #43933) is intentionally excludedpytest tests/ -qand all tests pass — not run in full locally; the change iswin32-guarded and mirrorshermes_cli/kanban_db.py. Verified manually on Windows 11 (see How to Test).Documentation & Housekeeping
docs/N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/Asys.platform == "win32"; no-op on Linux/macOSScreenshots / Logs
Before — the sidecar retry loop, each iteration flashing a console:
After — connects and runs headless:
🤖 Generated with Claude Code