Fix: Ensure compatibility with Node.js >= 25 and Bun#222
Open
Cleboost wants to merge 1 commit into
Open
Conversation
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.
Context & Problem
Node.js 25.x (and newer versions relying on recent V8 releases) introduced a regression in the new V8 Turboshaft WebAssembly compiler pipeline. During heavy WASM compilation workloads—such as
compiling tree-sitter grammars—the engine hits a native allocator limit and crashes with a fatal process out-of-memory error: Fatal process out of memory: Zone .
Previously, CodeGraph had a hard blocking check on Node.js versions >= 25 to prevent these unexpected mid-indexing crashes. However, this caused two issues:
(JSC) and is entirely unaffected by V8-specific bugs.
Proposed Changes
This PR introduces a robust, transparent compatibility layer for Node.js >= 25 and Bun without breaking backward compatibility:
• Skips the version compatibility block entirely if 'bun' in process.versions is detected. This allows commands like bun cli to run natively and safely.
• For Node.js >= 25 runtimes, the script now dynamically checks if the --no-turboshaft V8 flag is active in process.execArgv .
• If missing (and the unsafe override env variable is not set), the CLI transparently spawns a child process of itself prepended with
--no-turboshaft. This disables V8's problematic Turboshaftpipeline and falls back to the highly stable TurboFan compiler tier for WebAssembly, preventing the Zone allocator crash entirely.
• The parent process waits for the child and inherits its exit status code.
fix #183