Repository navigation
Replies: 1 comment
|
The change is up as #30880, so it can be judged on the code. Comments here or on the PR both work, and if the direction is wrong I'll close it. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
On Windows, typing
exitin a T3 terminal prints the shell's output at once, but the terminal only reportsexitedabout 1 s later. "Process exited" and the tab auto-close wait that second, as do the onboarding install terminal and the mobile terminal screen.The wait comes from node-pty's Windows agent. ConPTY keeps its output pipe open until the pseudoconsole is closed, so after the shell exits node-pty waits a fixed
FLUSH_DATA_INTERVALfor trailing output before it destroys the socket. That interval is 1000 ms. node-pty raised it from 20 ms in 2020 (e430d82e, part of the ConPTY close-deadlock fix for microsoft/node-pty#375) and hasn't revisited it since.Proposal: two changes to
lib/windowsPtyAgent.jsin T3's existingpatches/node-pty@1.2.0-beta.15.patch:FLUSH_DATA_INTERVALgoes from 1000 to 100 ms.setImmediateturn later, and only if no data event re-armed the timer in between.The second part is what makes the first safe. Node runs timers before the poll phase, so with only the constant lowered, a main-thread stall longer than the interval right after the exit callback lets the cleanup discard output that is already in the pipe. cmd's final line was lost in 20 of 20 runs once the stall reached the interval. The extra turn lets buffered data be read first, and each chunk re-arms the timer, so a stall costs only time.
Measured through the real terminal
ManagerandNodePtyAdapteron Windows 11 build 26200, Node 26.12.1, from typingexittoexited, n=10 alternating, median (min):src/terminalpasses, 105 tests including the new ones.Why I'm asking first:
exitedfires on Windows.exitwas sent, so those cells are inconclusive.The real fix is upstream in node-pty: microsoft/node-pty#990 and #991, both open, close the pseudoconsole on natural exit. They need native changes and new prebuilds, which T3 can't take through
patches/. If either lands, this patch should go.Is a patch-level fix like this acceptable until then? If so, I'll open a focused PR from
Pyseph:perf/windows-terminal-exit-flush: the patch file, its regenerated lockfile hash and the test.Written by Claude Opus 5.5 in T3 Code (Claude Code harness).
All reactions