Skip to content

fix: /dev/ptmx leak on macOS - #882

Merged
Robo (deepak1556) merged 3 commits into
mainfrom
robo/fix_ptmx_leak_macos
Jan 28, 2026
Merged

Robo (deepak1556) merged 3 commits into
mainfrom
robo/fix_ptmx_leak_macos

Conversation

@deepak1556

Copy link
Copy Markdown
Contributor

For microsoft/vscode#182212

The ptmx leak was from low_fds[0] that was always opened and never closed. Drive by improvement for error propagation and failure case cleanups.

@Tyriar Daniel Imms (Tyriar) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failing, unrelated?

@deepak1556
Robo (deepak1556) merged commit af053f2 into main Jan 28, 2026
9 checks passed
@deepak1556
Robo (deepak1556) deleted the robo/fix_ptmx_leak_macos branch January 28, 2026 21:28
Daniel Nyström (speakman) added a commit to speakman/happy that referenced this pull request Feb 10, 2026
node-pty v1.1.0 has an off-by-one bug in pty_posix_spawn() on macOS
where low_fds[0] (allocated via posix_openpt()) is never closed due
to a buggy cleanup loop (`count > 0` vs the correct `i <= count`).
This leaks 1 PTY master fd per pty.spawn() call, eventually exhausting
all 511 PTY pairs on macOS (kern.tty.ptmx_max).

Upstream fix: microsoft/node-pty#882 (merged 2026-01-28).

Also fixes the abort handler to kill the entire process group (-pid)
with SIGTERM instead of sending SIGHUP to just the launcher PID,
ensuring the Claude binary grandchild is also terminated.
tanzhenxin added a commit to QwenLM/qwen-code that referenced this pull request Mar 31, 2026
The previous version (1.1.0) has a native-level bug on macOS where each
PTY spawn leaks one /dev/ptmx file descriptor that is never closed. Over
a long session with hundreds of shell commands, this exhausts the
system-wide PTY pool (kern.tty.ptmx_max = 511), breaking other programs
like tmux and new terminal windows.

Root cause: microsoft/node-pty#882

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Josh Mabry (mabry1985) pushed a commit to protoLabsAI/protoCLI that referenced this pull request Apr 3, 2026
The previous version (1.1.0) has a native-level bug on macOS where each
PTY spawn leaks one /dev/ptmx file descriptor that is never closed. Over
a long session with hundreds of shell commands, this exhausts the
system-wide PTY pool (kern.tty.ptmx_max = 511), breaking other programs
like tmux and new terminal windows.

Root cause: microsoft/node-pty#882

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Josh Mabry (mabry1985) added a commit to protoLabsAI/protoCLI that referenced this pull request Apr 3, 2026
…up, follow-up suggestions (#19)

* fix: improve /compress split point selection for tool-heavy conversations

When conversation history is near the context window limit and dominated by
tool call/response cycles, findCompressSplitPoint would return a near-zero
split point because it only considered non-functionResponse user messages as
valid split points. This caused /compress to send almost no history to the
compression API (e.g. 29 tokens), producing a useless summary that inflated
token count instead of reducing it.

Changes:
- Track tool completion boundaries (positions after functionResponse) as
  fallback split points in findCompressSplitPoint
- Add user-with-functionResponse to the compress-everything safety check
- Use Math.max of primary and fallback split points for better coverage
- Add minimum content guard (5% threshold) to prevent futile API calls
- Add 4 new test cases covering tool-heavy conversation scenarios

Fixes #2647

* fix: handle orphaned funcCall and improve compression logic for tool-heavy conversations

- Strip trailing orphaned funcCall (force=true) before split point calculation,
  so normal compression logic runs cleanly on the remaining history instead of
  requiring ad-hoc special-casing
- Remove redundant lastToolCompletionSplitPoint machinery: after fixing the
  i+2 index bug, lastSplitPoint already subsumes it, making Math.max redundant
- Add MIN_COMPRESSION_FRACTION constant (0.05) to guard against futile API
  calls when historyToCompress is too small relative to total history
- Add tests for orphaned funcCall handling (force=true compresses, force=false NOOP)
- Add test for MIN_COMPRESSION_FRACTION guard

Fixes #2647

* fix: upgrade @lydell/node-pty to 1.2.0-beta.10 to fix PTY FD leak

The previous version (1.1.0) has a native-level bug on macOS where each
PTY spawn leaks one /dev/ptmx file descriptor that is never closed. Over
a long session with hundreds of shell commands, this exhausts the
system-wide PTY pool (kern.tty.ptmx_max = 511), breaking other programs
like tmux and new terminal windows.

Root cause: microsoft/node-pty#882

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): add kitty sequence timeout management and buffer handling improvements in KeypressProvider

* remove hooks experimental and refactor hook Config

* fix(hooks): clean up abort listener in error handler

The error handler in hookRunner cleared the timeout but did not remove
the abort signal listener, unlike the close handler. When spawn fails
(e.g. executable not found), only the error event fires — the close
event is not guaranteed — so the abort listener leaked on the signal.

* feat(extension): add npm registry support for extension installation

- Add new npm extension installation channel via scoped packages (@scope/name)
- Implement npm.ts module with registry resolution, authentication, and download logic
- Support version pinning, dist-tags (latest, beta), and custom registries
- Handle private registry auth via NPM_TOKEN env var and .npmrc _authToken entries
- Update CLI install command with --registry flag for npm extensions
- Add comprehensive tests for npm package parsing and registry operations
- Update documentation for releasing and installing from npm registries
- Integrate npm updates into extension manager and update checking flow

