Skip to content

fix(node): use node subprocess explicitly - #2391

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/node
Dec 16, 2025
Merged

fix(node): use node subprocess explicitly#2391
waleedlatif1 merged 3 commits into
stagingfrom
fix/node

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • use node subprocess explicitly

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Dec 16, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentReviewUpdated (UTC)
docsSkippedSkippedDec 16, 2025 2:13am

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR ensures the isolated-vm worker subprocess uses Node.js explicitly rather than inheriting the parent process's runtime (Bun). Since the application runs with Bun but isolated-vm requires Node.js, the worker must be spawned using the node command directly.

  • Changed spawn(process.execPath, ...) to spawn('node', ...) to ensure Node.js is used for the isolated-vm worker
  • Added checkNodeAvailable() function with caching to verify Node.js is installed before attempting to spawn the worker
  • Added clear error message when Node.js is not found, directing users to install it
  • Updated README.md to document the Node.js v20+ requirement for sandboxed code execution
  • Removed exit code logging from the worker exit handler (cleanup still functions correctly)

Confidence Score: 5/5

  • This PR is safe to merge - it's a targeted fix that correctly addresses the Bun/Node.js compatibility requirement for isolated-vm.
  • The change is well-scoped, addresses a clear compatibility issue, adds appropriate error handling, and includes documentation. No bugs or security concerns were found.
  • No files require special attention.

Important Files Changed

File Analysis

FilenameScoreOverview
README.md5/5Added documentation for Node.js v20+ requirement for sandboxed code execution - straightforward documentation update.
apps/sim/lib/execution/isolated-vm.ts5/5Changed worker spawning from process.execPath to explicit node command with availability check - correctly ensures Node.js is used for isolated-vm worker when main process runs with Bun.

Sequence Diagram

sequenceDiagram
participant App as Bun Application
participant IVM as isolated-vm.ts
participant Check as checkNodeAvailable()
participant Worker as Node.js Worker
App->>IVM: executeInIsolatedVM(request)
IVM->>IVM: ensureWorker()
IVM->>Check: checkNodeAvailable()
alt Node.js not found
Check-->>IVM: false
IVM-->>App: Error: Node.js required
else Node.js available
Check-->>IVM: true
IVM->>Worker: spawn('node', [workerPath])
Worker-->>IVM: Ready message
IVM->>Worker: Execute code
Worker-->>IVM: Result
IVM-->>App: Execution result
end
Loading

@greptile-appsgreptile-appsBot 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.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
waleedlatif1 merged commit a5b7148 into stagingDec 16, 2025
10 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/node branch December 16, 2025 02:18
Sign up for freeto 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

@waleedlatif1