Skip to content

The agent that grows with you

fix(desktop): treat profile=default as this process's own home

Brooklyn Nicholson443c104e6154
diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.py
index 443c58b8972..b2e7665ec9e 100644
--- a/hermes_cli/web_server.py
+++ b/hermes_cli/web_server.py
@@ -7067,7 +7067,13 @@ async def update_config(body: ConfigUpdate, profile: Optional[str] = None):
def _is_other_profile(profile: Optional[str]) -> bool:
"""True when ``profile`` names a profile other than this process's own."""
requested = (profile or "").strip()
- return bool(requested) and requested.lower() != "current"
+ if not requested or requested.lower() == "current":
+ return False
+ try:
+ target = _resolve_profile_dir(requested)
+ except HTTPException:
+ return True
+ return target.resolve() != get_process_hermes_home().resolve()
def _approval_mode_of(config: Dict[str, Any]) -> str:
diff --git a/tests/hermes_cli/test_web_server_approvals_broadcast.py b/tests/hermes_cli/test_web_server_approvals_broadcast.py
index 643654d140e..cc4244a9387 100644
--- a/tests/hermes_cli/test_web_server_approvals_broadcast.py
+++ b/tests/hermes_cli/test_web_server_approvals_broadcast.py
@@ -99,6 +99,19 @@ class TestApprovalsSaveBroadcast:
"re-emit session.info"
)
+ def test_own_profile_named_default_broadcasts(self, client, broadcast_calls):
+ """Dashboard/desktop often send ?profile=default for this process's
+ own home. That is not an other-profile save and must still emit."""
+ resp = client.put(
+ "/api/config?profile=default",
+ json={"config": {"approvals": {"mode": "off"}}},
+ )
+ assert resp.status_code == 200
+ assert broadcast_calls, (
+ "?profile=default is this process's own HERMES_HOME; skipping "
+ "the broadcast leaves live sessions painting stale YOLO state"
+ )
+
def test_other_profile_save_does_not_broadcast(self, client, broadcast_calls, monkeypatch, tmp_path):
from hermes_cli import web_server