Skip to content

Conversation

@waleedlatif1
Copy link
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
Copy link

vercel bot commented Dec 16, 2025

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 16, 2025 2:13am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 16, 2025

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

Filename Score Overview
README.md 5/5 Added documentation for Node.js v20+ requirement for sandboxed code execution - straightforward documentation update.
apps/sim/lib/execution/isolated-vm.ts 5/5 Changed 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

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

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 staging Dec 16, 2025
10 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/node branch December 16, 2025 02:18
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.

2 participants