The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): SSH remote backend stops following the host's sticky active_profile
Teknium677e8ed8a419
diff --git a/hermes_cli/main.py b/hermes_cli/main.pyindex 1aff355cd50..4365080996d 100644--- a/hermes_cli/main.py+++ b/hermes_cli/main.py@@ -494,6 +494,17 @@ def _under_gateway_supervisor(argv: list) -> bool:).strip().lower() in {"1", "true", "yes", "on"}+def _desktop_ssh_backend(argv: list) -> bool:+ """A Desktop-owned ``serve --ssh-session-token-file`` child has a fixed identity too.++ The Desktop client names the remote profile explicitly (``--profile <name>``, or none for+ the root home). Following the remote host's sticky ``active_profile`` instead silently+ re-homes the backend into a profile the UI never asked for, so Settings read one+ ``config.yaml`` and the user edits another (KC's "nothing sticks over SSH").+ """+ return "--ssh-session-token-file" in argv++def _apply_profile_override() -> None:"""Pre-parse --profile/-p and set HERMES_HOME before imports."""argv = sys.argv[1:]@@ -508,7 +519,7 @@ def _apply_profile_override() -> None:if profile_name is None and hermes_home_env and Path(hermes_home_env).parent.name == "profiles":return- if profile_name is None and not _under_gateway_supervisor(argv):+ if profile_name is None and not _under_gateway_supervisor(argv) and not _desktop_ssh_backend(argv):try:from hermes_constants import get_default_hermes_rootdiff --git a/tests/hermes_cli/test_apply_profile_override.py b/tests/hermes_cli/test_apply_profile_override.pyindex 90837cf9406..662fb4206d6 100644--- a/tests/hermes_cli/test_apply_profile_override.py+++ b/tests/hermes_cli/test_apply_profile_override.py@@ -265,6 +265,21 @@ class TestGeneralizedSupervisorMarkers:)assert result == str(hermes_root)+ def test_desktop_ssh_serve_child_skips_active_profile(self, tmp_path, monkeypatch):+ """A Desktop-owned `serve --ssh-session-token-file` child names its profile explicitly+ (or none for the root home); the remote host's sticky active_profile must not re-home+ it, or Settings read one profile's config.yaml while the user edits another."""+ hermes_root = self._root_home(tmp_path)+ result = _run_apply_profile_override(+ tmp_path,+ monkeypatch,+ hermes_home=str(hermes_root),+ active_profile="telegram_nick",+ argv=["hermes", "serve", "--isolated", "--host", "127.0.0.1", "--port", "0",+ "--ssh-session-token-file", "/tmp/x/y.token"],+ )+ assert result == str(hermes_root)+def test_generated_systemd_unit_exports_supervised_marker(self, tmp_path, monkeypatch):