Skip to content

The agent that grows with you

fix(desktop): API server card shows a served secondary as enabled (#121125, salvage #122165)

finn7632b9fdb85d422
diff --git a/hermes_cli/web_routers/messaging.py b/hermes_cli/web_routers/messaging.py
index be5ab2eb156..468a3e60377 100644
--- a/hermes_cli/web_routers/messaging.py
+++ b/hermes_cli/web_routers/messaging.py
@@ -241,6 +241,11 @@ def _messaging_platform_payload(
]
enabled, configured, home_channel = _platform_enablement(platform_id, entry, env_on_disk, scoped)
+ if gateway_running and runtime_platform.get("mirrored_from"):
+ # Served secondary: the default's shared listener already answers this platform at
+ # /p/<profile>/... (enabling it locally 409s), so the secondary's own empty config
+ # must not project Disabled over the live mirror (#121125).
+ enabled, configured = True, True
state = runtime_platform.get("state")
if not enabled:
diff --git a/tests/hermes_cli/test_served_profile_mirror_platforms.py b/tests/hermes_cli/test_served_profile_mirror_platforms.py
index a081f6b59c0..26d976f3f2e 100644
--- a/tests/hermes_cli/test_served_profile_mirror_platforms.py
+++ b/tests/hermes_cli/test_served_profile_mirror_platforms.py
@@ -39,6 +39,22 @@ def served_root(tmp_path, monkeypatch):
return root
+def test_messaging_card_shows_mirrored_api_server_enabled_without_local_config(served_root):
+ """#121125: a served secondary never configures api_server itself (enabling it there
+ 409s: the shared listener already serves ``/p/<profile>/v1``), so the REAL enablement
+ reads (False, False) from its own empty config and the card printed Disabled over a
+ live mirror. No ``_platform_enablement`` monkeypatch here: that mask hid the bug."""
+ from hermes_cli.web_routers import messaging
+ entry = {"id": "api_server", "name": "API server", "description": "", "docs_url": "", "env_vars": [],
+ "required_env": []}
+ alpha = served_root / "profiles" / "alpha"
+ [payload] = messaging._platform_payloads(alpha, [entry])
+ assert payload["gateway_running"] is True
+ assert payload["enabled"] is True, payload
+ assert payload["state"] == "connected", payload
+ assert payload["ingress_url"] == "http://127.0.0.1:45719/p/alpha/v1", payload
+
+
def test_served_profile_projects_the_default_listener_mirrors_with_their_url(served_root):
from gateway.status import profile_platforms_from_multiplexer, resolve_gateway_liveness
alpha = served_root / "profiles" / "alpha"