The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): a same-named unit pinned to another HOME root neither serves nor blocks this home
teknium14df45f80e1d9
diff --git a/hermes_cli/gateway_runtime_service.py b/hermes_cli/gateway_runtime_service.pyindex ec49a8db8be..fa67ad77c08 100644--- a/hermes_cli/gateway_runtime_service.py+++ b/hermes_cli/gateway_runtime_service.py@@ -92,7 +92,7 @@ def _exists(path: Path) -> bool:def _systemd(home: Path, deadline: float) -> ExistingService | None:from hermes_cli import gateway as gwfrom hermes_cli.service_manager import _s6_running- from hermes_cli.gateway_runtime_service_identity import SYSTEMD_IDENTITY_PROPERTIES, verify_systemd+ from hermes_cli.gateway_runtime_service_identity import ForeignRoot, SYSTEMD_IDENTITY_PROPERTIES, verify_systemdif _s6_running():raise RuntimeStartError("external_supervisor")suffix = service_suffix(home)@@ -128,6 +128,11 @@ def _systemd(home: Path, deadline: float) -> ExistingService | None:raise RuntimeStartError("service_identity_unverified")try:verify_systemd(props, environment.stdout, home, system=system)+ except ForeignRoot:+ # A unit named like ours but pinned to another HOME root belongs to a+ # different install (a sandbox HOME beside a real one); it neither serves+ # nor blocks this home.+ continueexcept ValueError as exc:reason = str(exc)raise RuntimeStartError(reason if reason in {diff --git a/hermes_cli/gateway_runtime_service_identity.py b/hermes_cli/gateway_runtime_service_identity.pyindex df531d3c304..4b5b7011dd4 100644--- a/hermes_cli/gateway_runtime_service_identity.py+++ b/hermes_cli/gateway_runtime_service_identity.py@@ -33,9 +33,25 @@ def _absolute(value: str) -> Path:return Path(value).resolve()+class ForeignRoot(ValueError):+ """The service serves another install root (a different HOME), not another profile of ours."""+++def _install_root(home: Path) -> Path:+ # <root>/.hermes or <root>/.hermes/profiles/<name>: the root is the HOME that anchors it.+ parts = home.parts+ if len(parts) >= 3 and parts[-3] == ".hermes" and parts[-2] == "profiles":+ return home.parents[2]+ return home.parent++def verify_home(home: Path, configured: str) -> None:- if os.path.normcase(str(_absolute(configured))) != os.path.normcase(str(home.resolve())):- raise ValueError("profile_mismatch")+ ours, theirs = home.resolve(), _absolute(configured)+ if os.path.normcase(str(theirs)) == os.path.normcase(str(ours)):+ return+ if os.path.normcase(str(_install_root(theirs))) != os.path.normcase(str(_install_root(ours))):+ raise ForeignRoot("foreign_root")+ raise ValueError("profile_mismatch")def verify_gateway_argv(argv: list[str], home: Path) -> None: