Skip to content

fix(sandbox): normalize node-pty path so daemon resolves on Windows#3765

Open
Rooseveltfj wants to merge 1 commit into
decocms:mainfrom
Rooseveltfj:fix/windows-node-pty-path
Open

fix(sandbox): normalize node-pty path so daemon resolves on Windows#3765
Rooseveltfj wants to merge 1 commit into
decocms:mainfrom
Rooseveltfj:fix/windows-node-pty-path

Conversation

@Rooseveltfj

@Rooseveltfj Rooseveltfj commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

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 via Bun.resolveSync(), which
returns a backslash path on Windows, then searches for the /node_modules/
marker with lastIndexOf. The forward-slash marker never matches a backslash
path, so idx is -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 Windows
and Unix. No-op on macOS/Linux (no backslashes to replace). The throw still shows
the original path for accurate diagnostics.

How to Test

  1. On Windows, bun run dev, connect a model provider
  2. Send a prompt that runs a tool (e.g. "write a song")
  3. Expected: the agent executes and responds — no node-pty path error

Migration Notes

None.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • No breaking changes (no-op on macOS/Linux)

Summary by cubic

Normalize the resolved node-pty path to forward slashes so the sandbox daemon finds the node_modules directory 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.

Review in cubic

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

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