Skip to content

The agent that grows with you

refactor(gateway): keep shutdown_watchdog._process_hermes_home mock seam

Teknium88797c207299
diff --git a/gateway/shutdown_watchdog.py b/gateway/shutdown_watchdog.py
index e1f81ad1ba0..cfcbec7d8ea 100644
--- a/gateway/shutdown_watchdog.py
+++ b/gateway/shutdown_watchdog.py
@@ -183,14 +183,16 @@ def _mark_exited_quietly(exit_code: int, reason: str) -> None:
pass
-def _home(home: Optional[Path]) -> Path:
- """``home`` or the process-level HERMES_HOME (env, ignoring profile overrides)."""
- if home is not None:
- return home
+def _process_hermes_home() -> Path:
+ """HERMES_HOME for process-level identity files (ignore profile overrides)."""
val = os.environ.get("HERMES_HOME", "").strip()
return Path(val) if val else get_hermes_home()
+def _home(home: Optional[Path]) -> Path:
+ return home if home is not None else _process_hermes_home()
+
+
def get_loop_heartbeat_path(home: Optional[Path] = None) -> Path:
"""Return ``<HERMES_HOME>/state/gateway.heartbeat``."""
return _home(home).joinpath(*_HEARTBEAT_RELATIVE)