Skip to content

fix(windows): make node-pty compat shape-based#980

Merged
web3dev1337 merged 1 commit into
mainfrom
fix/windows-regression-triage
Mar 21, 2026
Merged

fix(windows): make node-pty compat shape-based#980
web3dev1337 merged 1 commit into
mainfrom
fix/windows-regression-triage

Conversation

@web3dev1337
Copy link
Copy Markdown
Owner

Summary

  • remove the brittle Windows node-pty version gate and patch ConPTY compatibility by package shape/behavior instead
  • fall back to direct conpty.node patching when node-pty/lib/utils.loadNativeModule is unavailable
  • add targeted tests covering missing package metadata, mismatched version strings, and direct native-module fallback

Root cause

Recent Windows PTY fixes landed in this sequence:

The regression is that the current shim assumes two things that are not consistently true across installs:

  1. node-pty/package.json reports 1.2.0-beta.12
  2. node-pty/lib/utils exposes loadNativeModule

In this checkout, the installed module reports 1.0.0 and lib/utils.js does not expose loadNativeModule, so the current runtime shim can skip entirely even on Windows installs that still need compatibility patching. That explains why behavior can diverge across machines and upgrades.

Notes

Test plan

  • node --check server/utils/nodePtyCompat.js
  • npx jest tests/unit/nodePtyCompat.test.js --runInBand
  • npx jest tests/unit/sessionManager.windowsPty.test.js tests/unit/commanderService.windowsShellArgs.test.js --runInBand
  • npm ls node-pty # observed local install reports 1.0.0, demonstrating why exact-version gating is brittle

@web3dev1337 web3dev1337 merged commit 7c4ab0e into main Mar 21, 2026
6 checks passed
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.

1 participant