The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: a down local model server reads as itself in the TUI, dashboard and chat replies
Teknium6c625765d69e
diff --git a/hermes_cli/runtime_provider_custom.py b/hermes_cli/runtime_provider_custom.pyindex 6b8439ed942..72913cf22a2 100644--- a/hermes_cli/runtime_provider_custom.py+++ b/hermes_cli/runtime_provider_custom.py@@ -617,11 +617,12 @@ def _resolve_llamacpp_runtime(requested_provider: str, explicit_api_key: Optionaenabled = Falseif enabled:raise LocalRuntimeUnavailableError("The local model server isn't running. It may still be "- "starting — try again in a moment, or check Settings → "- "Providers → Local models.", retryable=True)- raise LocalRuntimeUnavailableError("The local model server is turned off. Turn it back on in "- "Settings → Providers → Local models, or switch to another "- "model.")+ "starting — try again in a moment, or switch to another "+ "model with /model.", retryable=True)+ # Every chat surface (messaging, TUI, Webapp) shows this sentence, so it names no Desktop-only+ # pane; the Desktop client links its Local models pane itself.+ raise LocalRuntimeUnavailableError("The local model server is turned off. Turn it back on in the "+ "Hermes desktop app, or switch to another model with /model.")def _custom_runtime(rp, base_url: str, api_key: Any, api_mode: Optional[str], **extra: Any) -> dict[str, Any]:diff --git a/tests/hermes_cli/test_local_runtime_unavailable_surface.py b/tests/hermes_cli/test_local_runtime_unavailable_surface.pyindex ec905f7040c..e3c543845e9 100644--- a/tests/hermes_cli/test_local_runtime_unavailable_surface.py+++ b/tests/hermes_cli/test_local_runtime_unavailable_surface.py@@ -74,3 +74,29 @@ def test_turn_failure_is_an_endpoint_failure_not_a_rejected_key(llamacpp_home, eassert surface["layer"] == "endpoint"assert surface["code"] == "local_runtime_unavailable"assert "auth_kind" not in surface++[email protected]("enabled", [False, True])+def test_chat_text_names_the_local_server_and_no_desktop_only_pane(llamacpp_home, enabled):+ """The messaging reply and the TUI/dashboard turn text both name the local model server, and+ neither points at Settings → Providers → Local models, a pane only the Desktop app has."""+ from agent.error_surface import build_error_surface_from_result+ from gateway.config import Platform+ from gateway.run_turn_runner import _resolution_failure_reply+ from tui_gateway.user_messages import turn_error_text++ llamacpp_home({"enabled": enabled})+ exc = _resolution_error()+ reply, reason, retryable = _resolution_failure_reply(exc, Platform.TELEGRAM)+ surface = build_error_surface_from_result(+ {"failed": True, "error": str(exc), "failure_reason": reason, "failure_retryable": retryable},+ provider="llamacpp")+ tui = turn_error_text(str(exc), surface, recoverable=retryable)++ title = tui.splitlines()[0]+ assert "local model server" in title+ assert "custom model endpoint" not in tui+ for text in (reply, tui):+ assert "local model server" in text+ assert "Settings" not in text and "Local models" not in text+ assert "/model" in textdiff --git a/tui_gateway/user_messages.py b/tui_gateway/user_messages.pyindex 6e73065e996..6b58b909cd5 100644--- a/tui_gateway/user_messages.py+++ b/tui_gateway/user_messages.py@@ -31,6 +31,9 @@ _TURN_ERROR_CODE_COPY: dict[str, tuple[str, str]] = {"content_policy_blocked": ("The model provider refused this request (content policy)", "Rephrase and send again."),"provider_policy_blocked": ("The model provider refused this request (account policy)", "Switch with /model."),"format_error": ("The model provider rejected the request format", "Try /retry; if it persists, switch with /model."),+ # The managed local model server (llama.cpp) is down: starting, or switched off.+ "local_runtime_unavailable": ("The local model server is not running",+ "Try /retry once it is up, or switch with /model."),"ssl_cert_verification": ("The connection to the model provider could not be verified (TLS)","Check the endpoint's certificate, then /retry."),}diff --git a/ui-tui/src/__tests__/userMessages.test.ts b/ui-tui/src/__tests__/userMessages.test.tsindex ccde8dae8b4..613b275f3e7 100644--- a/ui-tui/src/__tests__/userMessages.test.ts+++ b/ui-tui/src/__tests__/userMessages.test.ts@@ -43,6 +43,17 @@ describe('describeTurnFailure', () => {expect(text).toContain('/retry')})+ it('names the local model server when the managed local runtime is down, not a custom endpoint', () => {+ const text = describeTurnFailure({+ error: "The local model server isn't running. It may still be starting.",+ error_surface: { code: 'local_runtime_unavailable', layer: 'endpoint', provider: 'llamacpp', retryable: true }+ })++ expect(text.split('\n')[0]).toContain('local model server')+ expect(text).not.toContain('custom model endpoint')+ expect(text).toContain('/model')+ })+it('falls back to the layer copy, and to a generic title, when the code is unknown', () => {const streaming = describeTurnFailure({error: 'peer closed connection',diff --git a/ui-tui/src/app/userMessages.ts b/ui-tui/src/app/userMessages.tsindex f63c7649162..8ad93d9d34a 100644--- a/ui-tui/src/app/userMessages.ts+++ b/ui-tui/src/app/userMessages.ts@@ -271,6 +271,7 @@ const TURN_CODE_KEY: Record<string, keyof Translations['userMessages']['turn']['content_policy_blocked: 'contentPolicyBlocked',context_overflow: 'contextOverflow',format_error: 'formatError',+ local_runtime_unavailable: 'localRuntimeUnavailable',model_not_found: 'modelNotFound',overloaded: 'overloaded',payload_too_large: 'payloadTooLarge',diff --git a/ui-tui/src/i18n/en/userMessages.ts b/ui-tui/src/i18n/en/userMessages.tsindex 06ae4774d26..99e029416ef 100644--- a/ui-tui/src/i18n/en/userMessages.ts+++ b/ui-tui/src/i18n/en/userMessages.ts@@ -100,6 +100,11 @@ export const userMessagesEn = {hint: 'Try /retry; if it persists, switch with /model.',hintNoRetry: 'Pick another model with /model; if it persists, switch with /model.'},+ localRuntimeUnavailable: {+ title: 'The local model server is not running',+ hint: 'Try /retry once it is up, or switch with /model.',+ hintNoRetry: 'Turn it back on, or switch with /model.'+ },modelNotFound: {title: 'The model provider does not know this model',hint: 'Pick another model with /model.'