This enables teams using npm for package distribution to publish Qwen Code extensions through their existing infrastructure, with full support for private registries and access control.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* feat(mcp): add reconnect command and implement auto-reconnect logic

* refactor(mcp): enhance reconnect logic and error handling

* test(mcp): update tests to include verification of reconnect command registration

* feat(cli): add follow-up suggestions feature

* fix: post-backport build fixes

- Restore lsp field to CliArgs interface (removed by hooks cleanup cherry-pick)
- Add lsp: undefined to auth handler and gemini test fixtures
- Resolve client.ts conflict: keep both endTurnSpan and cache-safe param saving
- Fix speculationToolGate: ToolNames.TODO_WRITE → ToolNames.TASK_LIST
- mcp-tool: replace getStringifiedResultForDisplay with getDisplayFromParts,
  remove unused allowlist field and truncateTextParts method

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests): update tests for upstream backport changes

- ideCommand.test: remove install subcommand tests (no longer in ideCommand)
- constants.test: update DISPLAY_HOOK_EVENTS length from 12→15 (3 new hook events)
- Footer.test: mock VoiceMicButton to avoid UIActionsProvider dep, add voice
  state fields to mock UIState, update snapshots
- client.test: add getDisableAllHooks mock for hooks cleanup change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests): harden test assertions per code review

- constants.test: replace hardcoded count with Object.values(HookEventName).length
  so the test stays correct when the enum grows
- ideCommand.test: remove unused getIdeInstaller mock from vi.mock block

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests,core): resolve CI failures on upstream backport PR

- coreToolScheduler.test + nonInteractiveToolExecutor.test: add
  getDisableAllHooks mock to all mock configs (hooks cleanup change)
- mcp-tool.ts: restore output truncation via truncateParts helper using
  existing truncateToolOutput utility
- mcp-tool.ts: gate auto-reconnect on isConnectionError check so generic
  errors (Invalid parameters) don't trigger reconnect
- extension/npm.ts: fix CodeQL alerts — use replaceAll for '/' encoding
  in scoped package names

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(extension): harden npm download stream and fix slash encoding

- Add file.on('error') handler to write stream in downloadNpmTarball so
  stream errors during res.pipe() properly reject the Promise instead of
  hanging forever
- Fix name.replace('/', '%2f') → replaceAll in downloadFromNpmRegistry
  (line 285 was missed in previous commit; line 374 already correct)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: LaZzyMan <zeusdream7@gmail.com>
Co-authored-by: tanzhenxin <tanzhenxing1987@gmail.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: qqqys <qys177@gmail.com>
Co-authored-by: DennisYu07 <617072224@qq.com>
Co-authored-by: chinesepowered <nlai@rediffmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Josh Mabry (mabry1985) added a commit to protoLabsAI/protoCLI that referenced this pull request Apr 3, 2026
* fix: improve /compress split point selection for tool-heavy conversations

When conversation history is near the context window limit and dominated by
tool call/response cycles, findCompressSplitPoint would return a near-zero
split point because it only considered non-functionResponse user messages as
valid split points. This caused /compress to send almost no history to the
compression API (e.g. 29 tokens), producing a useless summary that inflated
token count instead of reducing it.

Changes:
- Track tool completion boundaries (positions after functionResponse) as
  fallback split points in findCompressSplitPoint
- Add user-with-functionResponse to the compress-everything safety check
- Use Math.max of primary and fallback split points for better coverage
- Add minimum content guard (5% threshold) to prevent futile API calls
- Add 4 new test cases covering tool-heavy conversation scenarios

Fixes #2647

* fix: handle orphaned funcCall and improve compression logic for tool-heavy conversations

- Strip trailing orphaned funcCall (force=true) before split point calculation,
  so normal compression logic runs cleanly on the remaining history instead of
  requiring ad-hoc special-casing
- Remove redundant lastToolCompletionSplitPoint machinery: after fixing the
  i+2 index bug, lastSplitPoint already subsumes it, making Math.max redundant
- Add MIN_COMPRESSION_FRACTION constant (0.05) to guard against futile API
  calls when historyToCompress is too small relative to total history
- Add tests for orphaned funcCall handling (force=true compresses, force=false NOOP)
- Add test for MIN_COMPRESSION_FRACTION guard

Fixes #2647

* fix: upgrade @lydell/node-pty to 1.2.0-beta.10 to fix PTY FD leak

The previous version (1.1.0) has a native-level bug on macOS where each
PTY spawn leaks one /dev/ptmx file descriptor that is never closed. Over
a long session with hundreds of shell commands, this exhausts the
system-wide PTY pool (kern.tty.ptmx_max = 511), breaking other programs
like tmux and new terminal windows.

Root cause: microsoft/node-pty#882

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): add kitty sequence timeout management and buffer handling improvements in KeypressProvider

* remove hooks experimental and refactor hook Config

* fix(hooks): clean up abort listener in error handler

The error handler in hookRunner cleared the timeout but did not remove
the abort signal listener, unlike the close handler. When spawn fails
(e.g. executable not found), only the error event fires — the close
event is not guaranteed — so the abort listener leaked on the signal.

* feat(extension): add npm registry support for extension installation

