Skip to content

The agent that grows with you

fix(gateway): keep a standalone profile out of its elevated default gateway's refusal

unsupportedpastels6b6a4640b908
diff --git a/hermes_cli/gateway_runtime.py b/hermes_cli/gateway_runtime.py
index f434eb95985..bd940eebe6d 100644
--- a/hermes_cli/gateway_runtime.py
+++ b/hermes_cli/gateway_runtime.py
@@ -218,7 +218,11 @@ def _served_by_multiplexer(home: Path, *, timeout: float) -> GatewayDiscovery |
try:
payload = query_identify(root, timeout=timeout)
except PermissionError as exc:
- # The multiplexer's pipe proved the boundary: name it for the secondary too (#140706).
+ # The multiplexer's pipe proved the boundary: name it for the secondary too (#140706), unless
+ # the boot policy never serves this home (a standalone secondary starts its own gateway).
+ from hermes_cli.gateway_multiplex_mode import host_serves_named_profile
+ if host_serves_named_profile(root, home) is False:
+ return None
return _refused_owner_verdict(exc)
except (FileNotFoundError, ConnectionRefusedError, TimeoutError, DiscoveryError,
OSError, ValueError, TypeError):
diff --git a/tests/gateway/test_runtime_bootstrap_server_identity.py b/tests/gateway/test_runtime_bootstrap_server_identity.py
index 260f8dfce2b..e45f072b2d0 100644
--- a/tests/gateway/test_runtime_bootstrap_server_identity.py
+++ b/tests/gateway/test_runtime_bootstrap_server_identity.py
@@ -195,6 +195,18 @@ def test_a_served_secondary_keeps_ignoring_any_other_multiplexer_refusal(served_
assert runtime.discover_gateway_endpoint(home, timeout=1).state == "absent"
+def test_a_standalone_secondary_is_not_refused_for_its_elevated_default_gateway(served_secondary):
+ """``gateway.standalone: true`` opts the profile out of the multiplexer, so the default gateway's
+ refusal is not its verdict: discovery stays its own ``absent`` and ensure starts its own gateway."""
+ from hermes_cli import gateway_runtime as runtime
+ home, starts = served_secondary(lambda: native._peer_subject(HANDLE, server=True))
+ (home / "config.yaml").write_text("gateway:\n standalone: true\n", encoding="utf-8")
+ assert runtime.discover_gateway_endpoint(home, timeout=1).state == "absent"
+ ensured = runtime.ensure_gateway_runtime(home, timeout=5)
+ assert (ensured.state, ensured.reason_code) == ("starting", "deadline")
+ assert starts == [(home,)]
+
+
# -- what must stay refused, never attached and never named -------------------------------------