fix(gateway): preserve settled host identity across restart

This commit is contained in:
Hermes Agent
2026-09-24 19:43:15 -05:00
committed by brooklyn!
parent bfdeb64474
commit 8bde3a72e8
2 changed files with 10 additions and 2 deletions

View File

@@ -1396,14 +1396,19 @@ class GatewayShutdownMixin:
on_default = home.resolve() == get_default_hermes_root().resolve()
except Exception:
on_default = False
# ``resolve_multiplex_mode`` settles the default-on/unset decision before
# restart. Carry that runtime identity instead of re-reading raw config:
# ``None`` is the normal pre-resolution value for a named launcher.
from agent.secret_scope import is_multiplex_active
settled_multiplex = is_multiplex_active()
multiplex = False
if not on_default:
if not on_default and not settled_multiplex:
try:
from gateway.config import load_gateway_config
multiplex = bool(load_gateway_config().multiplex_profiles)
except Exception:
multiplex = False
if on_default or multiplex:
if on_default or settled_multiplex or multiplex:
watcher_env = host_gateway_child_env()
else:
watcher_env = served_profile_child_env(

View File

@@ -996,6 +996,9 @@ def _restart_argv_is_host_gateway(argv: list[str]) -> bool:
if any(part.startswith("--profile=") and not part.endswith("=default") for part in argv):
return False
try:
from agent.secret_scope import is_multiplex_active
if is_multiplex_active():
return True
from hermes_constants import get_default_hermes_root, get_hermes_home
return get_hermes_home().resolve() == get_default_hermes_root().resolve()
except Exception: