Native Windows support: pseudo-terminal layer on ConPTY #1

Merged
nelson merged 2 commits from TOAD-2-windows-pty into main 2026-11-09 17:13:43 -08:00
Owner

Work package: https://openproject.romaine.life/wp/TOAD-2

Toad now runs natively on Windows. Its three pseudo-terminal users (shell mode, agent terminals, the action pane) share one module, toad/pseudo_terminal.py, with the pty module on Linux and macOS and ConPTY (pywinpty) on Windows; the POSIX path keeps each caller's session setup as it was. The terminal now answers DA1 queries, which ConPTY waits about three seconds for, and terminal input no longer resets the shell's startup output hiding.

Checked on Windows in a throwaway tmux: launch, the Claude adapter connecting, shell commands with directory tracking, Ctrl+C interrupting a command, and the action pane and agent terminal exit codes. New tests cover the pseudo-terminal contract, and the new Tests workflow runs them on Linux and Windows.

Work package: https://openproject.romaine.life/wp/TOAD-2 Toad now runs natively on Windows. Its three pseudo-terminal users (shell mode, agent terminals, the action pane) share one module, `toad/pseudo_terminal.py`, with the `pty` module on Linux and macOS and ConPTY (pywinpty) on Windows; the POSIX path keeps each caller's session setup as it was. The terminal now answers DA1 queries, which ConPTY waits about three seconds for, and terminal input no longer resets the shell's startup output hiding. Checked on Windows in a throwaway tmux: launch, the Claude adapter connecting, shell commands with directory tracking, Ctrl+C interrupting a command, and the action pane and agent terminal exit codes. New tests cover the pseudo-terminal contract, and the new Tests workflow runs them on Linux and Windows.
Native Windows support: a pseudo-terminal layer on ConPTY (TOAD-2)
Some checks failed
Tests / Linux (pull_request) Failing after 49s
Tests / Windows (pull_request) Successful in 54s
17e0485191
Toad's shell, agent terminals and action pane each opened a POSIX pty
directly, so Toad failed to start on Windows. They now share
toad.pseudo_terminal: the pty module on Linux and macOS, ConPTY through
pywinpty on Windows.

On Windows: the default shell is pwsh with PSReadLine's editor removed,
so Toad's echo hiding works; Enter is CR; the shell reports its
directory in its own syntax; agent terminals run a program directly or
a command line through cmd; and spawning clears an inherited
ignore-Ctrl+C flag so Ctrl+C interrupts commands.

The terminal now answers DA1 queries. ConPTY sends one at startup and
holds output for about three seconds without an answer. Terminal input
no longer resets the shell's output hiding, which that answer did.

Adds tests for the pseudo-terminal contract and a Forgejo workflow
running them on Linux and Windows.
Treat EIO from a closed pty as end of output on Linux (TOAD-2)
All checks were successful
Tests / Linux (pull_request) Successful in 39s
Tests / Windows (pull_request) Successful in 46s
c7e14ed941
The pseudo-terminal's reader now ends with b'' on every platform, as its
docstring says; Linux failed the stream with EIO instead.
nelson merged commit e5d9606498 into main 2026-11-09 17:13:43 -08:00
nelson deleted branch TOAD-2-windows-pty 2026-11-09 17:13:44 -08:00
Sign in to join this conversation.
No reviewers
No labels
queue
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/toad!1
No description provided.