Skip to content

feat: add execution timeout support for isolated-vm JavaScript execution#4

Open
code-xpertai[bot] wants to merge 1 commit into
mainfrom
fix/isolated-vm-timeout-issue-234
Open

feat: add execution timeout support for isolated-vm JavaScript execution#4
code-xpertai[bot] wants to merge 1 commit into
mainfrom
fix/isolated-vm-timeout-issue-234

Conversation

@code-xpertai

@code-xpertai code-xpertai Bot commented Mar 17, 2026

Copy link
Copy Markdown

Summary

This PR adds execution timeout support for JavaScript code execution in isolated-vm, addressing issue xpert-ai#234 where script execution could hang indefinitely in Node.js 20 environment.

Changes

Backend

  • IWFNCode interface: Added optional timeout field (in milliseconds) with documentation
  • SandboxVMCommand: Added timeout parameter to the command constructor
  • SandboxVMHandler:
    • Passes timeout to isolated-vm's script.run() method
    • Validates and clamps timeout value: min 100ms, max 60000ms, default 5000ms
  • Workflow execution: Propagates timeout from workflow node configuration to sandbox execution

Frontend

  • Added timeout configuration UI in the Code workflow node panel
  • Input field with validation (min: 100ms, max: 60000ms)
  • Tooltip explaining the timeout feature

Usage

Users can now configure a timeout for JavaScript code execution in workflow nodes:

// Example: Set timeout to 10 seconds
// The script will be terminated if execution exceeds 10000ms

The timeout is configured via the UI in the Code node panel, under the "Timeout" section.

Testing

  • Default timeout (5000ms) is applied when no timeout is specified
  • Timeout values are clamped to valid range (100-60000ms)
  • Timeout is properly passed through the execution chain

Fixes xpert-ai#234

- Add optional timeout parameter to IWFNCode interface (default: 5000ms)
- Add timeout parameter to SandboxVMCommand
- Pass timeout to isolated-vm's script.run() method with bounds validation
  - Min: 100ms, Max: 60000ms, Default: 5000ms
- Add UI controls in code workflow component for timeout configuration
- Propagate timeout from workflow node to sandbox execution

This addresses issue xpert-ai#234 where JavaScript execution in isolated-vm could
hang indefinitely in Node.js 20 environment. Users can now configure a
timeout to prevent indefinite hangs.
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.

Add support for execution timeout in isolated-vm for Node.js 20

0 participants