- Add new npm extension installation channel via scoped packages (@scope/name)
- Implement npm.ts module with registry resolution, authentication, and download logic
- Support version pinning, dist-tags (latest, beta), and custom registries
- Handle private registry auth via NPM_TOKEN env var and .npmrc _authToken entries
- Update CLI install command with --registry flag for npm extensions
- Add comprehensive tests for npm package parsing and registry operations
- Update documentation for releasing and installing from npm registries
- Integrate npm updates into extension manager and update checking flow

This enables teams using npm for package distribution to publish Qwen Code extensions through their existing infrastructure, with full support for private registries and access control.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* feat(mcp): add reconnect command and implement auto-reconnect logic

* refactor(mcp): enhance reconnect logic and error handling

* test(mcp): update tests to include verification of reconnect command registration

* feat(cli): add follow-up suggestions feature

* fix: post-backport build fixes

- Restore lsp field to CliArgs interface (removed by hooks cleanup cherry-pick)
- Add lsp: undefined to auth handler and gemini test fixtures
- Resolve client.ts conflict: keep both endTurnSpan and cache-safe param saving
- Fix speculationToolGate: ToolNames.TODO_WRITE → ToolNames.TASK_LIST
- mcp-tool: replace getStringifiedResultForDisplay with getDisplayFromParts,
  remove unused allowlist field and truncateTextParts method

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests): update tests for upstream backport changes

- ideCommand.test: remove install subcommand tests (no longer in ideCommand)
- constants.test: update DISPLAY_HOOK_EVENTS length from 12→15 (3 new hook events)
- Footer.test: mock VoiceMicButton to avoid UIActionsProvider dep, add voice
  state fields to mock UIState, update snapshots
- client.test: add getDisableAllHooks mock for hooks cleanup change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests): harden test assertions per code review

- constants.test: replace hardcoded count with Object.values(HookEventName).length
  so the test stays correct when the enum grows
- ideCommand.test: remove unused getIdeInstaller mock from vi.mock block

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests,core): resolve CI failures on upstream backport PR

- coreToolScheduler.test + nonInteractiveToolExecutor.test: add
  getDisableAllHooks mock to all mock configs (hooks cleanup change)
- mcp-tool.ts: restore output truncation via truncateParts helper using
  existing truncateToolOutput utility
- mcp-tool.ts: gate auto-reconnect on isConnectionError check so generic
  errors (Invalid parameters) don't trigger reconnect
- extension/npm.ts: fix CodeQL alerts — use replaceAll for '/' encoding
  in scoped package names

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(extension): harden npm download stream and fix slash encoding

- Add file.on('error') handler to write stream in downloadNpmTarball so
  stream errors during res.pipe() properly reject the Promise instead of
  hanging forever
- Fix name.replace('/', '%2f') → replaceAll in downloadFromNpmRegistry
  (line 285 was missed in previous commit; line 374 already correct)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: remove IDE integration section, add voice integration setup

IDE integration is no longer supported. Voice integration section covers:
- audio backend requirements (sox/arecord) per OS
- protoLabs hosted STT endpoint option
- self-hosted faster-whisper-server option
- settings.json config and /voice commands

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: remove hosted STT endpoint reference

No protoLabs-hosted voice service — self-hosted only.
Also removes the unused HOSTED_STT_ENDPOINT export.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(core): cascade context file loading — first match per location wins

Instead of loading all context files found (PROTO.md + AGENTS.md + QWEN.md +
CLAUDE.md) at every directory in the walk, now stops at the first filename
found per location. Global (~/.proto/, ~/.claude/) and each workspace directory
independently cascade through the priority list: PROTO.md > AGENTS.md > QWEN.md
> CLAUDE.md. Prevents context flooding when multiple compat aliases co-exist.

Also updates repository/homepage metadata to protoLabsAI/protoCLI and
protolabs.sh across root, cli, and sdk-typescript package.json files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: LaZzyMan <zeusdream7@gmail.com>
Co-authored-by: tanzhenxin <tanzhenxing1987@gmail.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: qqqys <qys177@gmail.com>
Co-authored-by: DennisYu07 <617072224@qq.com>
Co-authored-by: chinesepowered <nlai@rediffmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Automaker <automaker@localhost>
xaelistic pushed a commit to xaelistic/qwen-code that referenced this pull request Jun 7, 2026
The previous version (1.1.0) has a native-level bug on macOS where each
PTY spawn leaks one /dev/ptmx file descriptor that is never closed. Over
a long session with hundreds of shell commands, this exhausts the
system-wide PTY pool (kern.tty.ptmx_max = 511), breaking other programs
like tmux and new terminal windows.

Root cause: microsoft/node-pty#882

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
정수현 (sasha1107) added a commit to sasha1107/superset that referenced this pull request Jul 20, 2026
node-pty 1.1.0's macOS pty_posix_spawn leaks one /dev/ptmx master fd on
every spawn: the low-fd workaround probes posix_openpt into low_fds, but
the cleanup loop ('for (; count > 0; count--)') never closes low_fds[0]
— and in practice the first probe always lands at fd >= 3, so nothing is
ever closed.

