fix(desktop/windows): stop the uv-launched gateway before recreating the venv - #53124
Closed
Cossackx wants to merge 1 commit into
Closed
fix(desktop/windows): stop the uv-launched gateway before recreating the venv#53124Cossackx wants to merge 1 commit into
Cossackx wants to merge 1 commit into
Conversation
…the venv The venv-recreate guard in install.ps1 stops processes whose ExecutablePath is under venv\Scripts\ (plus a taskkill of the hermes.exe image). But `uv venv` installs TRAMPOLINE launchers: venv\Scripts\pythonw.exe re-execs into the uv-managed base interpreter (%APPDATA%\uv\python\...), so the live gateway's ExecutablePath is that base interpreter -- not under the venv -- and its image is python/pythonw, not hermes.exe. Both filters miss it; the running gateway keeps the venv's .pyd/.dll files mapped and the venv delete fails with "Access to the path '...pywintypes311.dll' is denied", aborting the install. Before deleting the venv, also stop the gateway two robust ways: (1) the pid it records in gateway_state.json, and (2) any python/pythonw whose command line runs the gateway module (hermes_cli[.main] ... gateway), tree-killed. Both require the gateway to share the installer's session, so this pairs with autostart tasks registered LogonType=Interactive rather than S4U/Session-0. Verified against a live gateway: the cmdline filter matches both the venv\Scripts\pythonw.exe trampoline parent and the uv-base-python child; install.ps1 parses clean under the Windows PowerShell 5.1 parser. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Thanks for the detailed Windows reproduction. This is already addressed on current
|
This was referenced Jul 30, 2026
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.
Problem
On Windows,
install.ps1aborts at the venv stage with a locked-file error when a Hermes gateway is running:The venv-recreate guard already tries to stop running processes first, but it only matches:
taskkill /IM hermes.exe— the gateway runs aspython/pythonw, nothermes.exe; andExecutablePathstarts withvenv\Scripts\.uv venvinstalls trampoline launchers: runningvenv\Scripts\pythonw.exere-execs into the uv-managed base interpreter under%APPDATA%\uv\python\…, so the live gateway'sExecutablePathis that base interpreter — not under the venv. Both filters miss it, the gateway keeps the venv's.pyd/.dllfiles mapped, and the venv delete fails → the whole install/update aborts (and, when triggered from the desktop bootstrap, manifests as a recurring "INSTALL DIDN'T FINISH" loop).Fix
Before deleting the venv, also stop the gateway two robust ways:
gateway_state.json, andpython/pythonwwhose command line runs the gateway module (hermes_cli[.main] … gateway), tree-killed.Both require the gateway to share the installer's session, so this pairs naturally with autostart tasks registered
LogonType=Interactiverather than S4U/Session-0 (a Session-0 gateway is invisible to an un-elevated installer'sGet-CimInstancecommand-line read).Verification
pywintypes311.dll.venv\Scripts\pythonw.exetrampoline parent and the uv-base-python.exechild (each carrying-m hermes_cli.main gateway run); thegateway_state.jsonpid matches the child. Tree-killing both releases the venv and the recreate succeeds.scripts/install.ps1parses clean under the Windows PowerShell 5.1 AST parser.🤖 Generated with Claude Code