fix(windows): prevent helper process console flashes - #68472
Conversation
fd57cdd to
142f3ca
Compare
142f3ca to
2de9de6
Compare
2de9de6 to
3a6381a
Compare
|
Closing as superseded by PR #70205 (merged as 0dbf639), which fixes this class in the opposite direction. This PR rewrites the restart watcher to GUI-subsystem If you still see a flash on these legs on current main, please re-open with the flashing process name — that would be a leg the parent-console fix doesn't cover. Thanks for the detailed spawn-chain analysis. |
What does this PR do?
Prevents visible console flashes from the two remaining helper-process spawn paths on Windows installations created by uv.
The venv
python.exelauncher re-execs the base console interpreter, soCREATE_NO_WINDOWon the launcher cannot suppress the secondconhost. This change reuses the existing uv-aware interpreter resolution to launch both the TUI slash worker and the gateway restart watcher with the basepythonw.exe. It also supplies theVIRTUAL_ENVandPYTHONPATHoverlay required by the base interpreter, while preserving profile-specificHERMES_HOMEand safe fallback behavior.Related Issue
Fixes #68457
Type of Change
Changes Made
hermes_cli/gateway_windows.py.tui_gateway/server.pyso_SlashWorkerlaunches uv environments through the basepythonw.exeand retains its profile environment.hermes_cli/gateway.pyso the restart watcher itself, not only the gateway it later respawns, usespythonw.exewith the required cwd and environment.pyvenv.cfgresolution, profile propagation, non-Windows behavior, and resolution-failure fallback.Validation
After rebasing onto current
main(including #56747's additional Windows hide-flag paths and tests):HERMES_PYTHON=/path/to/python scripts/run_tests.sh tests/hermes_cli/test_gateway.py tests/hermes_cli/test_gateway_windows.py tests/gateway/test_restart_drain.py tests/test_tui_gateway_server.py tests/test_windows_subprocess_no_window_flags.py tests/tui_gateway/test_slash_worker_profile_home.py— 589 passedruff check hermes_cli/gateway.py hermes_cli/gateway_windows.py tui_gateway/server.py tests/hermes_cli/test_gateway.py tests/test_windows_subprocess_no_window_flags.py— passedpython scripts/check-windows-footguns.py --diff upstream/main— passed across all five changed filesgit diff --check upstream/main...HEAD— passedThe spawn-path tests construct a real uv-style
pyvenv.cfg, basepythonw.exe, and venv site-packages so the resolver is exercised end to end. Non-Windows behavior and resolution failure retain the originalsys.executablefallback. The upstream #56747 regression coverage for the six other GUI-reachable spawn sites remains intact.I also attempted the full suite. It reached 37% before I stopped it after unrelated host/environment failures, including a Linux systemd abstract-socket test on macOS and Discord fixture URLs resolving to an SSRF-blocked reserved address. All suites covering the changed paths passed.
Checklist
Screenshots / Logs
Not applicable: this is process-launch behavior covered by subprocess-spawn assertions and real uv-layout resolver fixtures.