VS Code: Stop charging Node startup to the Project Analysis timeout - #2553
Merged
marcoroth merged 2 commits intoSep 14, 2026
Merged
Conversation
Project Analysis spawns a fresh Node process per file, cpus() of them at once, and kills each after 1 s. A worker has to boot Node and load the WASM bundle before it reads the file, about half a second on an idle Apple Silicon Mac, so under any contention most of a large project was reported as "Timed Out" although the native parser needs at most 24 ms on the largest template. The parse is already bounded by ParserOptions.timeout (1 s by default), which surfaces as a TIMEOUT_ERROR in the result. So the process limit only has to catch a hung worker: it is now 30 s, and the worker reports a parser timeout as `timedOut` so the "Timed Out" group keeps meaning "the parser gave up on this file". Fixes marcoroth#2552 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The changes are small, consistent with existing error-type conventions, and align the timeout status with parser timeouts while avoiding false positives from worker startup latency.
Pull request overview
This PR adjusts the VS Code extension’s Project Analysis worker management so that “Timed Out” reflects parser-level timeouts (via TIMEOUT_ERROR) rather than Node/WASM startup overhead, and increases the process-level timeout to act as a hang guard instead of a tight per-file budget.
Changes:
- Increase the worker process timeout in
AnalysisServiceto a 30s hang guard (WORKER_TIMEOUT_MS) and document why it must be generous. - Have
parse-worker.jssurface atimedOutflag when the parse produced aTIMEOUT_ERROR, and map that flag to thetimeoutstatus in the service.
File summaries
| File | Description |
|---|---|
| javascript/packages/vscode/src/analysis-service.ts | Raises the exec timeout to a hang guard and maps worker-reported parse timeouts to the timeout file status. |
| javascript/packages/vscode/src/parse-worker.js | Detects TIMEOUT_ERROR among recursive parse errors and reports timedOut in the worker result JSON. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
marcoroth
reviewed
Sep 14, 2026
Co-authored-by: Marco Roth <marco.roth@intergga.ch> Signed-off-by: Marco Roth <marco.roth@intergga.ch>
marcoroth
enabled auto-merge (squash)
September 14, 2026 19:37
marcoroth
disabled auto-merge
September 14, 2026 19:37
marcoroth
reviewed
Sep 14, 2026
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.
Fixes #2552.
Problem
Project Analysis in the VS Code extension spawns a fresh Node process per file (
os.cpus().lengthat once) and kills each after 1 s. Every worker first has to boot Node and load the WASM bundle before it reads the file: ~0.45 s on an idle Apple Silicon Mac, ~0.7 s with the formatter enabled. Under any CPU contention most of a large project is reported as "Timed Out". On a 460-template Rails app the count was 452, 238 and 275 on the same tree, tracking machine load rather than the files; the native parser needs at most 24 ms on the largest template.Change
analysis-service.ts— the process-level limit becomes a 30 s hang guard (WORKER_TIMEOUT_MS) with a comment on why it must not be tight. The parse itself is already bounded byParserOptions.timeout(1 s by default), so runaway parses are still caught.parse-worker.js— reportstimedOut: truewhen the parse result carries aTIMEOUT_ERROR, and the service maps that to thetimeoutstatus. The "Timed Out" group therefore keeps meaning "the parser gave up on this file" rather than "Node did not finish booting".No new settings, no change to the worker's arguments.
Verification
extension.jspatched to the same larger timeout, all 460 files pass Project Analysis on the machine that reported the timeouts.node --checkon the worker; the TypeScript change is a constant, one option, and one ternary.🤖 Generated with Claude Code