Skip to content

Keep dashboard chat alive across reconnects - #47297

Closed
ljubomirj wants to merge 1 commit into
NousResearch:mainfrom
ljubomirj:pr/console-keepalive
Closed

Keep dashboard chat alive across reconnects#47297
ljubomirj wants to merge 1 commit into
NousResearch:mainfrom
ljubomirj:pr/console-keepalive

Conversation

@ljubomirj

Copy link
Copy Markdown

Summary

Keep the dashboard chat session alive across transient browser WebSocket disconnects, such as laptop sleep/wake or network loss.

This changes /api/pty ownership so an abnormal WebSocket close parks the PTY bridge for a bounded reconnect window instead of immediately closing the hermes --tui child. The browser chat tab now retries the PTY WebSocket with bounded exponential backoff and reuses the same stable channel id, so reconnecting can reclaim the running TUI session and its history.

Details

  • Add a reconnectable PTY bridge pool keyed by chat channel id.
  • Reclaim a parked PTY bridge on reconnect instead of spawning a fresh child.
  • Keep abnormal/no-status WebSocket closes (1006/1005) alive for reconnect, while intentional page teardown (1000) still closes normally.
  • Wait for WebSocket.onopen before sending resize data or announcing reconnect success.
  • Extend regression coverage for abnormal disconnect/reclaim behavior.
  • Relax TUI gateway orphan reaping so short sleep/wake gaps do not discard active sessions too aggressively.

Validation

  • python3 -m py_compile hermes_cli/web_server.py tui_gateway/server.py
  • git diff --cached --check
  • /Users/ljubomir/hermes-agent-macbook2/.venv/bin/python -m pytest tests/hermes_cli/test_web_server.py -k 'reconnectable or TestPtyWebSocket' -q
  • /Users/ljubomir/hermes-agent-macbook2/.venv/bin/python -m pytest tests/test_tui_gateway_server.py -k ws_orphan_reap -q
  • /Users/ljubomir/hermes-agent-macbook2/.venv/bin/python -m ruff check hermes_cli/web_server.py tests/hermes_cli/test_web_server.py tui_gateway/server.py
  • npm --workspace web run typecheck
  • npm --workspace web run build
  • npm --workspace web exec eslint -- src/pages/ChatPage.tsx completed with warnings only; no errors.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists labels Jun 16, 2026
@alt-glitch alt-glitch added the comp/dashboard Web dashboard / control panel UI (dashboard/, landing) label Jun 26, 2026
@teknium1

teknium1 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Closing this draft — the same keep-alive goal landed on main in #60515 (salvage of #50084): PTY parked across disconnects, reattach with ring-buffer replay, bounded reap. Thanks for working on it — credit noted in the salvage PR.

@teknium1 teknium1 closed this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants