Skip to content

The agent that grows with you

docs(peer): the ambiguous @hermes 404 message and test docstrings say what the client does now

Teknium95e4f3bf605e
diff --git a/hermes_cli/subcommands/peer.py b/hermes_cli/subcommands/peer.py
index 897836c6413..a23f644b42d 100644
--- a/hermes_cli/subcommands/peer.py
+++ b/hermes_cli/subcommands/peer.py
@@ -132,10 +132,10 @@ def _resolve_base(peer: dict, profile: str | None, key: str, peer_name: str = ""
if _peer_lacks_profile(exc):
name = peer_name or "<peer>"
raise LookupError(
- f"Peer '{name}' serves no '{DEFAULT_PROFILE_HANDLE}' profile, and its gateway is too "
- f"old to say whether '{DEFAULT_PROFILE_HANDLE}' means its default profile or a "
- f"'{DEFAULT_PROFILE_HANDLE}' profile it does not serve. Address its default bot as "
- f"{name}/default, or update the peer's hermes-agent.") from exc
+ f"Peer '{name}' answered that it serves no '{DEFAULT_PROFILE_HANDLE}' profile. That answer "
+ f"is ambiguous: an up-to-date gateway gives it when it does not serve its default profile, "
+ f"and an older one also when it has a '{DEFAULT_PROFILE_HANDLE}' profile it does not serve. "
+ f"If the peer serves its default profile, address that bot as {name}/default.") from exc
return base
diff --git a/tests/gateway/test_multiplex_api_server_routing.py b/tests/gateway/test_multiplex_api_server_routing.py
index 2f8aee6ef34..3467a5d57a1 100644
--- a/tests/gateway/test_multiplex_api_server_routing.py
+++ b/tests/gateway/test_multiplex_api_server_routing.py
@@ -116,8 +116,8 @@ async def test_hermes_handle_reaches_the_default_profile_only_when_no_hermes_pro
tmp_path, monkeypatch, multiplex, gateway_home, legacy_hermes, answers):
"""'/p/hermes/' is Bot Mode's handle for the default profile (#118076): a gateway serving the
default profile answers it, one running another profile refuses it with the unknown-profile
- 404 peers key their /p/default fallback on, and a host with a real pre-reservation 'hermes'
- profile keeps the name for it (refusing distinctly when this gateway does not serve it)."""
+ 404 (peer clients report it as ambiguous, never reroute), and a host with a real pre-reservation
+ 'hermes' profile keeps the name for it (refusing distinctly when this gateway does not serve it)."""
root = tmp_path / "root"
homes = [root, root / "profiles" / "worker"] + ([root / "profiles" / "hermes"] if legacy_hermes else [])
for home in homes:
@@ -155,8 +155,8 @@ async def test_hermes_handle_reaches_the_default_profile_only_when_no_hermes_pro
async def test_profile_prefix_names_the_same_profile_in_any_case(tmp_path, monkeypatch, multiplex, legacy_hermes, answers):
"""Profile ids are lowercase (``normalize_profile_name``), so ``/p/Hermes/`` is ``/p/hermes/``:
a real 'hermes' profile keeps it, and only without one does it alias the default. An
- exact-case comparison answered it with the unknown-profile 404 that peers reroute to the
- default profile, misdelivering box/Hermes."""
+ exact-case comparison answered it with the unknown-profile 404, so box/Hermes reached no
+ agent (and older peer clients, which rerouted on that 404, sent it to the default profile)."""
root = tmp_path / "root"
for home in [root, root / "profiles" / "worker"] + ([root / "profiles" / "hermes"] if legacy_hermes else []):
home.mkdir(parents=True, exist_ok=True)
diff --git a/tests/hermes_cli/test_peer_cmd.py b/tests/hermes_cli/test_peer_cmd.py
index 6428357844b..ec484f40215 100644
--- a/tests/hermes_cli/test_peer_cmd.py
+++ b/tests/hermes_cli/test_peer_cmd.py
@@ -113,7 +113,8 @@ def test_hermes_handle_reaches_the_profile_the_peer_serves(
out, err = [json.loads(line) for line in captured.out.splitlines()], captured.err
if expected is None:
assert (replies, out) == ([1, 1, 1], [])
- assert "box/default" in err or "Profile 'hermes' exists" in err
+ # A generic 404 is ambiguous (names box/default); a distinct refusal is relayed as the peer said it.
+ assert ("Profile 'hermes' exists" if refusal else "box/default") in err
assert {hit.split("/")[2] for hit in _ProfilePeer.hits} == {"hermes"}
return
assert replies == [0, 0, 0]