fix(host-daemon): bump node-pty to 1.2.0-beta.15 to stop macOS pty fd leaks - #2675
Open
smsunarto wants to merge 3 commits into
Open
fix(host-daemon): bump node-pty to 1.2.0-beta.15 to stop macOS pty fd leaks#2675smsunarto wants to merge 3 commits into
smsunarto wants to merge 3 commits into
Conversation
node-pty 1.1.0's macOS posix_spawn path leaks one /dev/ptmx master fd per spawn (cleanup loop never closes low_fds[0]) plus the parent slave fd and a kqueue fd. The host daemon exhausted the 511-device pty pool. Upstream fixed all three in get-bb#882 and get-bb#931, shipped in 1.2.0-beta.15.
smsunarto
force-pushed
the
claude/node-pty-fd-leak
branch
from
August 29, 2026 01:13
6cf041c to
3352353
Compare
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.
Human comments
What was wrong
node-pty 1.1.0 leaks three file descriptors per spawned terminal on macOS:
pty_posix_spawn(for (; count > 0; count--)) never closeslow_fds[0]. One/dev/ptmxmaster leaks per spawn.SetupExitCallbackis never closed.The host daemon spawns a pty per terminal session, so a long-lived daemon drains the system-wide pool of 511 pty devices. On the machine that hit this, the daemon held 505 leaked masters after 22 hours. No app on the host, Ghostty included, could open a new terminal.
Upstream fixed all three leaks in microsoft/node-pty#882 and microsoft/node-pty#931.
What changed
node-pty1.1.0 → 1.2.0-beta.15 inapps/host-daemonandpackages/bb-app, plus the lockfile.apps/host-daemon/src/terminals/node-pty-fd-leak.test.tsspawns five ptys and asserts the/dev/ptmxfd count returns to baseline. CI's macOS 15 runners execute it.Why a beta: npm
latestis still 1.1.0, and the fixes exist only on the 1.2.0 line. VS Code ships this exact version in production (^1.2.0-beta.15inpackage.jsonandremote/package.json).The only typings change since 1.1.0 is an optional
pixelSizeargument onresize. Nothing on the wire changes, so noHOST_DAEMON_PROTOCOL_VERSIONbump.How you verified
expected 5 to be less than or equal to 0) and passes on 1.2.0-beta.15. The failing test is committed before the fix.pnpm exec turbo run test --filter=@bb/host-daemon: 561 passed. One pre-existing flake inhost-branches-dispatch.test.ts, passes standalone, unrelated.pnpm exec turbo run typecheck --filter=@bb/host-daemon --filter=bb-app: passes.