Skip to content

fix(server): use prebuilt node-pty binaries - #6350

Open
skebby11 wants to merge 4 commits into
pingdotgg:mainfrom
skebby11:codex/fix-linux-node-pty-prebuilds
Open

fix(server): use prebuilt node-pty binaries#6350
skebby11 wants to merge 4 commits into
pingdotgg:mainfrom
skebby11:codex/fix-linux-node-pty-prebuilds

Conversation

@skebby11

@skebby11 skebby11 commented Aug 12, 2026

Copy link
Copy Markdown

Fixes #5129

What Changed

  • Replace node-pty with the API-compatible @lydell/node-pty package.
  • Update the terminal adapter import and spawn-helper resolution to use the replacement package.
  • Include its prebuilt Darwin, Linux, and Windows platform packages in the lockfile.

Why

The published node-pty@1.1.0 package does not include Linux prebuilds. Installing T3 on a fresh or immutable Linux SSH host therefore falls back to node-gyp, and hosts without a compiler toolchain fail before the remote server can start. Desktop then surfaces the generic Remote T3 server did not become ready error.

@lydell/node-pty exposes the same API while publishing prebuilt binaries for the supported desktop and Linux architectures. This removes the compiler requirement instead of only improving the diagnostic when compilation fails.

This complements #5132: that PR surfaces a failed install, while this change prevents the native build failure on supported platforms.

Validation

  • vp test run src/terminal/NodePtyAdapter.test.ts — 4 tests passed
  • vp run --filter t3 typecheck
  • vp run --filter t3 build
  • vp fmt --check apps/server/package.json apps/server/src/terminal/NodePtyAdapter.ts apps/server/src/terminal/NodePtyAdapter.test.ts pnpm-lock.yaml
  • Real native PTY spawn on Windows x64
  • Installed the replacement into an isolated prefix and spawned a real PTY on Ubuntu Linux x64 with Node 24
  • Launched the remote T3 server over SSH on the original failing host; it became ready as a managed server on port 3773

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • UI screenshots are not applicable
  • Interaction video is not applicable

Generated with Codex (GPT-5) in the Codex desktop harness.

Note

Replace node-pty with @lydell/node-pty prebuilt binaries for WSL terminal support

  • Replaces the node-pty dependency with @lydell/node-pty in the server package, removing the need to compile node-pty from source in WSL.
  • The WSL preflight probe now loads @lydell/node-pty directly instead of validating custom Linux prebuild files or invoking node-gyp.
  • The desktop build now stages platform-specific @lydell/node-pty-<platform>-<arch> native packages (including Linux packages for Windows builds) via a new resolveNodePtyNativeDependencies function in build-desktop-artifact.ts.
  • CI removes the build_wsl_node_pty job and the --wsl-prebuild CLI flag; the entire custom Linux pty.node build and upload pipeline is eliminated.
  • Behavioral Change: ensureNodePty no longer accepts allowBuild and never attempts toolchain checks or a WSL-side build; failures now report Node.js version mismatches or a generic incompatibility message.

Macroscope summarized 3c05b5e.


Note

Medium Risk
Changes native PTY loading, Windows/WSL packaging, and the release workflow; mis-staged or pruned platform packages would break terminals or the WSL backend, though behavior is simpler than the prior compile path.

Overview
Replaces node-pty with @lydell/node-pty on the server and in the terminal adapter, including spawn-helper resolution from @lydell/node-pty-<platform>-<arch> with .asar.asar.unpacked rewrites for packaged Electron apps.

Release and desktop packaging no longer run a Linux CI job to build pty.node or pass --wsl-prebuild; Windows staging instead promotes direct dependencies on the host and matching Linux @lydell/node-pty-* packages so WSL can load prebuilts without node-gyp. node-pty is removed from pnpm allowBuilds.

WSL preflight drops allowBuild, toolchain checks, and in-distro node-gyp builds; it now probes require("@lydell/node-pty") (plus Node/engine and unpacked effect checks) and fails with clearer messages when the Linux prebuilt cannot load.

Reviewed by Cursor Bugbot for commit 3c05b5e. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9925b471-86d9-4450-9a10-e583e2fc93c3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 12, 2026
Comment thread apps/server/src/terminal/NodePtyAdapter.ts Outdated
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 12, 2026
@skebby11
skebby11 marked this pull request as ready for review August 12, 2026 20:26
Comment thread apps/server/src/terminal/NodePtyAdapter.ts Outdated
Comment thread apps/server/package.json
@macroscopeapp

macroscopeapp Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR swaps the native terminal module from node-pty to @lydell/node-pty (prebuilt binaries), removing build-from-source fallback and simplifying WSL support. While this reduces complexity, switching native module providers is a significant runtime behavior change affecting terminal functionality across all platforms.

You can customize Macroscope's approvability policy. Learn more.

@skebby11
skebby11 force-pushed the codex/fix-linux-node-pty-prebuilds branch from 8baf509 to f7c25fd Compare August 12, 2026 21:27
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 12, 2026

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f7c25fd. Configure here.

Comment thread apps/server/src/terminal/NodePtyAdapter.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI exits 0 with no output when node-pty fails to build (missing C toolchain); breaks desktop SSH launch with empty server.log

1 participant