Each leaked master counts against the system-wide pty cap
(kern.tty.ptmx_max = 511 on macOS). A field machine showed a 28-day-old
pty-daemon holding 509 pty fds while tracking only 20 live sessions; at
the cap, PTY allocation fails machine-wide — Superset toasts 'Failed to
run preset', terminal spawns die with 'posix_spawnp failed. (errno=ok)',
and every other terminal app breaks too, until reboot (superset-sh#5699).

Fixed upstream in microsoft/node-pty#882, which is unreleased (1.1.0 is
still latest stable; the fix only exists in 1.2.0 betas). Backport the
fd hygiene as a bun patch: close all low_fds probes and the parent's
slave copy after posix_spawn.

Regression tests count the process's open pty fds across spawn/exit
cycles (mirroring upstream's superset-sh#882 test); they run with the node-based
integration suite. Verified end-to-end: an unpatched daemon leaks +1
ptmx per session (15/15 across clean-exit, background-child, and held-
tty scenarios); the patched build leaks 0 and the full pty-daemon
integration suite (52 tests) passes.

Fixes superset-sh#5699
정수현 (sasha1107) added a commit to sasha1107/superset that referenced this pull request Jul 21, 2026
node-pty 1.1.0's macOS pty_posix_spawn leaks one /dev/ptmx master fd on
every spawn: the low-fd workaround probes posix_openpt into low_fds, but
the cleanup loop ('for (; count > 0; count--)') never closes low_fds[0]
— and in practice the first probe always lands at fd >= 3, so nothing is
ever closed.

Each leaked master counts against the system-wide pty cap
(kern.tty.ptmx_max = 511 on macOS). A field machine showed a 28-day-old
pty-daemon holding 509 pty fds while tracking only 20 live sessions; at
the cap, PTY allocation fails machine-wide — Superset toasts 'Failed to
run preset', terminal spawns die with 'posix_spawnp failed. (errno=ok)',
and every other terminal app breaks too, until reboot (superset-sh#5699).

Fixed upstream in microsoft/node-pty#882, which is unreleased (1.1.0 is
still latest stable; the fix only exists in 1.2.0 betas). Backport the
fd hygiene as a bun patch: close all low_fds probes and the parent's
slave copy after posix_spawn.

Regression tests count the process's open pty fds across spawn/exit
cycles (mirroring upstream's superset-sh#882 test); they run with the node-based
integration suite. Verified end-to-end: an unpatched daemon leaks +1
ptmx per session (15/15 across clean-exit, background-child, and held-
tty scenarios); the patched build leaks 0 and the full pty-daemon
integration suite (52 tests) passes.

Fixes superset-sh#5699
Sawyer Hood (SawyerHood) pushed a commit to get-bb/bb that referenced this pull request Aug 31, 2026
… leaks (#2675)

## Human comments

## What was wrong

node-pty 1.1.0 leaks three file descriptors per spawned terminal on
macOS:

- The cleanup loop in `pty_posix_spawn` (`for (; count > 0; count--)`)
never closes `low_fds[0]`. One `/dev/ptmx` master leaks per spawn.
- The parent's copy of the slave fd is never closed.
- The kqueue opened by `SetupExitCallback` is 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-pty` 1.1.0 → 1.2.0-beta.15 in `apps/host-daemon` and
`packages/bb-app`, plus the lockfile.
- New darwin-only regression test:
`apps/host-daemon/src/terminals/node-pty-fd-leak.test.ts` spawns five
ptys and asserts the `/dev/ptmx` fd count returns to baseline. CI's
macOS 15 runners execute it.

Why a beta: npm `latest` is 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.15` in `package.json` and `remote/package.json`).

The only typings change since 1.1.0 is an optional `pixelSize` argument
on `resize`. Nothing on the wire changes, so no
`HOST_DAEMON_PROTOCOL_VERSION` bump.

## How you verified

- The new test fails on 1.1.0 (`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.
- A standalone 25-spawn repro leaks 25 masters on 1.1.0 and zero on the
beta.
- `pnpm exec turbo run test --filter=@bb/host-daemon`: 561 passed. One
pre-existing flake in `host-branches-dispatch.test.ts`, passes
standalone, unrelated.
- `pnpm exec turbo run typecheck --filter=@bb/host-daemon
--filter=bb-app`: passes.

> AGENT GENERATED
Northern Man (NorthernMan54) added a commit to homebridge/node-pty-prebuilt-multiarch that referenced this pull request Aug 31, 2026
* chore: use node 20 and fix build (microsoft#730)

* chore: use node 20 and fix build

* chore: bump macOS deployment target

* spec: reduce flakyness

* Revert "chore: bump macOS deployment target"

This reverts commit d9d18b3.

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* chore: add new publish pipeline (microsoft#727)

Also allows the CI pipeline to use the Unofficial template

* fix: ensure proper cleanup of console process on shutdown

* fix: publish pipeline broken APIScan task (microsoft#756)

* chore: improve cleanup with useConptyDll mode

* chore: update tests

* chore: auto-publish beta versions (microsoft#757)

* chore: work around blocked release integration (microsoft#758)

* Update to conpty v1.22 (microsoft#759)

* Update to conpty v1.22

Fixes microsoft#490

* Add logs to show the problem happening

* spec: increase exit delay

* refactor: input and output handling with conpty

* Close the input read and output write handles after creating
  the client process
* Call ReleasePseudoConsole after creating the client process
  which will cause the output read handle to close when there
  is no more data from the session
* For manual termination via Kill, we close the input write handle
  and call into ClosePseudoConsole, we should then drain the output
  handle

NB: ideally draining the output handle should have been enough
to cause the client process to close but it doesn't work, we call
TerminateProcess to fix this case.

* chore: restore legacy conpty path

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>

* chore: remove old publishing stage (microsoft#761)

* fix: restore conpty non-dll path (microsoft#766)

* chore: add BinSkim flags to winpty (microsoft#767)

* chore: add BinSkim flags to winpty

* Apply PR feedback

* conpty@1.22.250204002

* Change buffer size to 128KiB

Fixes microsoft#765

* chore: match trigger with perf-bot's (microsoft#773)

* chore: match exclude with latest conpty (microsoft#774)

* chore: use folder wildcard (microsoft#775)

* Revert "conpty@1.22.250204002"

This reverts commit 247ae7d.

* fix: gate conpty-exclusive call behind conpty check (microsoft#778)

* Remove package-lock=false from .npmrc

Missed this when migrating from yarn

* Update brace-expansion

* Remove npmrc

unsafe perm doesn't seem to be needed

* chore: create GitHub Actions workflow (microsoft#796)

* chore: split compile commands to separate task (microsoft#801)

* chore: lock node-gyp used for compile commands (microsoft#802)

* feat: scaffolding for prebuilt files (microsoft#803)

* feat: add prebuilds to published package (microsoft#804)

* fix: add missing lines

* Fix job names

* Use Ubuntu for linux_arm64

* Add combining archive stage for prebuilds

* Ref artifact from publish script

* Add check for npm_config_build_from_source

* simplify

* chore: exclude Linux prebuilds (microsoft#805)

* chore: fix publish pipeline parameters again (microsoft#806)

* chore: fix mismatch between shell and command (microsoft#807)

* Load native addons directly from prebuilds directory (microsoft#809)

* Load native addons directly from prebuilds directory

* feat: remove prebuilds when npm_config_build_from_source is set

* feat: change the load order to local builds and unbundled first

* chore: skip copying prebuilds to build dir

* Update conpty to 1.23.251008001

Part of microsoft/vscode#224488

* Support Buffer in write API

Part of microsoft/vscode#269213

* chore: exclude unscannable binaries

* chore: update SDL flags (microsoft#815)

* Add OpenBSD includes for termios and util

Fix build for OpenBSD

* add "Enjoy Git" Real-world Uses

* chore: add D_FORTIFY_SOURCE flag (microsoft#820)

* chore: re-enable 4244, 4267

* chore: npm audit fix

* Remove excess quotes (microsoft#823)

* chore: use UseNode (microsoft#824)

* feat: support to build with mingw-w64 in windows

* Use standard -lshlwapi in binding.gyp so gyp/node-gyp can handle
linking for both mingw-w64 and MSVC, enabling builds with mingw-w64.

Signed-off-by: Zhou Qiankang <wszqkzqk@qq.com>

* fix: delete all prebuilds if not using any (microsoft#829)

* chore: remove ADO CI (microsoft#826)

* fix: do not delete for mismatch (microsoft#830)

* Speculative fix for stream backpressure

Part of microsoft/vscode#283056
Part of microsoft/vscode#246204

* Add additional change needed to fix it

* Use raw write stream, handle partial writes/kernel backpressure

* Remove unneeded write stream

* Remove unwanted logs

* Tidy up comments

* Add setting of encoding on the read socket back

* Move props to top

* Use os.constants.errno

* Revert "Use os.constants.errno"

This reverts commit 6bb38cc.

errno.EAGAIN is coming through as 35 (positive) on macOS, not -35.

* Ensure partial writes are handled on EAGAIN

Following up on microsoft#831

* Fix string slicing for fs.write

* Bring comments and timeouts back (for now)

* Remove use of any

* Remove timeouts and update details in comments

Fixes microsoft#833

* Encapsulate write queue in separate class

Fixes microsoft#838

* Add default watch task

* Avoid excessive listeners on data and other events

Fixes microsoft#215

* Bump v1.1

* Add contributing file

Fixes microsoft#836

* Update electron example

- Get working on Windows by moving node-pty into main proc
- Fix eslint warnings

Fixes microsoft#821

* chore(deps): bump electron from 33.4.11 to 35.7.5 in /examples/electron

Bumps [electron](https://github.com/electron/electron) from 33.4.11 to 35.7.5.
- [Release notes](https://github.com/electron/electron/releases)
- [Commits](electron/electron@v33.4.11...v35.7.5)

---
updated-dependencies:
- dependency-name: electron
  dependency-version: 35.7.5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update electron example to xterm 6

* Point at local node-pty

* Update contributing

* Remove node-pty dep

* Pass error details in apple spawn exception

Part of microsoft#845

* Add sysroot to compile Linux prebuilds against glibc 2.28 (microsoft#853)

* Add sysroot to compile Linux prebuilds against glibc 2.28

Fixes microsoft#851

* Add CI check for glibc version

* Fix linker flags to include sysroot library paths

* Revert package-lock change

* Ensure 755 permissions on prebuild spawn-helper

Fixes microsoft#850

* Pin Python 3.12

* Set compiler on mac too

* Fix linux arm compiling and add CI for cross-compiled builds (microsoft#857)

* Remove duplicate slash

* Run CI on cross-arch builds

* Install cross-arch compiler

* Install cross-arch compiler for azure pipeline

* chore: enable warning 4146 (microsoft#861)

* chore: elevate warnings to errors (microsoft#862)

Exclude winpty from this process because it is legacy code.

* fix: ensure spawn-helper is executable for macos prebuilds

Fixes microsoft#850

* fix: Use authenticated download for sysroot to avoid rate limiting

* fix: add parsing to reduce flakiness on macOS

* chore: set -e to make failure point clear

* chore: direct debug logs to stderr

* chore: add log for token use in downloading sysroot

* Revert "Ensure 755 permissions on prebuild spawn-helper"

This reverts commit d08cd36.

* fix: close inherited file descriptors in child process on Linux

Prevents leaking file descriptors (pty master FDs, sockets, etc.) to
child processes spawned via forkpty(). Uses close_range() syscall on
Linux 5.9+, falling back to /proc/self/fd iteration, then brute force.

macOS already handles this via POSIX_SPAWN_CLOEXEC_DEFAULT flag.

Fixes microsoft#657
Part of microsoft/vscode#58814

* chore: update Actions CI to use native runners instead of cross-compilation (microsoft#865)

* chore: update Actions CI to use native runners instead of cross-compilation

* Remove cross-compiler installation for linux-arm

* chore: move lint to a separate job

* Skip compiling native addon for lint job

Co-authored-by: Simon Lydell <simon.lydell@gmail.com>

* ci: switch to using native objdump in verify-glibc script

---------

Co-authored-by: Simon Lydell <simon.lydell@gmail.com>

* Remove support for winpty

* Remove winpty.cc , references in native.d.ts

* Remove winpty from windowsPtyAgent.ts

* Remove useConpty as that's default now

* index.js, post-install.js, spam-close.js

* README.md winpty support removed note

* Remove dep\winpty

* Remove useConpty from test.ts since we got rid of it

* See if import were problem for pty.node (old winpty binding)

* More conditional unixTerminal file import

* See if unixTerminal as UnixTerminalType would help

* Stop messing with UnixTerminal camelCase

* We dont want to fall back to winpty

* Update src/unix/pty.cc

Co-authored-by: Robo <hop2deep@gmail.com>

* Update src/unix/pty.cc

Co-authored-by: Robo <hop2deep@gmail.com>

* Polish

* Add SetCloseOnExec

* chore: remove fortify-source flag

* chore: polish prebuilds pipeline

* chore: add explicit include

* Scrap explicit include in case of gyp or other changes

* chore: force commit hashes to match

* Update src/win/conpty.cc

Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>

* Update src/win/conpty.cc

Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>

* Only add back interface of useConpty + deprecation message

* Update typings/node-pty.d.ts

Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>

* Delete emulation in winpty is deprecated

* See if we can remove conditional check for UnixTerminal

* Try doing the conditional import again on UnixTerminal.test.ts

* Trigger CI rebuild

* Update UnixTerminal import comments and check constraint

* UnixTerminalType

* Fix promise handling in poll functions to avoid test timeout

* Fix Unix test: setTimeout await bug and add proper timeout

* try only keepign catch done()

* Fix CLOSE_RANGE_CLOEXEC build error on Alpine (microsoft#873)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com>

* Exclude unnecessary files from npm package

* chore(deps-dev): bump tar from 7.4.4 to 7.5.3

Bumps [tar](https://github.com/isaacs/node-tar) from 7.4.4 to 7.5.3.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v7.4.4...v7.5.3)

---
updated-dependencies:
- dependency-name: tar
  dependency-version: 7.5.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore(deps-dev): bump tar from 7.5.3 to 7.5.6 (microsoft#878)

Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.3 to 7.5.6.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v7.5.3...v7.5.6)

---
updated-dependencies:
- dependency-name: tar
  dependency-version: 7.5.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump lodash from 4.17.21 to 4.17.23 (microsoft#879)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to 4.17.23.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.21...4.17.23)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.17.23
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: add stack-protector-strong flag (microsoft#880)

* Add pixel size support to resize()

* Align naming in native.d.ts to pixel_width, height

* Better explain pixelSize in interfaces.ts and node-pty.d.ts

* fix: /dev/ptmx leak on macOS (microsoft#882)

* fix: /dev/ptmx leak on macOS

* fix: flaky test

* fix: ignore spawn_helper in process title getter

* chore(deps-dev): bump tar from 7.5.6 to 7.5.7

Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.6 to 7.5.7.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v7.5.6...v7.5.7)

---
updated-dependencies:
- dependency-name: tar
  dependency-version: 7.5.7
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: avoid blocking Node.js event loop in ConnectNamedPipe on Windows

Fixes microsoft#763

The issue was that conptyNative.connect() called ConnectNamedPipe()
synchronously for both input and output pipes. While the input pipe
was connected via fs.openSync() before the call, the output pipe
connection happened asynchronously in a worker thread.

If the worker thread hadn't connected yet when ConnectNamedPipe was
called, it would block the Node.js event loop waiting for the connection.
This caused a deadlock when a debugger was attached (which slows down
the event loop and worker thread startup).

The fix defers the conptyNative.connect() call until the worker thread
signals it has connected to the output pipe (via the onReady callback).
This ensures both pipes have clients connected before ConnectNamedPipe
is called, so it returns immediately without blocking.

* test: add regression tests for deferred connection fix (microsoft#763)

* Update README.md

* test: add non-blocking event loop verification test (microsoft#763)

* fix: add timeout fallback for worker connection (microsoft#763)

If the worker fails to signal ready within 5 seconds, complete the
connection anyway to avoid leaving the PTY in a zombie state.

* fix: prevent deferred connection after kill() (microsoft#763)

Clear _pendingPtyInfo in kill() to prevent the timeout or onReady
callback from calling connect() on an already-killed PTY handle.

* fix: update pid after agent connection completes (microsoft#763)

The public pid property was only set once at construction, before the
deferred connection. Update it in the ready_datapipe handler so users
get the correct pid value.

* test: verify pid is set after ready_datapipe (microsoft#763)

Add test to ensure WindowsTerminal.pid is correctly updated after the
deferred connection completes. This closes the test coverage gap for
the public pid property.

* Don't get process list on kill if not yet connected

* Make lint happy

* Prevent OOM in test

* chore(deps-dev): bump tar from 7.5.7 to 7.5.9 (microsoft#888)

Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.7 to 7.5.9.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v7.5.7...v7.5.9)

---
updated-dependencies:
- dependency-name: tar
  dependency-version: 7.5.9
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump minimatch (microsoft#889)

Bumps  and [minimatch](https://github.com/isaacs/minimatch). These dependencies needed to be updated together.

Updates `minimatch` from 3.1.2 to 3.1.5
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](isaacs/minimatch@v3.1.2...v3.1.5)

Updates `minimatch` from 5.1.6 to 5.1.9
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](isaacs/minimatch@v3.1.2...v3.1.5)

Updates `minimatch` from 9.0.5 to 9.0.9
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](isaacs/minimatch@v3.1.2...v3.1.5)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 3.1.5
  dependency-type: indirect
- dependency-name: minimatch
  dependency-version: 5.1.9
  dependency-type: indirect
- dependency-name: minimatch
  dependency-version: 9.0.9
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump tar from 7.5.9 to 7.5.11 (microsoft#896)

Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.9 to 7.5.11.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v7.5.9...v7.5.11)

---
updated-dependencies:
- dependency-name: tar
  dependency-version: 7.5.11
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix typo in documentation comment

* release conpty 1.25

* Fix publishing pipeline to download prebuilds from current branch (microsoft#899)

* Initial plan

* Fix publishing pipeline to use current branch for prebuild artifact lookup

Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com>

* chore(deps): bump picomatch (microsoft#903)

Bumps  and [picomatch](https://github.com/micromatch/picomatch). These dependencies needed to be updated together.

Updates `picomatch` from 2.3.1 to 2.3.2
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.3.1...2.3.2)

Updates `picomatch` from 4.0.3 to 4.0.4
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
- dependency-name: picomatch
  dependency-version: 4.0.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: migrate to ESLint 9 with flat config (microsoft#895)

* Initial plan

* chore: migrate to ESLint 9 with flat config and typescript-eslint v8

Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com>

* chore: bump flatted from 3.4.1 to 3.4.2 (microsoft#906)

Agent-Logs-Url: https://github.com/microsoft/node-pty/sessions/8da1ccd3-6de6-45a5-a9e8-e84269e612d3

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com>

* chore(deps-dev): bump brace-expansion from 1.1.12 to 1.1.13 (microsoft#908)

Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 1.1.12 to 1.1.13.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](juliangruber/brace-expansion@v1.1.12...v1.1.13)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 1.1.13
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump diff from 5.2.0 to 5.2.2 (microsoft#909)

Bumps [diff](https://github.com/kpdecker/jsdiff) from 5.2.0 to 5.2.2.
- [Changelog](https://github.com/kpdecker/jsdiff/blob/master/release-notes.md)
- [Commits](kpdecker/jsdiff@v5.2.0...v5.2.2)

---
updated-dependencies:
- dependency-name: diff
  dependency-version: 5.2.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump electron from 35.7.5 to 39.8.4 in /examples/electron (microsoft#910)

Bumps [electron](https://github.com/electron/electron) from 35.7.5 to 39.8.4.
- [Release notes](https://github.com/electron/electron/releases)
- [Commits](electron/electron@v35.7.5...v39.8.4)

---
updated-dependencies:
- dependency-name: electron
  dependency-version: 39.8.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump electron from 39.8.4 to 39.8.5 in /examples/electron (microsoft#911)

Bumps [electron](https://github.com/electron/electron) from 39.8.4 to 39.8.5.
- [Release notes](https://github.com/electron/electron/releases)
- [Commits](electron/electron@v39.8.4...v39.8.5)

---
updated-dependencies:
- dependency-name: electron
  dependency-version: 39.8.5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump ip-address from 10.0.1 to 10.2.0 (microsoft#920)

Bumps [ip-address](https://github.com/beaugunderson/ip-address) from 10.0.1 to 10.2.0.
- [Commits](https://github.com/beaugunderson/ip-address/commits)

---
updated-dependencies:
- dependency-name: ip-address
  dependency-version: 10.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(win): use-after-free from unsynchronized access to ptyhandles (microsoft#922)

The windows backend keeps a global vector of  `ptyHandles`.
Since the cleanup of the baton was moved into the per-pty watcher thread
(commit 17062cd):

- The watcher thread called `remove_pty_baton` without
  any lock, racing with other watchers and with JS-thread reads.
- `emplace_back` in `startProcess` could reallocate the vector while
  another thread was iterating it.

* chore(deps-dev): bump brace-expansion from 5.0.5 to 5.0.6 (microsoft#925)

Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 5.0.5 to 5.0.6.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](juliangruber/brace-expansion@v5.0.5...v5.0.6)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 5.0.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Upgrade Electron example dependency to 42.2.0 (microsoft#928)

* Initial plan

* chore(examples/electron): update electron to 42.2.0

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Migrate linting to ESLint 10.4.0 (microsoft#927)

* Initial plan

* chore: bump eslint to 10.4.0

* chore: declare globals for eslint config

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* fix: close kqueue fd in SetupExitCallback on macOS (microsoft#931)

SetupExitCallback opens a kqueue() per spawned pty to wait on
NOTE_EXIT, but never closes it before the watcher thread returns,
leaking one kqueue fd per pty.spawn() for the host process lifetime.

The Chromium kill_mac.cc this is based on closes the kqueue via
ScopedFD; the equivalent here is an explicit close(kq) once the
kevent wait completes.

* chore(deps): bump undici from 7.27.0 to 7.28.0 in /examples/electron (microsoft#930)

Bumps [undici](https://github.com/nodejs/undici) from 7.27.0 to 7.28.0.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v7.27.0...v7.28.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 7.28.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump js-yaml from 4.1.1 to 4.2.0 (microsoft#933)

Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.1 to 4.2.0.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](nodeca/js-yaml@4.1.1...4.2.0)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump tar from 7.5.11 to 7.5.16 (microsoft#932)

Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.11 to 7.5.16.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v7.5.11...v7.5.16)

---
updated-dependencies:
- dependency-name: tar
  dependency-version: 7.5.16
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: close pipe handles and free attribute list when conpty spawn fails (microsoft#935)

* fix: surface CreateProcessW failures as 'exit' instead of uncaughtException on Windows (microsoft#934)

* chore: onboard to ADO feed (microsoft#936)

* chore: onboard to ADO feed

* Fix relative path

* chore(deps-dev): bump tar from 7.5.16 to 7.5.22 (microsoft#941)

Bumps [tar](https://github.com/isaacs/node-tar) from 7.5.16 to 7.5.22.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v7.5.16...v7.5.22)

---
updated-dependencies:
- dependency-name: tar
  dependency-version: 7.5.22
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* windows: avoid conPTY deadlock when debugger pauses conout worker (microsoft#943)

The conPTY output connection is established on a worker thread before the
main Node.js thread calls the native connect implementation. Calling
conptyNative.connect() before that worker reports readiness is unsafe because
the native implementation synchronously calls ConnectNamedPipe() for the
input and output pipes.

ETW stacks from the frozen Code - OSS agent host showed:

  agentHostTerminalManager._spawnPty
    -> node-pty.spawn
    -> WindowsTerminal
    -> WindowsPtyAgent
    -> ConoutConnection
    -> Worker

The conout worker was stopped in the Node inspector startup message loop while
processing Debugger.enable. Five seconds later, the agent-host event loop
thread entered the WindowsPtyAgent timeout fallback and proceeded through
conptyNative.connect() into NtFsControlFile/ConnectNamedPipe. Since the paused
worker had not connected the output side, ConnectNamedPipe waited
synchronously and blocked the event loop. Consequently, CDP's Runtime.enable
request could not complete and the debugger attachment appeared frozen.

The worker-ready handshake was originally introduced to prevent this
deadlock, but a later timeout fallback called connect() anyway to avoid
leaving the PTY in a zombie state. That fallback violated the handshake
invariant and restored the blocking path under debugger induced worker
delays.

Make worker readiness a hard prerequisite for calling connect():

- Fail and clean up the pending PTY when the readiness watchdog expires
  instead of attempting the native connection.
- Propagate worker startup errors and premature exits to WindowsPtyAgent.
- Kill the pending native PTY, dispose the worker, destroy its sockets, and
  report the failure through onError.
- Clear the watchdog after readiness, connection failure, or explicit kill.
- Ignore readiness and error events arriving after timeout or termination.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* WIP

* WIP

* WIP

* WIP

* Update prebuilds.yml

* Update prebuilds.yml

* Update prebuilds.yml

* Update prebuilds.yml

* Update prebuilds.yml

* Update node-pty.d.ts

* Verbose logging

* Update prebuild.js

* Update prebuilds.yml

Update prebuilds.yml

Update install-sysroot.js

Update checksums.txt

Update prebuilds.yml

Update prebuilds.yml

Update prebuilds.yml

Update prebuilds.yml

* Update prebuilds.yml

* ia32 tweaks

* Update prebuilds.yml

* Update prebuilds.yml

* Update prebuilds.yml

* Update prebuilds.yml

* Validation

* Revert "Merge branch 'main' into alpha-0.15.0"

This reverts commit f2cf98c, reversing
changes made to 69fe173.

---------

Signed-off-by: Zhou Qiankang <wszqkzqk@qq.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Simon Lydell <simon.lydell@gmail.com>
Co-authored-by: Devraj Mehta <devm33@github.com>
Co-authored-by: Oliver Gassner <42lizard@42lizard.dev>
Co-authored-by: huangcs <huangcs427@163.com>
Co-authored-by: Zhou Qiankang <wszqkzqk@qq.com>
Co-authored-by: Leonard Hecker <leonard@hecker.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: anthonykim1 <anthonykim@microsoft.com>
Co-authored-by: Anthony Kim <62267334+anthonykim1@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Aditya Mandaleeka <adityam@microsoft.com>
Co-authored-by: Amiya167 <naweilaite002@gmail.com>
Co-authored-by: ritschwumm <ritschwumm@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants