The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tools): say 'MCP connection missing' when only the MCP connection is missing
Brooklyn Nicholson48cf36fb693a
diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsxindex 43ce9086f54..94718a6d794 100644--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx@@ -119,6 +119,7 @@ function installAgentHalfHere(record: PluginRecord, profile: null | string) {const SERVER_TONE = {connected: 'success',app_not_running: 'warn',+ hermes_not_connected: 'warn',endpoint_unavailable: 'warn',no_interactive_session: 'warn',unknown: 'warn',diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex f7d74581fcd..9d496680f03 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -2810,6 +2810,7 @@ export const deOverrides = {serverStates: {connected: 'verbunden',app_not_running: 'App läuft nicht',+ hermes_not_connected: 'MCP-Verbindung fehlt',endpoint_unavailable: 'Endpunkt nicht verfügbar',no_interactive_session: 'keine interaktive Session',version_too_old: 'Version zu alt',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex c8c60aaa5c6..e3c0041fbff 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -2505,6 +2505,7 @@ export const en: Translations = {serverStates: {connected: 'connected',app_not_running: 'app not running',+ hermes_not_connected: 'MCP connection missing',endpoint_unavailable: 'endpoint unavailable',no_interactive_session: 'no interactive session',version_too_old: 'version too old',diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex 6097799ed37..a416a02055d 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -2801,6 +2801,7 @@ export const esOverrides = {serverStates: {connected: 'conectado',app_not_running: 'la app no se está ejecutando',+ hermes_not_connected: 'falta la conexión MCP',endpoint_unavailable: 'endpoint no disponible',no_interactive_session: 'sin sesión interactiva',version_too_old: 'versión demasiado antigua',diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex 976ad46a590..a1c536c60cd 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -2819,6 +2819,7 @@ export const frOverrides = {serverStates: {connected: 'connecté',app_not_running: 'application non lancée',+ hermes_not_connected: 'connexion MCP manquante',endpoint_unavailable: 'point de terminaison indisponible',no_interactive_session: 'aucune session interactive',version_too_old: 'version trop ancienne',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 589d5d3871a..58636066324 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -2117,6 +2117,7 @@ export interface Translations {serverStates: {connected: stringapp_not_running: string+ hermes_not_connected: stringendpoint_unavailable: stringno_interactive_session: stringversion_too_old: stringdiff --git a/apps/desktop/src/store/agent-plugins.ts b/apps/desktop/src/store/agent-plugins.tsindex 01675a845ad..534b41a21c6 100644--- a/apps/desktop/src/store/agent-plugins.ts+++ b/apps/desktop/src/store/agent-plugins.ts@@ -18,6 +18,7 @@ import { notifyError } from '@/store/notifications'export type AgentPluginServerState =| 'connected'| 'app_not_running'+ | 'hermes_not_connected'| 'endpoint_unavailable'| 'no_interactive_session'| 'version_too_old'diff --git a/tests/tools/test_mcp_liveness.py b/tests/tools/test_mcp_liveness.pyindex 4d6f5567a4e..623be3d90de 100644--- a/tests/tools/test_mcp_liveness.py+++ b/tests/tools/test_mcp_liveness.py@@ -134,7 +134,9 @@ def test_hydrated_error_shape_for_registered_declaration(tmp_path, monkeypatch):payload = json.loads(error)assert server is Noneassert payload["server"] == "example-server"- assert payload["state"] == "app_not_running"+ # Static liveness cannot observe the app, so it must not claim the app is not+ # running: the honest state is the missing MCP connection (#119975).+ assert payload["state"] == "hermes_not_connected"assert payload["app"]["name"] == "Example App"assert payload["user_action"]assert payload["retry"] == "after_user_action"@@ -151,3 +153,73 @@ def test_connected_interactive_session_server_is_offerable_from_a_service_sessioassert mcp_tool_handlers._declared_app_offerable("example-server") is Truefinally:declaration.unregister("example-server")++def test_running_app_with_live_endpoint_reports_the_missing_connection(tmp_path, monkeypatch):+ """The #119975 report: the app runs and its endpoint answers, only Hermes' MCP connection+ is missing. That must read as a missing connection with a reconnect action — not as+ \"<slug> is not running. Start <slug>\" for an app that IS running."""+ import hermes_cli.agent_plugins as agent_plugins+ from hermes_platform.resolver.core import CheckState+ from tools import mcp_liveness++ class _RunningApp:+ def __init__(self, _definition):+ pass++ def locate(self, _ctx=None):+ return object()++ def probe(self, _resolution, effort=None):+ return type("Probe", (), {+ "running": type("Value", (), {"value": True})(),+ "endpoint": type("Endpoint", (), {"state": CheckState.PRESENT})(),+ })()++ monkeypatch.setattr(mcp_liveness, "AppResolver", _RunningApp)+ monkeypatch.setattr(agent_plugins, "liveness_for", lambda name: {+ "kind": "server_json", "path": str(tmp_path / "runtime.json"),+ }, raising=False)+ decl = _decl(tmp_path)+ declaration.register("example-server", decl)+ try:+ current = mcp_liveness.status("example-server")+ finally:+ declaration.unregister("example-server")++ assert current is not None+ assert current.state == "hermes_not_connected"+ sentence = mcp_liveness.describe(decl, current.availability, current.state)+ assert "MCP connection is missing" in sentence+ assert "is not running" not in sentence+ assert current.user_action.startswith("Reconnect")++def test_static_liveness_cannot_claim_the_app_is_not_running(tmp_path, monkeypatch):+ """Static/unknown liveness kinds have no app probe, so their honest state is the missing+ connection — not a verdict that an app they cannot see is stopped (#119975)."""+ import hermes_cli.agent_plugins as agent_plugins+ from tools import mcp_liveness++ monkeypatch.setattr(agent_plugins, "liveness_for", lambda name: {"kind": "static"}, raising=False)+ decl = _decl(tmp_path)+ declaration.register("example-server", decl)+ try:+ current = mcp_liveness.status("example-server")+ finally:+ declaration.unregister("example-server")++ assert current is not None+ assert current.state == "hermes_not_connected"+ sentence = mcp_liveness.describe(decl, current.availability, current.state)+ assert "MCP connection is missing" in sentence+ assert "is not running" not in sentence++def test_describe_prefers_the_plugin_title_over_the_server_slug(tmp_path):+ """The Plugins tab knows the plugin's catalog title; the sentence should name the app by+ it instead of the declaration's slug (#119975)."""+ from tools import mcp_liveness++ decl = _decl(tmp_path)+ sentence = mcp_liveness.describe(decl, None, "hermes_not_connected", display_name="Example Tools")+ assert sentence.startswith("Example Tools")+ assert "Example App" not in sentence+ assert "MCP connection is missing" in sentencediff --git a/tools/mcp_liveness.py b/tools/mcp_liveness.pyindex 17efb80c00d..26be12ff563 100644--- a/tools/mcp_liveness.py+++ b/tools/mcp_liveness.py@@ -18,6 +18,7 @@ logger = logging.getLogger(__name__)LivenessKind = Literal["static", "server_json", "interactive_session"]LivenessState = Literal["app_not_running",+ "hermes_not_connected","endpoint_unavailable","no_interactive_session","version_too_old",@@ -109,6 +110,7 @@ def liveness_for(server_name: str) -> Liveness:def _action(state: LivenessState, app_name: str) -> tuple[str, Retry]:actions: dict[LivenessState, tuple[str, Retry]] = {"app_not_running": (f"Start {app_name}, then try again.", "after_user_action"),+ "hermes_not_connected": (f"Reconnect {app_name} in Hermes, then try again.", "after_user_action"),"endpoint_unavailable": (f"Open {app_name} and enable its local connection, then try again.", "after_user_action"),"no_interactive_session": (f"Open an interactive desktop session and start {app_name}, then try again.", "never_here"),"version_too_old": (f"Update {app_name}, then try again.", "after_user_action"),@@ -143,16 +145,25 @@ def status(server_name: str) -> Status | None:elif probe.endpoint.state is not CheckState.PRESENT:state = "endpoint_unavailable"else:- state = "app_not_running"+ # The app runs and its endpoint answers: the only thing missing is Hermes' own+ # MCP connection to it. Telling the user to "start" an app that IS running is+ # the wrong instruction (#119975).+ state = "hermes_not_connected"else:- state = "app_not_running"+ # static / unknown liveness kinds cannot observe the app, so they cannot conclude it+ # is not running; the honest answer is that Hermes is not connected (#119975).+ state = "hermes_not_connected"action, retry = _action(state, decl.name)return Status(state, available, live, action, retry)-def describe(decl: declaration.Declaration, available: Availability, liveness_state: LivenessState) -> str:- """Compose one unavailable-state sentence with one user action."""- app_name = decl.name+def describe(decl: declaration.Declaration, available: Availability, liveness_state: LivenessState,+ display_name: str | None = None) -> str:+ """Compose one unavailable-state sentence with one user action.++ ``display_name`` overrides the declaration's slug when the caller knows the plugin's+ catalog/manifest title — the Plugins tab does, and a raw slug reads like an error code."""+ app_name = display_name or decl.nameaction, _retry = _action(liveness_state, app_name)if liveness_state == "missing_app":reason = f"{app_name} is not installed."@@ -164,6 +175,8 @@ def describe(decl: declaration.Declaration, available: Availability, liveness_streason = f"{app_name} needs an interactive desktop session."elif liveness_state == "endpoint_unavailable":reason = f"{app_name}'s local endpoint is unavailable."+ elif liveness_state == "hermes_not_connected":+ reason = f"{app_name}'s MCP connection is missing."else:reason = f"{app_name} is not running."return f"{reason} {action}"diff --git a/tui_gateway/contracts/tools_mcp_plugins.py b/tui_gateway/contracts/tools_mcp_plugins.pyindex 35e268911e9..8cab1697316 100644--- a/tui_gateway/contracts/tools_mcp_plugins.py+++ b/tui_gateway/contracts/tools_mcp_plugins.py@@ -637,6 +637,7 @@ class PluginSettingField(Result):class PluginServerState(WireEnum):connected = "connected"app_not_running = "app_not_running"+ hermes_not_connected = "hermes_not_connected"endpoint_unavailable = "endpoint_unavailable"no_interactive_session = "no_interactive_session"version_too_old = "version_too_old"diff --git a/tui_gateway/methods_tools.py b/tui_gateway/methods_tools.pyindex 0fa22c3042c..e8836cb96e3 100644--- a/tui_gateway/methods_tools.py+++ b/tui_gateway/methods_tools.py@@ -1576,6 +1576,16 @@ def _plugin_server_rows(plugin_dir: Path | None, key: str, *, portable: bool) ->liveness = _tools_mod("tools.mcp_liveness")core = _tools_mod("tools.mcp_tool_common")._coreresolve_key = _tools_mod("tools.mcp_tool_scope")._resolve_server_key+ # The server sentence's app name: the curated catalog title when the package is a catalog+ # install, else the manifest name, else the server slug the declaration carries — a raw+ # slug reads like an error code (#119975).+ display_name = str(package.manifest.get("name") or "") or None+ sidecar = _tools_mod("hermes_cli.plugins_cmd_catalog").catalog_install_record(plugin_dir)+ if sidecar:+ entry = _tools_mod("hermes_cli.plugin_catalog").get_live_catalog_entry(+ str(sidecar.get("catalog_name") or ""))+ if entry is not None and entry.title:+ display_name = entry.titlerows = []for name in sorted(declared):internal_name = server_name_for(key, name)@@ -1593,7 +1603,7 @@ def _plugin_server_rows(plugin_dir: Path | None, key: str, *, portable: bool) ->rows.append({"name": name,"state": status.state,- "sentence": liveness.describe(decl, status.availability, status.state),+ "sentence": liveness.describe(decl, status.availability, status.state, display_name),})return rows