From 443c104e61546efeaf900fde82db338812d6ead5 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Wed, 19 Aug 2026 01:23:39 -0500 Subject: [PATCH] fix(desktop): treat profile=default as this process's own home _is_other_profile only allowed empty/current, so a ?profile=default save skipped the session.info broadcast on the process whose config it just wrote. Compare the resolved target to the process HERMES_HOME. --- hermes_cli/web_server.py | 8 +++++++- .../test_web_server_approvals_broadcast.py | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.py index 443c58b897..b2e7665ec9 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 643654d140..cc4244a938 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