Skip to content

fix(build): skip spawn-helper check on Linux to avoid spurious node-pty rebuilds - #7762

Merged
Jinwoo-H merged 2 commits into
stablyai:mainfrom
fsdwen:fsdwen/issue-7760-getpatchednodeptyrebuildreason-falsel
Jul 10, 2026
Merged

Jinwoo-H merged 2 commits into
stablyai:mainfrom
fsdwen:fsdwen/issue-7760-getpatchednodeptyrebuildreason-falsel

Conversation

@fsdwen

@fsdwen fsdwen commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

getPatchedNodePtyRebuildReason() unconditionally checks for build/Release/spawn-helper, but spawn-helper is a macOS-only node-pty build target defined in node_modules/node-pty/binding.gyp. On Linux, node-gyp never generates this binary.

As a result, missingArtifact was always non-null on Linux, causing:

  1. ensure-native-runtime.mjs always triggers a source rebuild every time.
  2. rebuild-native-deps.mjs always reports artifacts missing even when pty.node is intact.

Fix

Wrap the spawn-helper existence check in if (process.platform === 'darwin') in both files.

Changes

  • config/scripts/ensure-native-runtime.mjs — getPatchedNodePtyRebuildReason()
  • config/scripts/rebuild-native-deps.mjs — getPatchedNodePtyRebuildReason()

Fixes #7760

…ty rebuilds

getPatchedNodePtyRebuildReason() unconditionally checked for
build/Release/spawn-helper, but spawn-helper is a macOS-only node-pty
build target. On Linux, node-gyp never generates it, so missingArtifact
was always non-null, causing unnecessary source rebuilds every time.

Fixes stablyai#7760
@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dbb8dc3e-fadc-455b-98dd-812c2be10b9f

📥 Commits

Reviewing files that changed from the base of the PR and between c3d8d15 and a21296c.

📒 Files selected for processing (4)
  • config/scripts/ensure-native-runtime.mjs
  • config/scripts/ensure-native-runtime.test.mjs
  • config/scripts/rebuild-native-deps.mjs
  • config/scripts/rebuild-native-deps.test.mjs
🚧 Files skipped from review as they are similar to previous changes (2)
  • config/scripts/ensure-native-runtime.mjs
  • config/scripts/rebuild-native-deps.mjs

📝 Walkthrough

Walkthrough

The pull request makes patched node-pty artifact detection platform-aware in both native dependency scripts. pty.node remains required on all platforms, while spawn-helper is required only on macOS. Tests update artifact fixtures, support explicit native directories, and verify the runtime fast path avoids an unnecessary rebuild when valid artifacts exist.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description misses most required template sections, including Screenshots, Testing, AI Review Report, Security Audit, and Notes. Add the missing template sections and fill in Testing, AI Review Report, Security Audit, and Notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the Linux-specific spawn-helper check fix and its impact on node-pty rebuilds.
Linked Issues check ✅ Passed The code changes match issue #7760 by making spawn-helper checks macOS-only in both affected scripts and updating tests accordingly.
Out of Scope Changes check ✅ Passed The changes are scoped to the reported node-pty artifact check fix and related tests, with no unrelated modifications evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
config/scripts/ensure-native-runtime.mjs (1)

279-293: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add a Linux regression for the new artifact check. The current config/scripts/ensure-native-runtime.test.mjs and config/scripts/rebuild-native-deps.test.mjs cases always create both pty.node and spawn-helper, so they don’t exercise the darwin-only branch or the Linux case where pty.node alone should pass.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 94e635e9-6c5c-492d-a33c-2f6cd0d0f539

📥 Commits

Reviewing files that changed from the base of the PR and between 5c3c2f2 and c3d8d15.

📒 Files selected for processing (2)
  • config/scripts/ensure-native-runtime.mjs
  • config/scripts/rebuild-native-deps.mjs

@fsdwen fsdwen closed this Jul 8, 2026
@fsdwen
fsdwen deleted the fsdwen/issue-7760-getpatchednodeptyrebuildreason-falsel branch July 8, 2026 02:38
@fsdwen
fsdwen restored the fsdwen/issue-7760-getpatchednodeptyrebuildreason-falsel branch July 8, 2026 02:40
@fsdwen fsdwen reopened this Jul 8, 2026
@AmethystLiang
AmethystLiang self-requested a review July 8, 2026 03:14
@fsdwen

fsdwen commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@AmethystLiang would you mind reviewing this? The fix wraps the spawn-helper check in if (process.platform === 'darwin') so Linux no longer falsely triggers node-pty source rebuilds.

@Jinwoo-H Jinwoo-H 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.

Thanks — this is the correct platform-specific fix.

  • Confirmed node-pty builds spawn-helper only on macOS.
  • Added regression coverage for both native-runtime entry points.
  • Verified 11/11 targeted tests on Linux Node 24 Docker and macOS; reverting the guard reproduces the Linux failure.
  • Verified the real macOS Node/Electron warm paths skip rebuilding.
  • Windows, SSH, and cross-target behavior remain unchanged.

@Jinwoo-H
Jinwoo-H merged commit 3f9dbba into stablyai:main Jul 10, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…ty rebuilds (stablyai#7762)

* fix(build): skip spawn-helper check on Linux to avoid spurious node-pty rebuilds

getPatchedNodePtyRebuildReason() unconditionally checked for
build/Release/spawn-helper, but spawn-helper is a macOS-only node-pty
build target. On Linux, node-gyp never generates it, so missingArtifact
was always non-null, causing unnecessary source rebuilds every time.

Fixes stablyai#7760

* test(build): cover platform-specific node-pty artifacts

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Jinwoo-H <[email protected]>
Co-authored-by: Orca <[email protected]>
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.

Linux: getPatchedNodePtyRebuildReason() falsely reports spawn-helper as missing, triggering unnecessary source rebuilds

2 participants