Skip to content

feat(windows): enable dashboard chat tab via ConPTY (win_pty_bridge) - #39913

Closed
JoelJJohnson wants to merge 2 commits into
NousResearch:mainfrom
JoelJJohnson:feat/win-pty-bridge-pr
Closed

feat(windows): enable dashboard chat tab via ConPTY (win_pty_bridge)#39913
JoelJJohnson wants to merge 2 commits into
NousResearch:mainfrom
JoelJJohnson:feat/win-pty-bridge-pr

Conversation

@JoelJJohnson

Copy link
Copy Markdown
Contributor

Summary

  • Add hermes_cli/win_pty_bridge.py — a pywinpty-backed PTY bridge with the same spawn/read/write/resize/close surface as the existing POSIX PtyBridge
  • Patch the import block in hermes_cli/web_server.py so Windows picks WinPtyBridge instead of falling back to None
  • Remove the README note that said the dashboard chat pane requires WSL2

Problem

On native Windows, hermes dashboard's /chat tab showed a red banner:

Chat unavailable: the embedded terminal requires a POSIX PTY, which native Windows Python doesn't provide. Install Hermes inside WSL2 to use the dashboard's /chat tab.

PtyBridge was None on Windows because pty_bridge.py depends on fcntl/termios/ptyprocess, none of which exist on native Windows.

Solution

pywinpty is already a declared win32 dependency in pyproject.toml (pywinpty>=2.0.0,<3; sys_platform == 'win32') and is already used in tools/process_registry.py. This PR adds a thin wrapper around it with the same interface web_server already expects, and wires it in with a sys.platform branch in the import block — no changes to the WebSocket handler itself.

Key implementation notes:

  • read() runs inside run_in_executor (existing web_server design), so the blocking ConPTY poll never stalls the event loop
  • Spawn/read/write/terminate call shapes are taken directly from tools/process_registry.py which exercises the same pinned pywinpty version
  • setwinsize(rows, cols) is the one call not already exercised in the repo — resize was tested manually and reflows correctly
  • pywinpty decodes internally (returns str, not bytes), so a multibyte UTF-8 sequence split across reads may produce a replacement character; noted in code comment as the one fidelity tradeoff vs the POSIX raw-fd path

Test Plan

  • web_server.PtyBridge resolves to WinPtyBridge on win32, _PTY_BRIDGE_AVAILABLE = True
  • /api/pty WebSocket delivers live ANSI terminal output (Hermes TUI banner visible) — no WSL banner, no 1011 close code
  • Terminal resize tested manually — TUI reflows on browser window drag
  • POSIX path unchanged — existing pty_bridge.py still imported on Linux/macOS

JoelJJohnson and others added 2 commits June 5, 2026 15:53
Add hermes_cli/win_pty_bridge.py — a pywinpty-backed drop-in for
PtyBridge with the same spawn/read/write/resize/close surface — and
wire it into the web_server PTY import block so Windows picks it up
instead of falling back to None.

pywinpty is already a declared win32 dependency (pyproject.toml).
The ConPTY read path runs inside run_in_executor so the event loop
is never blocked. Spawn/read/write/terminate call shapes are taken
directly from tools/process_registry.py which already exercises the
same pywinpty version.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The chat pane now works on native Windows via the ConPTY bridge added
in the previous commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alt-glitch alt-glitch added type/feature New feature or request area/config Config system, migrations, profiles P3 Low — cosmetic, nice to have labels Jun 5, 2026
@teknium1

teknium1 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Hi @JoelJJohnson — taking this in as #42251 with your two commits cherry-picked intact (authorship preserved), rebased onto current main. Live-tested on native Windows 11 (pywinpty 2.0.15) end-to-end against hermes dashboard's /api/pty WebSocket: spawned hermes --tui (node entry.js) rendered through ConPTY, resize escapes reached setwinsize, WS close left zero orphaned processes. Added the missing test coverage you flagged, plus an AUTHOR_MAP entry so the release-note generator can resolve your plain email. Thanks for the design — the WinPtyBridge as a sibling-shape to PtyBridge was the right call.

Closing this once #42251 merges. Credit lives in commit trailers + AUTHOR_MAP.

@alt-glitch alt-glitch added comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows and removed area/config Config system, migrations, profiles labels Jun 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.
Related to #40022 (convergent same-shape PR) and superseded by the now-merged salvage #42251, which landed this win_pty_bridge.py + platform-branched web_server.py approach on main. Not marking duplicate (salvage relationship); flagging for closure consideration since the feature is already merged.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the ConPTY implementation. This is an automated hermes-sweeper review; the feature has already landed through the maintainer salvage referenced in the discussion, with contributor credit retained.

  • abcf996b1f749a647a1b213653a80d1eee58f6d1 merged PR feat(windows): enable dashboard /chat tab via ConPTY (win_pty_bridge) + tests #42251's Windows WinPtyBridge, platform-branched web_server.py import, README update, and dedicated tests.
  • Current hermes_cli/web_server.py:14179 imports WinPtyBridge as PtyBridge on native Windows.
  • Current tests/hermes_cli/test_web_server_pty_import.py:38 verifies the Windows bridge selection; tests/hermes_cli/test_win_pty_bridge.py covers the bridge behavior.
  • The merge is included in release v2026.6.19.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 14, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 14, 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) P3 Low — cosmetic, nice to have platform/windows Native Windows-specific behavior or breakage sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants