Repository navigation
fix(windows): respawn a ConPTY pane that started without keyboard input - #33423
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bundled ConPTY occasionally starts a pane whose console host never reads its input pipe: the shell prints its banner and prompt, but every keystroke and the typed launch command are dropped. Such a pane is identifiable from its first output, because a healthy one always queries DA1 before relaying anything else. The daemon now waits for that first output, respawns once when it is missing, and replays the buffered startup output so no byte is lost. The table stress probe now waits for node-pty's own readiness rather than typed input.
- Respawn only when no command rode in the shell's argv; otherwise keep the pane and say on screen that it cannot take input. - Accept the pane unverified after 5s of silence instead of stalling the spawn. - Distrust the check after two misses with no pane ever announcing, so a changed ConPTY build cannot respawn every pane. - Kill a discarded pane through its job before closing the pseudoconsole. - Report a cancel during the wait as an attach cancel, not a spawn failure. - Assert on real Windows ConPTY that a fresh pane announces its input reader.
… pane now - Treat user shell args like an argv startup command: never respawn, show the notice instead, so a command such as pwsh -Command never runs twice. - Close a discarded pane's pseudoconsole directly; node-pty defers kill() until first output, which a silent pane never produces. Kill the shell by pid when no job owns it. - Reconcile a master node-pty retired during the startup wait. - Drop the test-only respawn counter; the count rides in the daemon log.
…gent node-pty defers kill() until first output, so closing only the native pseudoconsole left the input pipe and output worker of a silent discarded pane alive until daemon exit. The agent's kill closes all three.
…ock prelude A pid-addressed kill could hit a recycled pid when the shell exited during startup; the job and the agent's native kill both act on handles. Lifecycle assertions now expect the replayed DA1 query when the suite runs on Windows.
nwparker
force-pushed
the
nwparker/conpty-input-readiness
branch
from
October 25, 2026 06:50
71cf8ec to
ec7896c
Compare
8 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Very rarely, on Windows, a brand-new terminal comes up looking normal: it shows its banner and prompt. But it ignores everything you type, and the command Orca types to launch an agent never runs. This happens because Windows' console host sometimes starts without the part that reads keyboard input. Orca can now tell when that has happened, before anything has been typed into the pane, and quietly starts the terminal again.
What Changed
Mechanism, at the one daemon choke point (
spawnNativeDaemonPty), Windows only:ESC [ c) right after it starts reading input, and before it relays any shell output.conpty-startup-input-reader.tsbuffers a fresh pane's output until the first bytes decide the question. A pane is judged dead only on positive evidence: shell output that arrives with no announcement.terminalShellArgssuch aspwsh -Commandorcmd /c. Respawning those could run the command twice.kill()waits for output that such a pane may never send, so going through the agent avoids leaking the console host, input pipe or output worker.Host-side only: there is no wire change, so mixed client and daemon versions are unaffected. This covers local Windows panes, WSL panes (
wsl.exeruns inside the same bundled ConPTY), and Windows SSH hosts, whose orcad runs the same daemon spawn path. macOS and Linux run exactly as before.Why
Evidence, gathered on
windows-2022CI:package (windows), job 121033873082) had two "prompt shown, input ignored" panes, both missing ConPTY's usual startup sequence. In repeated runs of the Windows boundary step, 2 of about 128 runs reproduced it. When the bad pane was waited on for another 45s and sent a second command, neither command ever ran.Alternatives considered:
Deciding before the spawn returns is the only point where nothing can have been typed yet, so a respawn can never repeat a launch.
Linked Issue
Linear STA-11968 (Windows boundary step flakes). Found from CI evidence, not a user report.
Visual Proof
N/A. There is no UI change in the normal case. The only new visible text is the rare red notice in a pane that failed twice.
Testing
Unit tests, with fake ConPTY panes in
native-pty-spawn-windows.test.ts:The first case fails on main.
Through
createPtySubprocess:terminalShellArgs(cmd /c deploy.cmd) with a dead pane are not respawned.Real Windows tests, in
windows-pty-job.win32.test.ts:Every test file that imports a changed module passes locally: the pty-subprocess suites and the Windows pty job tests.
repro-13767is an exception: it also fails on main on this macOS machine. The full static job also passes locally, with one exception: the process-host smoke needs Node 18, which this machine lacks, so CI covers it. The orcad terminal smoke passes.CI census on the fix: 16 Windows jobs × 4 boundary-suite iterations, against the PR's code. Each iteration also ran 300 launch commands through
spawnNativeDaemonPtyunder the suite's load, with respawn enabled.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
kill(), but only for a pane with output that nobody drained, which a silent pane does not have.Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)