Skip to content

The agent that grows with you

fix(gateway): run Windows /update as a module, not through the shim

Brooklyn Nicholson3f6d4c6338b2
diff --git a/gateway/slash_commands.py b/gateway/slash_commands.py
index 1986bbd374a..cd54164bd0d 100644
--- a/gateway/slash_commands.py
+++ b/gateway/slash_commands.py
@@ -5958,8 +5958,11 @@ class GatewaySlashCommandsMixin:
import textwrap
from hermes_cli._subprocess_compat import windows_detach_popen_kwargs
- # hermes_cmd is a list of argv parts we can pass directly
- # (no shell-quoting needed).
+ # Invoke the updater as a module under this interpreter rather
+ # than through hermes_cmd (venv\Scripts\hermes.exe): the shim
+ # launcher holds its own file open for the whole run, and the
+ # update has to replace it. Going through python.exe maps no
+ # shim, so the entry points can be rewritten freely.
helper = textwrap.dedent(
"""
import os, subprocess, sys
@@ -5979,7 +5982,8 @@ class GatewaySlashCommandsMixin:
[
sys.executable, "-c", helper,
str(output_path), str(exit_code_path),
- *hermes_cmd, "update", "--gateway",
+ sys.executable, "-m", "hermes_cli.main",
+ "update", "--gateway",
],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,