Skip to content

The agent that grows with you

test(e2e): mcp_plugins KNOWN cells xfail only on the bug's own symptom

teknium1f60aeb239d76
diff --git a/tests/e2e/core/mcp_plugins/_helpers.py b/tests/e2e/core/mcp_plugins/_helpers.py
index 521c5af3c1b..887c3bcb089 100644
--- a/tests/e2e/core/mcp_plugins/_helpers.py
+++ b/tests/e2e/core/mcp_plugins/_helpers.py
@@ -13,6 +13,7 @@ from __future__ import annotations
import contextlib
import json
import os
+import re
import signal
import subprocess
import sys
@@ -22,6 +23,7 @@ from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Callable, Iterator
+import pytest
import yaml
from tests.e2e.core.parity._helpers import hermes_argv, kill_tagged, tagged_pids, wait_until
@@ -35,15 +37,49 @@ TURN_TIMEOUT = 240.0
_SECRET_ENV_SUFFIXES = ("_API_KEY", "_TOKEN", "_SECRET", "_ACCESS_KEY")
_PASSTHROUGH_ENV = frozenset({"PATH", "LANG", "LANGUAGE", "USER", "LOGNAME", "SHELL", "TMPDIR", "TZ"})
-__all__ = ["FINAL", "E2EHome", "HttpMcpServer", "build_home", "stdio_server", "http_server_cfg",
- "script", "call_tool", "run_chat_q", "inbound", "calls_received", "tool_results", "tool_name",
- "kill_tagged", "tagged_pids", "wait_until"]
+__all__ = ["FINAL", "E2EHome", "HttpMcpServer", "KnownSymptom", "apply_known", "build_home", "stdio_server",
+ "http_server_cfg", "script", "call_tool", "run_chat_q", "inbound", "calls_received", "tool_results",
+ "tool_name", "tool_names", "payload", "symptom", "kill_tagged", "tagged_pids", "wait_until"]
def tool_name(server: str, tool: str) -> str:
return f"mcp__{server}__{tool}"
+# Known open bugs ----------------------------------------------------------------------------------
+
+
+class KnownSymptom(Exception):
+ """Raised ONLY by the assertion that observes a KNOWN bug's symptom. KNOWN cells are strict
+ xfails with ``raises=KnownSymptom``, so every other failure in them (a server that never starts,
+ a timeout, a precondition, a crashed host, teardown) is a plain error and stays red."""
+
+
+def symptom(ok: Any, message: str) -> None:
+ """Assert the property a KNOWN bug breaks; its violation raises :class:`KnownSymptom`."""
+ if not ok:
+ raise KnownSymptom(message)
+
+
+def apply_known(request: Any, known: dict[str, str]) -> None:
+ """From an autouse fixture: strict-xfail the current test when its node name is a KNOWN key."""
+ reason = known.get(request.node.name)
+ if reason:
+ request.applymarker(pytest.mark.xfail(strict=True, raises=KnownSymptom, reason=reason))
+
+
+def payload(result: str) -> dict[str, Any]:
+ """The JSON object inside a tool result's untrusted-content wrapper."""
+ match = re.search(r"^\{.*\}$", result, re.M | re.S)
+ assert match, f"no JSON payload in tool result: {result!r}"
+ return json.loads(match.group(0))
+
+
+def tool_names(body: dict[str, Any]) -> set[str]:
+ """Function names in a provider request's ``tools[]``."""
+ return {str((t.get("function") or {}).get("name")) for t in body.get("tools") or []}
+
+
@dataclass
class E2EHome:
root: Path
@@ -57,7 +93,7 @@ class E2EHome:
"""Hermetic child env: fake HOME (so no ``~/.hermes`` of the real user is reachable)."""
import pwd # the suite is Linux-gated
- real_root = Path(pwd.getpwuid(os.getuid()).pw_dir, ".hermes").resolve()
+ real_root = Path(pwd.getpwuid(os.getuid()).pw_dir, ".hermes").resolve() # windows-footgun: ok — module is skipif(not linux)
fixture = self.hermes_home.resolve()
assert fixture != real_root and fixture.parent != real_root / "profiles", fixture
assert fixture == (self.home / ".hermes").resolve(), fixture
@@ -148,7 +184,7 @@ class HttpMcpServer:
with open(self.stderr_path, "ab") as err:
self.proc = subprocess.Popen([sys.executable, str(FIXTURE_SERVER)], env=env,
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=err)
- text = wait_until(lambda: self.port_file.exists() and self.port_file.read_text().strip(), 60,
+ text = wait_until(lambda: self.port_file.exists() and self.port_file.read_text(encoding="utf-8").strip(), 60,
f"HTTP MCP server bind ({self.stderr_path})")
self.port = int(text.split()[0])
return self
@@ -170,10 +206,6 @@ class HttpMcpServer:
# Scripted provider -----------------------------------------------------------------------------
-def _names(body: dict[str, Any]) -> set[str]:
- return {(t.get("function") or {}).get("name") for t in body.get("tools") or []}
-
-
def _tool_msgs_this_turn(body: dict[str, Any]) -> list[dict]:
msgs = body.get("messages") or []
last_user = max((i for i, m in enumerate(msgs) if m.get("role") == "user"), default=-1)
@@ -198,7 +230,8 @@ def script(*calls: tuple[str, dict[str, Any] | str]) -> Callable[[dict[str, Any]
def call_tool(body: dict[str, Any], name: str, args: dict[str, Any] | str) -> ToolCall:
"""Call ``name`` directly when offered, else through the Tool Search ``tool_call`` bridge."""
- if name in _names(body) or "tool_call" not in _names(body):
+ offered = tool_names(body)
+ if name in offered or "tool_call" not in offered:
return ToolCall(name, args)
return ToolCall("tool_call", {"calls": [{"name": name, "arguments": args}]})
diff --git a/tests/e2e/core/mcp_plugins/_plugin_helpers.py b/tests/e2e/core/mcp_plugins/_plugin_helpers.py
index 92ac7a72552..80a24508e4b 100644
--- a/tests/e2e/core/mcp_plugins/_plugin_helpers.py
+++ b/tests/e2e/core/mcp_plugins/_plugin_helpers.py
@@ -9,7 +9,6 @@ import os
import signal
import subprocess
import sys
-import time
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Iterator
@@ -58,18 +57,15 @@ class TuiHost:
def turn(self, sid: str, text: str, timeout: float = TURN_TIMEOUT) -> str:
"""Submit one prompt and wait for THIS turn's ``message.complete`` (not an earlier turn's)."""
- seen = len(self.rpc.events)
+ earlier = {id(ev) for ev in self.rpc.events}
self.rpc.call("prompt.submit", {"session_id": sid, "text": text}, timeout=READY_TIMEOUT)
- deadline = time.monotonic() + timeout
- while True:
- for ev in self.rpc.events[seen:]:
- if ev.get("type") == "message.complete" and ev.get("session_id") == sid:
- out = (ev.get("payload") or {}).get("text")
- return out if isinstance(out, str) else json.dumps(out)
- remaining = deadline - time.monotonic()
- if remaining <= 0:
- raise AssertionError(f"no message.complete for {sid} within {timeout}s:\n{self.cap.stderr[-2000:]}")
- self.rpc._pump(min(remaining, 0.5)) # test-harness sibling: same pump wait_event uses
+ try:
+ ev = self.rpc.wait_event("message.complete", lambda e: e.get("session_id") == sid
+ and id(e) not in earlier, timeout=timeout)
+ except AssertionError as exc:
+ raise AssertionError(f"{exc}\nhost stderr:\n{self.cap.stderr[-2000:]}") from exc
+ out = (ev.get("payload") or {}).get("text")
+ return out if isinstance(out, str) else json.dumps(out)
@contextlib.contextmanager
@@ -105,4 +101,4 @@ def reap_tagged(eh: E2EHome) -> None:
"""Cleanup: SIGKILL any process still carrying this home's unique tag (reparented orphans too)."""
for pid in tagged_pids(eh.tag):
with contextlib.suppress(OSError):
- os.kill(pid, signal.SIGKILL)
+ os.kill(pid, signal.SIGKILL) # windows-footgun: ok — callers are skipif(not linux); /proc scan
diff --git a/tests/e2e/core/mcp_plugins/test_mcp_stdio_conformance.py b/tests/e2e/core/mcp_plugins/test_mcp_stdio_conformance.py
index 3b6dcf0db5e..cc6cd585b3b 100644
--- a/tests/e2e/core/mcp_plugins/test_mcp_stdio_conformance.py
+++ b/tests/e2e/core/mcp_plugins/test_mcp_stdio_conformance.py
@@ -9,7 +9,8 @@ next provider request carried back to the model (the tool result the model saw):
a default-trust server runs both (#121042 / #120483 for the read-only half);
* argument shape: a tool with no required params receives an ``arguments`` JSON object — ``{}`` —
for every way a model spells "no arguments", and an optional object param keeps its ``{}``
- (#120269), on the direct path and through the Tool Search ``tool_call`` bridge;
+ (#120269), on the direct path and through the Tool Search ``tool_call`` bridge, with no
+ information-free ``params._meta: {}`` (#120923);
* image results: a cacheable PNG reaches the model as a ``MEDIA:`` file that exists; formats the
cache cannot store (SVG, AVIF, TIFF, HEIC, malformed base64) must degrade visibly, never vanish
(#120227).
@@ -30,13 +31,17 @@ import pytest
from tests.e2e.core.mcp_plugins._helpers import (
FINAL,
+ apply_known,
build_home,
calls_received,
+ payload,
provider,
run_chat_q,
script,
stdio_server,
+ symptom,
tool_name,
+ tool_names,
tool_results,
)
from tests.e2e.core.mcp_plugins._plugin_helpers import reap_tagged
@@ -55,14 +60,15 @@ KNOWN: dict[str, str] = {
"#121042 readOnlyHint read by camelCase attribute under mcp 2.x; every tool needs approval",
**{f"test_uncacheable_image_is_reported_to_the_model[{fmt}]":
"#120227 an MCP image the cache cannot store vanishes from the tool result" for fmt in UNSUPPORTED_IMAGES},
+ **{f"test_no_required_param_tools_receive_an_arguments_object[{bridge}]":
+ "#120923 every tools/call carries an information-free params._meta: {} (stdio too)"
+ for bridge in ("direct", "tool_call bridge")},
}
@pytest.fixture(autouse=True)
def _known(request: pytest.FixtureRequest) -> None:
- reason = KNOWN.get(request.node.name)
- if reason:
- request.applymarker(pytest.mark.xfail(strict=True, raises=AssertionError, reason=reason))
+ apply_known(request, KNOWN)
def _run(root: Path, calls: list[tuple[str, dict[str, Any] | str]], *, extra: dict | None = None,
@@ -79,18 +85,11 @@ def _run(root: Path, calls: list[tuple[str, dict[str, Any] | str]], *, extra: di
reap_tagged(eh)
detail = f"exit {proc.returncode}\nstdout: {proc.stdout[-1500:]}\nstderr: {proc.stderr[-1500:]}"
assert proc.returncode == 0 and FINAL in proc.stdout, f"turn did not complete:\n{detail}"
- offered = {(t.get("function") or {}).get("name") for t in srv.main_requests()[0].get("tools") or []}
+ offered = tool_names(srv.main_requests()[0])
return {"log": log, "results": tool_results(srv), "canary": f"CANARY-{root.name}", "offered": offered,
"stdout": proc.stdout, "detail": detail, "home": eh}
-def _payload(result: str) -> dict[str, Any]:
- """The JSON object inside the untrusted-tool-result wrapper."""
- match = re.search(r"^\{.*\}$", result, re.M | re.S)
- assert match, f"no JSON payload in tool result: {result!r}"
- return json.loads(match.group(0))
-
-
# Trust tiers ---------------------------------------------------------------------------------------
@@ -103,15 +102,15 @@ def untrusted(tmp_path_factory: pytest.TempPathFactory) -> dict[str, Any]:
def test_untrusted_server_refuses_destructive_tool_before_the_rpc(untrusted: dict[str, Any]) -> None:
assert not calls_received(untrusted["log"], "rw_probe"), (
"a destructiveHint tool on a trust: untrusted server reached the server without approval")
- rw = _payload(untrusted["results"][1])
+ rw = payload(untrusted["results"][1])
assert "error" in rw and untrusted["canary"] not in json.dumps(rw), rw
def test_untrusted_server_runs_read_only_tool_without_approval(untrusted: dict[str, Any]) -> None:
received = calls_received(untrusted["log"], "ro_probe")
- ro = _payload(untrusted["results"][0])
- assert received and f"RO:{untrusted['canary']}:r" in json.dumps(ro), (
- f"readOnlyHint=true tool was gated on an untrusted server: server got {received}, model got {ro}")
+ ro = payload(untrusted["results"][0])
+ symptom(received and f"RO:{untrusted['canary']}:r" in json.dumps(ro),
+ f"readOnlyHint=true tool was gated on an untrusted server: server got {received}, model got {ro}")
def test_default_trust_server_runs_destructive_tool(tmp_path: Path) -> None:
@@ -143,10 +142,10 @@ def test_no_required_param_tools_receive_an_arguments_object(tmp_path: Path, bri
got = sorted((p["name"], json.dumps(p.get("arguments"), sort_keys=True)) for p in received)
want = sorted((name, json.dumps(expect, sort_keys=True)) for name, _, expect in NO_ARG_SPELLINGS)
assert got == want, f"server received {got}, want {want}"
- for p in received:
- meta = p.get("_meta", {})
- assert isinstance(meta, dict), f"_meta must be an object when present: {p}"
assert all(obs["canary"] in r for r in obs["results"]), obs["results"]
+ # Last, so the KNOWN symptom below can never mask a wrong-arguments failure above.
+ empty_meta = [p for p in received if "_meta" in p and not p["_meta"]]
+ symptom(not empty_meta, f"tools/call carried an information-free params._meta: {empty_meta}")
# Image results -----------------------------------------------------------------------------------------
@@ -157,7 +156,7 @@ def images(tmp_path_factory: pytest.TempPathFactory) -> dict[str, Any]:
fmts = ("png", *UNSUPPORTED_IMAGES)
obs = _run(tmp_path_factory.mktemp("images"), [("image_probe", {"fmt": f}) for f in fmts])
assert len(obs["results"]) == len(fmts), obs["results"]
- obs["by_fmt"] = dict(zip(fmts, (_payload(r) for r in obs["results"])))
+ obs["by_fmt"] = dict(zip(fmts, (payload(r) for r in obs["results"])))
return obs
@@ -171,10 +170,10 @@ def test_cacheable_image_reaches_the_model_as_a_media_file(images: dict[str, Any
@pytest.mark.parametrize("fmt", UNSUPPORTED_IMAGES)
def test_uncacheable_image_is_reported_to_the_model(images: dict[str, Any], fmt: str) -> None:
- payload = images["by_fmt"][fmt]
- text = json.dumps(payload)
+ block = images["by_fmt"][fmt]
+ text = json.dumps(block)
status = f"IMG-STATUS:{images['canary']}:{fmt}"
- assert status in text, f"the text block next to the image was lost: {payload}"
+ assert status in text, f"the text block next to the image was lost: {block}"
rest = text.replace(status, "")
- assert "image" in rest.lower(), (
- f"{fmt} image block vanished: the model got no sign the tool returned an image: {payload}")
+ symptom("image" in rest.lower(),
+ f"{fmt} image block vanished: the model got no sign the tool returned an image: {block}")
diff --git a/tests/e2e/core/mcp_plugins/test_mcp_streamable_http.py b/tests/e2e/core/mcp_plugins/test_mcp_streamable_http.py
index 079a5cc5cef..c9112a15d88 100644
--- a/tests/e2e/core/mcp_plugins/test_mcp_streamable_http.py
+++ b/tests/e2e/core/mcp_plugins/test_mcp_streamable_http.py
@@ -27,14 +27,17 @@ import pytest
from tests.e2e.core.mcp_plugins._helpers import (
FINAL,
HttpMcpServer,
+ apply_known,
build_home,
call_tool,
calls_received,
http_server_cfg,
inbound,
+ payload,
provider,
run_chat_q,
script,
+ symptom,
tool_name,
tool_results,
)
@@ -58,15 +61,7 @@ KNOWN: dict[str, str] = {
@pytest.fixture(autouse=True)
def _known(request: pytest.FixtureRequest) -> None:
- reason = KNOWN.get(request.node.name)
- if reason:
- request.applymarker(pytest.mark.xfail(strict=True, raises=AssertionError, reason=reason))
-
-
-def _payload(result: str) -> dict[str, Any]:
- match = re.search(r"^\{.*\}$", result, re.M | re.S)
- assert match, f"no JSON payload in tool result: {result!r}"
- return json.loads(match.group(0))
+ apply_known(request, KNOWN)
def _one_turn(root: Path, calls: list[tuple[str, dict]], *, unauthorized_calls: int = 0) -> dict[str, Any]:
@@ -105,7 +100,7 @@ def test_no_information_free_meta_is_sent_over_http(shape: dict[str, Any]) -> No
requests = [m for m in inbound(shape["log"]) if isinstance(m, dict) and "id" in m and "method" in m]
assert requests, "the server logged no requests"
empty = [m["method"] for m in requests if "_meta" in (m.get("params") or {}) and not m["params"]["_meta"]]
- assert not empty, f"requests carried an empty/null params._meta: {empty}"
+ symptom(not empty, f"requests carried an empty/null params._meta: {empty}")
# 401 on tools/call ---------------------------------------------------------------------------------
@@ -120,17 +115,17 @@ def unauthorized(tmp_path_factory: pytest.TempPathFactory) -> dict[str, Any]:
def test_401_on_tools_call_is_reported_as_an_auth_failure(unauthorized: dict[str, Any]) -> None:
assert any("injected_401_for" in m for m in inbound(unauthorized["log"]) if isinstance(m, dict)), (
"fixture never answered 401 (vacuous)")
- first = _payload(unauthorized["results"][0])
+ first = payload(unauthorized["results"][0])
assert "error" in first, first
- assert re.search(r"auth|401|sign.?in|credential", json.dumps(first), re.I), (
- f"a 401 on tools/call reached the model without any sign it is an auth failure: {first}")
+ symptom(re.search(r"auth|401|sign.?in|credential", json.dumps(first), re.I),
+ f"a 401 on tools/call reached the model without any sign it is an auth failure: {first}")
def test_the_call_after_a_401_reaches_the_server(unauthorized: dict[str, Any]) -> None:
served = [m for m in inbound(unauthorized["log"])
if isinstance(m, dict) and m.get("method") == "tools/call"]
assert len(served) >= 2, f"the call after the 401 never reached the server: {served}"
- second = _payload(unauthorized["results"][-1])
+ second = payload(unauthorized["results"][-1])
assert f"NOARGS:{unauthorized['canary']}" in json.dumps(second), (
f"the connection stayed broken after one 401: {second}")
@@ -177,7 +172,7 @@ def test_server_crash_mid_call_fails_that_call_and_the_next_turn_reconnects(tmp_
crashed = tool_results(srv)
assert calls_received(http.log, "crash_probe"), f"crash_probe never reached the server: {crashed}"
assert http.wait_exit(30) == 7, "fixture server did not crash in the call"
- assert len(crashed) == 1 and "error" in _payload(crashed[0]), crashed
+ assert len(crashed) == 1 and "error" in payload(crashed[0]), crashed
assert len(calls_received(http.log, "crash_probe")) == 1, "crashed call was replayed"
assert host.proc.poll() is None, f"host died with the MCP server:\n{host.cap.stderr[-2000:]}"
@@ -186,7 +181,7 @@ def test_server_crash_mid_call_fails_that_call_and_the_next_turn_reconnects(tmp_
assert FINAL in host.turn(sid, "Use the web tool again.")
after = tool_results(srv)[1:]
assert len(after) == len(turn2), after
- assert canary in after[must_succeed], f"{kind}: next turn did not reach the restarted server: {after}"
+ symptom(canary in after[must_succeed], f"{kind}: next turn did not reach the restarted server: {after}")
served_by = {m["pid"] for m in _raw(http.log) if m["msg"].get("method") == "tools/call"
and (m["msg"].get("params") or {}).get("name") == turn2[0]}
assert served_by and old_pid not in served_by, served_by
diff --git a/tests/e2e/core/mcp_plugins/test_plugin_activation.py b/tests/e2e/core/mcp_plugins/test_plugin_activation.py
index fd1406a844d..13a634bb14a 100644
--- a/tests/e2e/core/mcp_plugins/test_plugin_activation.py
+++ b/tests/e2e/core/mcp_plugins/test_plugin_activation.py
@@ -16,8 +16,9 @@ fixture server, launched from a portable package under ``<HERMES_HOME>/plugins/<
``.bak-*`` copy next to it) is what ``hermes plugins list`` shows and what a real turn runs,
and the collision is reported (#121078).
-Open bugs are strict xfails through ``KNOWN`` (drop the entry when its fix lands); only an
-``AssertionError`` counts as the bug, so a boot failure or a crash stays red.
+Open bugs are strict xfails through ``KNOWN`` (drop the entry when its fix lands); only a
+``KnownSymptom`` raised by the bug's own assertion counts as the bug, so a boot failure, a
+precondition, a timeout or a crash stays red.
"""
from __future__ import annotations
@@ -33,6 +34,7 @@ import pytest
from tests.e2e.core.mcp_plugins._helpers import (
FINAL,
+ apply_known,
build_home,
calls_received,
inbound,
@@ -40,7 +42,9 @@ from tests.e2e.core.mcp_plugins._helpers import (
run_chat_q,
script,
stdio_server,
+ symptom,
tool_name,
+ tool_names,
tool_results,
)
from tests.e2e.core.mcp_plugins._plugin_helpers import portable_stdio, reap_tagged, tui_host, write_portable_plugin
@@ -66,17 +70,16 @@ KNOWN: dict[str, str] = {
}
-def known(fn):
- """Strict xfail when the test's name is a KNOWN entry; a plain test otherwise."""
- if fn.__name__ not in KNOWN:
- return fn
- return pytest.mark.xfail(strict=True, raises=AssertionError, reason=KNOWN[fn.__name__])(fn)
[email protected](autouse=True)
+def _known(request: pytest.FixtureRequest) -> None:
+ apply_known(request, KNOWN)
PLUGIN = "e2eplug"
SERVER = "plug"
PLUG_TOOL = tool_name(SERVER, "ro_probe")
CALL_RE = re.compile(r"CALL-PLUGIN:([A-Za-z0-9]+)")
+ENV_RE = re.compile(r"ENV:[^:\s\"\\]*:[^\s\"\\]*")
def _user_text(msg: dict[str, Any]) -> str:
@@ -104,10 +107,6 @@ def _first_request_of_turn(bodies: list[dict[str, Any]], marker: str) -> dict[st
raise AssertionError(f"no request opened the {marker!r} turn: {[_last_user(b)[-80:] for b in bodies]}")
-def _names(body: dict[str, Any]) -> set[str]:
- return {str((t.get("function") or {}).get("name")) for t in body.get("tools") or []}
-
-
def _canon(value: Any) -> str:
return json.dumps(value, sort_keys=True, ensure_ascii=False)
@@ -147,8 +146,8 @@ def test_plugin_enabled_mid_chat_is_usable_in_that_chat_with_an_unchanged_tools_
after = _first_request_of_turn(bodies, "TURN-TWO")
assert _canon(after.get("tools")) == _canon(before.get("tools")), (
"enabling a plugin mid-chat changed the open chat's model-facing tools[] "
- f"(prompt-cache prefix): added {sorted(_names(after) - _names(before))}, "
- f"removed {sorted(_names(before) - _names(after))}")
+ f"(prompt-cache prefix): added {sorted(tool_names(after) - tool_names(before))}, "
+ f"removed {sorted(tool_names(before) - tool_names(after))}")
assert before["messages"][0].get("role") == "system", before["messages"][0]
assert _canon(after["messages"][0]) == _canon(before["messages"][0]), (
"enabling a plugin mid-chat rewrote the open chat's system prompt (prompt-cache prefix)")
@@ -165,7 +164,6 @@ def test_plugin_enabled_mid_chat_is_usable_in_that_chat_with_an_unchanged_tools_
# 2. #119751 resource-only portable server -----------------------------------------------------
-@known
def test_resource_only_plugin_activated_live_is_reported_connected(tmp_path: Path) -> None:
log = tmp_path / "res_inbound.jsonl"
with provider(script()) as srv:
@@ -178,8 +176,8 @@ def test_resource_only_plugin_activated_live_is_reported_connected(tmp_path: Pat
# Guard: the server really completed the MCP handshake with this host.
assert "initialize" in methods and "notifications/initialized" in methods, methods
assert [r["name"] for r in rows] == [SERVER], rows
- assert rows[0]["connected"] is True and not rows[0].get("error"), (
- f"a resource-only MCP server that completed the handshake is reported as failed: {rows[0]}")
+ symptom(rows[0]["connected"] is True and not rows[0].get("error"),
+ f"a resource-only MCP server that completed the handshake is reported as failed: {rows[0]}")
# 3. #120526 ${VAR} in a portable mcp.json env (native config.yaml is the control) ---------------
@@ -214,26 +212,31 @@ def env_echo_results(tmp_path_factory: pytest.TempPathFactory) -> dict[str, str]
return {**by_server, "output": proc.stdout + proc.stderr}
+def _env_line(result: str) -> str:
+ """The server's ``ENV:<canary>:<value>`` echo inside the tool result (what the server saw)."""
+ match = ENV_RE.search(result)
+ assert match, f"no ENV: echo in the tool result: {result[-300:]}"
+ return match.group(0)
+
+
def test_native_mcp_env_placeholder_is_interpolated(env_echo_results: dict[str, str]) -> None:
- result = env_echo_results["nat"]
- assert "ENV:NO-CANARY:native-dotenv-value" in result, (
- f"native mcp_servers env ${{VAR}} did not reach the server with the .env value: {result[-300:]}")
+ echoed = _env_line(env_echo_results["nat"])
+ assert echoed == "ENV:NO-CANARY:native-dotenv-value", (
+ f"native mcp_servers env ${{VAR}} did not reach the server with the .env value: {echoed}")
-@known
def test_portable_mcp_env_placeholder_is_interpolated(env_echo_results: dict[str, str]) -> None:
- result = env_echo_results[SERVER]
- assert "${E2E_PORTABLE_KEY}" not in result, (
- f"the portable plugin's server received the literal placeholder: {result[-300:]}")
- assert "ENV:NO-CANARY:portable-dotenv-value" in result, result[-300:]
+ echoed = _env_line(env_echo_results[SERVER])
+ symptom("${E2E_PORTABLE_KEY}" not in echoed,
+ f"the portable plugin's server received the literal placeholder: {echoed}")
+ assert echoed == "ENV:NO-CANARY:portable-dotenv-value", echoed
-@known
def test_enabled_portable_plugin_server_is_not_reported_as_an_unknown_toolset(env_echo_results: dict[str, str]) -> None:
"""The enabled plugin's server worked in that very run (the fixture asserts its tool result), so a
startup warning calling it an unknown toolset is a false alarm the user sees on every launch."""
warned = [line for line in env_echo_results["output"].splitlines() if "Unknown toolsets" in line]
- assert not warned, f"`hermes chat` warned about the enabled plugin's MCP server: {warned}"
+ symptom(not warned, f"`hermes chat` warned about the enabled plugin's MCP server: {warned}")
# 4. #121078 same manifest name in two user plugin dirs ------------------------------------------
@@ -274,20 +277,17 @@ def test_same_name_collision_still_loads_exactly_one_copy(name_collision: dict[s
assert len(hits) == 1, name_collision["results"]
-@known
def test_same_name_backup_dir_does_not_shadow_the_live_plugin(name_collision: dict[str, Any]) -> None:
rows = [line for line in name_collision["listing"].splitlines() if re.search(r"\bfoo\s*$", line)]
- assert rows and "2.0.0" in rows[0], (
- f"`hermes plugins list` shows the backup copy instead of plugins/foo (v2.0.0): {rows}")
- assert any("RO:CANARY-LIVE:dup" in r for r in name_collision["results"]), (
- f"a real turn ran the backup dir's MCP server, not plugins/foo's: {name_collision['results']}")
+ assert rows, name_collision["listing"]
+ symptom("2.0.0" in rows[0], f"`hermes plugins list` shows the backup copy instead of plugins/foo (v2.0.0): {rows}")
+ symptom(any("RO:CANARY-LIVE:dup" in r for r in name_collision["results"]),
+ f"a real turn ran the backup dir's MCP server, not plugins/foo's: {name_collision['results']}")
-@known
def test_same_name_plugin_collision_is_reported(name_collision: dict[str, Any]) -> None:
live, backup = str(name_collision["live"]), str(name_collision["backup"])
surfaces = {"hermes plugins list": name_collision["listing"], "logs/*.log": name_collision["logs"]}
named_both = [where for where, text in surfaces.items() if live in text and backup in text]
- assert named_both, (
- f"two user plugin dirs declare the same name 'foo' ({live} and {backup}) but no user-visible "
- f"surface names both: {', '.join(surfaces)}")
+ symptom(named_both, f"two user plugin dirs declare the same name 'foo' ({live} and {backup}) but no "
+ f"user-visible surface names both: {', '.join(surfaces)}")