Repository navigation
Mark a VS Code pty-host child's terminals exited when its IPC channel closes before it exits - #1872
Open
dormouse-bot wants to merge 1 commit into
Open
dormouse-bot wants to merge 1 commit into
dormouse-bot wants to merge 1 commit into
Conversation
A send between the child's disconnect and its exit forked a replacement, so the old child's exit handler returned early and its PTYs stayed alive with no exit ever reported. ensureChild now retires a disconnected child before forking, through the same path its exit takes.
Deploying mouseterm with
|
| Latest commit: |
4cd630b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c96f13cc.mouseterm.pages.dev |
| Branch Preview URL: | https://fix-pty-host-disconnect-befo.mouseterm.pages.dev |
This was referenced Nov 21, 2026
This branch has not been deployed
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.
In the VS Code extension, a pty-host child that crashes can leave its terminals looking alive forever: no exit is reported,
getPtyStatussaysalive: true, and the panes never produce output again. This PR retires a child as soon asensureChildsees its IPC channel closed, through the same code itsexithandler runs, so every live PTY is marked exited and the webview hearsonExit.The race. Node emits
disconnectseparately fromexit, and the pty-host shuts itself down ondisconnect(pty-host.js).ensureChildtreated any child withconnected === falseas replaceable and forked a new one. If awrite,resize,getCwds, or anothersendToChildcall landed between the two events,childwas reassigned, and the old child'sexithandler then returned early onchild !== launchedChild. That skipped the retirementdocs/specs/vscode.mdrequires ("a pty-host child crash reports every live PTY exited and keeps its buffer").The fix. The retirement block moves into
retireChild, which theexithandler still calls and which now also runs inensureChildbefore a fork when the current child is disconnected. AfterwardsensureChildchecks again whether anonExitcallback already forked the replacement (the existing "keeps a replacement spawned synchronously by an exit callback alive" case), so it never forks two. A lateexitfrom the retired child is still ignored.Verification. The new test in
vscode-ext/test/pty-manager.test.tsdrops the fake child'sconnected, writes, then emitsexit. Before the fix it failed withalivestilltrue; it passes now, along with the rest of that file.tscis clean. Runningvitestlocally shows 90 failures inburrow,peer-link,peer-endpoint, andoutbound. Unmodifiedmainfails the same 90 tests in this sandbox, which can't open their sockets, so they're left to CI.