fix(sandbox): normalize node-pty path so daemon resolves on Windows#3765
Open
Rooseveltfj wants to merge 1 commit into
Open
fix(sandbox): normalize node-pty path so daemon resolves on Windows#3765Rooseveltfj wants to merge 1 commit into
Rooseveltfj wants to merge 1 commit into
Conversation
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
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.
What is this contribution about?
On Windows, running an agent fails immediately with
"could not derive node_modules path from node-pty resolution: C:...\node-pty\lib\index.js".
resolveNodePtyNodeModulesDir()resolves node-pty viaBun.resolveSync(), whichreturns a backslash path on Windows, then searches for the
/node_modules/marker with
lastIndexOf. The forward-slash marker never matches a backslashpath, so
idxis -1 and it throws. The unix separator works only by accident.Impact: the sandbox daemon never spawns, so agent execution is fully broken on
Windows — any prompt that triggers a tool fails.
Fix: normalize the resolved path to forward slashes before matching the marker.
The returned value feeds
NODE_PATH, and forward-slash paths work on both Windowsand Unix. No-op on macOS/Linux (no backslashes to replace). The throw still shows
the original path for accurate diagnostics.
How to Test
bun run dev, connect a model providerMigration Notes
None.
Review Checklist
Summary by cubic
Normalize the resolved
node-ptypath to forward slashes so the sandbox daemon finds thenode_modulesdirectory on Windows. This fixes broken agent execution on Windows and is a no-op on macOS/Linux.Written for commit 7a3f59b. Summary will update on new commits.