The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(chat): the dashboard's /chat tab on a host with no PTY bridge shows main's message again
emozillad3c593136212
diff --git a/hermes_cli/web_routers/chat_ws.py b/hermes_cli/web_routers/chat_ws.pyindex e10181dda1e..cb04519f1e0 100644--- a/hermes_cli/web_routers/chat_ws.py+++ b/hermes_cli/web_routers/chat_ws.py@@ -485,7 +485,13 @@ async def pty_ws(ws: WebSocket) -> None:# Native Windows can't import the POSIX PTY bridge: say so and close cleanly.if not _PTY_BRIDGE_AVAILABLE:- await _pty_fail(ws, PtyUnavailableError("Pseudo-terminal support is not installed on this host."))+ await ws.send_text(+ "\r\n\x1b[31mChat unavailable: the embedded terminal requires a "+ "POSIX PTY, which native Windows Python doesn't provide.\x1b[0m\r\n"+ "\x1b[33mInstall Hermes inside WSL2 to use the dashboard's /chat "+ "tab — the rest of the dashboard works here.\x1b[0m\r\n"+ )+ await ws.close(code=1011)returnraw_resume = ws.query_params.get("resume") or Nonediff --git a/tests/hermes_cli/test_pty_keepalive_ws.py b/tests/hermes_cli/test_pty_keepalive_ws.pyindex 1a09abaa0d2..256dca40c6b 100644--- a/tests/hermes_cli/test_pty_keepalive_ws.py+++ b/tests/hermes_cli/test_pty_keepalive_ws.py@@ -100,6 +100,25 @@ async def test_stalled_input_closes_only_the_keepalive_socket(assert web_server.PTY_REGISTRY._sessions["TOK1"].alive is False+def test_chat_without_a_pty_bridge_says_what_to_install_as_on_main(pty_keepalive_harness, monkeypatch):+ """On a host whose PTY bridge cannot load, the dashboard's /chat tab prints main's message, which+ says the rest of the dashboard works and where to install Hermes for chat, and closes 1011."""+ from starlette.testclient import TestClient+ from starlette.websockets import WebSocketDisconnect++ monkeypatch.setattr(_web_server_chat, "_PTY_BRIDGE_AVAILABLE", False)+ client = TestClient(web_server.app)+ with client.websocket_connect("/api/pty?attach=TOK1") as ws:+ text = ws.receive_text()+ with pytest.raises(WebSocketDisconnect) as closed:+ ws.receive_text()++ assert "Chat unavailable: the embedded terminal requires a POSIX PTY" in text+ assert "Install Hermes inside WSL2 to use the dashboard's /chat tab" in text+ assert closed.value.code == 1011+ assert pty_keepalive_harness == []++@pytest.mark.asyncioasync def test_attach_token_reuses_same_resume(pty_keepalive_harness):from starlette.testclient import TestClient