fix(windows): gateway-restart watcher leg must use windowless interpreter - #53850
Closed
teknium1 wants to merge 1 commit into
Closed
fix(windows): gateway-restart watcher leg must use windowless interpreter#53850teknium1 wants to merge 1 commit into
teknium1 wants to merge 1 commit into
Conversation
…eter The real cause of the persistent 'hermes update -> gateway restart flashes and flurries' report on Windows. #53810 rewrote the respawned-GATEWAY leg to the windowless base interpreter (windowless_gateway_restart_spec), but the WATCHER process that polls the old PID and spawns that gateway was still launched with bare sys.executable — the venv console python.exe, which re-execs the base console interpreter and allocates a conhost window even under CREATE_NO_WINDOW. Two console-python legs per restart = flash, then flurry. - _spawn_gateway_restart_watcher: resolve watcher_argv[0] via _resolve_detached_python (same windowless base interpreter the gateway leg uses), and overlay VIRTUAL_ENV/PYTHONPATH so the base interpreter can import hermes_cli in the inlined watcher snippet. No-op on POSIX. - Regression test pins the watcher leg to the windowless interpreter. NOTE: code-reasoned fix mirroring the proven _spawn_detached pattern; needs a native-Windows smoke pass to confirm (the gap that let #53791/#53810 ship without catching this).
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-attribute |
2 |
First entries
run_agent.py:3014: [unresolved-attribute] unresolved-attribute: Object of type `Self@get_credits_spent_micros` has no attribute `_credits_session_start_micros`
tests/run_agent/test_credits_notices_toggle.py:76: [unresolved-attribute] unresolved-attribute: Unresolved attribute `_credits_session_start_micros` on type `AIAgent`
✅ Fixed issues (1):
| Rule | Count |
|---|---|
invalid-assignment |
1 |
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to attribute `_credits_session_start_micros` of type `int`
Unchanged: 6070 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
Contributor
Author
|
Closing in favor of reverting the whole Windows terminal-popup line of work (#53853). This watcher fix was never verified on Windows either; we are resetting to baseline and will fix from a real Windows repro. The diagnosis here (watcher leg launched the console python.exe) is captured in #53853 and the revert PR notes for whoever picks this up. |
iso2kx
added a commit
to iso2kx/hermes-agent
that referenced
this pull request
Jul 10, 2026
The post-update respawn chain has two process legs: the watcher that polls the old gateway PID, and the gateway it respawns. NousResearch#52239 rewrote the gateway leg through windowless_gateway_restart_spec, but the watcher itself still launched via bare sys.executable — the venv's console python.exe. Under a uv venv that launcher re-execs the base console interpreter with default creationflags, a fresh CreateProcess that inherits none of the watcher's DETACHED / CREATE_NO_WINDOW flags, so a blank console window stays on screen for the whole drain window (up to ~2 minutes) after every GUI update. Route watcher_argv through the same windowless_gateway_restart_spec rewrite and thread the cwd + VIRTUAL_ENV/PYTHONPATH overlay into the watcher Popen so the base pythonw.exe can import hermes_cli and gateway.status without the venv launcher. Reproduced on Windows 11 (uv-managed venv, Desktop GUI auto-update): before the fix an empty python.exe console appears when the updater drains the old gateway and closes when the watcher exits; with the rewrite the whole chain is windowless. Same diagnosis as the reverted NousResearch#53850, adapted to the current _spawn_gateway_restart_watcher structure. Fixes NousResearch#51661.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The real cause of the persistent "
hermes update→ gateway restarts → console window flashes and flurries" report on Windows — the one that survived #53791, #53810, and #53829.Those PRs fixed the wrong layer. #53810 correctly rewrote the respawned gateway leg to the windowless base interpreter (
windowless_gateway_restart_spec). But the watcher process that polls the old PID and spawns that gateway was still launched with baresys.executable— the venv's consolepython.exe. On Windows that re-execs the base console interpreter and allocates a conhost window even underCREATE_NO_WINDOW. Two console-python legs per restart = flash, then flurry. The AST footgun checker could never catch this: it scanssubprocess.*call sites, and this is asubprocess.Popen([sys.executable, ...])— a dynamic argv it has no rule for.Changes
hermes_cli/gateway.py_spawn_gateway_restart_watcher: resolvewatcher_argv[0]via_resolve_detached_python(the same windowless base interpreter the gateway leg already uses), and overlayVIRTUAL_ENV/PYTHONPATHso the base interpreter can importhermes_cliin the inlined watcher snippet. No-op on POSIX (nowvariant;start_new_sessionpath unchanged).Validation
python.exe→ flashtests/tools/test_windows_native_support.pyHonest caveat: this is a code-reasoned fix mirroring the proven
_spawn_detached/windowless_gateway_restart_specpattern. It has not been run on native Windows — that's the exact gap that let the earlier three PRs ship without catching this. Needs a Windows smoke pass on thehermes update→ restart path to confirm the flurry is gone.Infographic