fix: enable dashboard PTY chat on native Windows - #40022
Conversation
Use the existing pywinpty/ConPTY path on win32 so the dashboard chat tab can spawn and manage terminal sessions without depending on POSIX PTY modules. Also update the PTY availability test import so it accepts either the Windows or POSIX bridge, depending on platform. (cherry picked from commit 3eccd018c1678fb9cd71a2c6809f9d9fae95ce89)
3eccd01 to
c5032b9
Compare
|
I checked the updated PR branch after rebasing the fix onto current |
|
Hi @Nea74 — your design converged on the same shape as #39913 (separate Closing this once #42251 merges. |
|
Thanks for the converging Windows implementation. This has already landed through the maintained salvage PR, with your contribution credited.
|
Use the existing pywinpty/ConPTY path on win32 so the dashboard chat tab can spawn and manage terminal sessions without depending on POSIX PTY modules.
Also update the PTY availability test import so it accepts either the Windows or POSIX bridge, depending on platform.
What does this PR do?
Previously, hermes_cli.web_server only attempted to import the POSIX PTY bridge, which depends on POSIX-only modules. On native Windows this caused the dashboard /api/pty path to be unavailable even though Hermes already has pywinpty support.
This PR:
adds a Windows PTY bridge implementation for the dashboard chat path
selects that bridge on win32
preserves the existing POSIX behavior on non-Windows platforms
updates the PTY availability test import so it works on either platform
Related Issue
Related issue: N/A
Type of Change
Changes Made
added hermes_cli/win_pty_bridge.py as a pywinpty/ConPTY-backed counterpart to PtyBridge
updated hermes_cli/web_server.py to:
use WinPtyBridge on Windows
keep using the existing POSIX PTY bridge on non-Windows platforms
preserve the existing stub/fallback behavior when the platform-specific import is genuinely unavailable
updated tests/hermes_cli/test_web_server.py so PtyUnavailableError is imported from the active bridge implementation depending on platform
How to Test
On native Windows:
Start Hermes dashboard.
Open the dashboard Chat tab.
Confirm that a terminal-backed chat session can start instead of failing due to PTY unavailability.
Verification used for this PR:
manual smoke test through WinPtyBridge.spawn(['cmd.exe', '/c', 'echo hello-from-conpty-main'])
verified that hermes_cli.web_server resolves PtyBridge to hermes_cli.win_pty_bridge.WinPtyBridge on Windows
ran targeted test:
uv run --with pytest --with pytest-xdist --with pyyaml python -m pytest tests/hermes_cli/test_web_server.py -k 'unavailable_platform_closes_with_message' -o addopts='' -q
Observed result:
1 skipped, 234 deselected
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs