fix(update): normalize Windows gateway resume launchers - #53459
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Normalizes captured Hermes launcher wrappers (hermes.exe, hermes.cmd, etc.) to direct windowless pythonw.exe argv for the Windows post-update gateway resume path. Prevents console wrapper from being replayed after update.
- Well-scoped Windows-specific fix (79 additions, 9 deletions in source)
- Thorough test coverage: launcher normalization, unrelated launcher passthrough, live watcher path regression
- Conservative approach: only touches known Hermes launcher names
- Preserves explicit
--profile/-pselectors andgateway runtail args - Good separation of helper functions (
_visible_profile_args,_gateway_run_tail,_canonical_gateway_restart_from_wrapper)
Reviewed by Hermes Agent
|
Users are still reporting gateway flashing windows. This PR is meant to prevent one specific way we keep reintroducing that problem after update. The issue is that the post-update gateway resume watcher can capture the running gateway as a launcher-shaped command, like:
Then after update, it replays that same launcher shape. On Windows, replaying the Hermes console wrapper can create or flash a terminal window again. So even if other gateway starts are cleaned up, update can put the user right back onto a visible-console gateway launch path. This PR changes that resume path so captured Hermes gateway launchers are restarted through the direct windowless form instead:
It preserves profile args and This probably does not fix every flashing subprocess in the whole product, but it should reduce the gateway flashing reports by removing this update-resume wrapper replay path. If this shape is wrong, can someone please point at the preferred gateway/update owner or the preferred implementation shape so this does not just stay broken? |
|
close after reading: |
|
Thanks for isolating the captured-launcher resume case. Current main still has the gap: The proposed constrained Hermes-launcher recognition and direct Automated hermes-sweeper review. |
|
Closing as superseded: this patches the pythonw-era The residual idea here is still real though: captured |
What does this PR do?
Fixes the Windows post-update gateway resume path when the captured gateway command line is a Hermes launcher wrapper such as
hermes.exe gateway runinstead of a Python interpreter argv.Current
mainalready routes the live restart watcher throughgateway_windows.windowless_gateway_restart_spec()before respawning the gateway. That helper rewrites consolepython.exeargv to windowlesspythonw.exe, but it still returned non-Python launcher argv unchanged. So an unmapped gateway captured ashermes.exe gateway runcould still be replayed as the wrapper after update, preserving the console-wrapper shape this path is supposed to avoid.This change teaches the helper to conservatively recognize captured Hermes gateway launchers and normalize them to the same direct
pythonw.exe -m hermes_cli.main ... gateway runargv used by a clean Windows gateway start. Explicit--profile/-pselectors andgateway runtail args such as--replaceare preserved.This is the narrow follow-up to the closed #53260: the older PR mixed the mapped pid-file drain wait and wrapper normalization. This PR only addresses the wrapper replay issue, and adds a regression test through
_spawn_gateway_restart_watcher()so the normalization is proven to sit on the live respawn path.Related Issue
Follow-up to #53260.
Related Windows console-wrapper/update-resume work: #52239.
Type of Change
Changes Made
hermes_cli/gateway_windows.pyhermes,hermes.exe,hermes.cmd,hermes.bat) that contain agateway runtail._build_gateway_argv().gateway run ...tail.tests/tools/test_windows_native_support.py_spawn_gateway_restart_watcher()passes the normalized argv into the watcher command instead of replayinghermes.exe.How to Test
python -m py_compile hermes_cli\gateway_windows.py tests\tools\test_windows_native_support.pypython scripts\run_tests_parallel.py -j 4 tests\tools\test_windows_native_support.py -- -k "GatewayDetachedWatcherWindowsFlags or WindowlessGatewayRestartSpec"Focused test result: 11 passed, 0 failed.
Note: the Windows local runner printed a post-summary cp1252 progress-callback traceback while rendering a checkmark, but the test command exited 0 and reported 100% pass.
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass. Not run; used focusedscripts/run_tests_parallel.py -j 4coverage for the changed Windows restart path.Documentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
Focused checks passed locally:
python -m py_compile hermes_cli\gateway_windows.py tests\tools\test_windows_native_support.pypython scripts\run_tests_parallel.py -j 4 tests\tools\test_windows_native_support.py -- -k "GatewayDetachedWatcherWindowsFlags or WindowlessGatewayRestartSpec"— 11 passed, 0 failedgit diff --check -- hermes_cli/gateway_windows.py tests/tools/test_windows_native_support.py