Skip to content

fix(vscode): keep worker teardown races out of notifications - #31

Merged
fi3ework merged 3 commits into
mainfrom
fix/not-installed-uniform-status
Aug 25, 2026
Merged

fix(vscode): keep worker teardown races out of notifications#31
fi3ework merged 3 commits into
mainfrom
fix/not-installed-uniform-status

Conversation

@fi3ework

@fi3ework fi3ework commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

Two intermittent error notifications traced to the rstest worker's child-process error handler, which treated every error event as a spawn failure the user must fix:

  • write EPIPE — a birpc message losing the race against the worker's death (cancel a run, a config-change refresh disposing a running worker, or the worker crashing on its own). send() was called without a callback, so Node turned the lost race into a process error event and a notification. send() now takes a callback: the failure is logged, and the exit handler keeps owning the report of an exit nobody asked for.
  • spawn node ENOENT — Node blames the executable when it is the spawn cwd that is gone (a project directory deleted under a live master by a branch switch, git clean, or a build wiping fixtures). A pre-spawn guard now fails fast with the real cause and no notification — a stale project is a state detection reconciles, not a runtime the user must fix. The error handler keeps the same check as a fallback for the delete-after-check race.

A genuine spawn failure with the cwd intact — the wrong-nodeExecutable case the notification exists for — still notifies and still latches the crashed status. Post-spawn error events are absorbed, matching the shape the lint/fmt stacks already use.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Two intermittent error notifications traced to the rstest worker's
child-process 'error' handler, which treated every 'error' event as a
spawn failure the user must fix:

- "write EPIPE": a birpc message racing the worker's death. send() was
  called without a callback, so a lost race became an 'error' event and
  a notification. Pass a callback and log instead — the 'exit' handler
  already owns reporting an exit nobody asked for.
- "spawn node ENOENT": Node blames the executable when it is the spawn
  cwd that is gone (a project directory deleted under a live master by a
  branch switch or a build wiping fixtures). That is a stale-project
  state detection will reconcile, not a broken runtime: log the real
  cause, skip the notification and the crashed status.

A genuine spawn failure with the cwd intact — the wrong-nodeExecutable
case the notification exists for — keeps notifying. Post-spawn 'error'
events are absorbed, matching LanguageServerProcessOwner's shape in the
lint/fmt stacks.
@fi3ework
fi3ework force-pushed the fix/not-installed-uniform-status branch from a53d7bc to 9b68aae Compare August 24, 2026 11:38
@fi3ework fi3ework changed the title fix(vscode): uniform not-installed state and quiet worker teardown races fix(vscode): keep worker teardown races out of notifications Aug 24, 2026
@rstackjs rstackjs deleted a comment from chatgpt-codex-connector Bot Aug 24, 2026
@fi3ework

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b68aaee6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/master.ts Outdated
Comment thread packages/vscode/src/stacks/test/master.ts Outdated
Two review findings on the pre-spawn guard:

- The guard ran after package resolution, so a deleted project directory
  was first misread as "@rstest/core is not installed" (or notified for
  a rstestPackagePath inside it). It now sits directly after the disposed
  fast-fail, before any resolution.
- existsSync also returns false for a cwd hidden by a permission failure
  (EACCES on it or an ancestor), which would have absorbed a genuine,
  user-actionable spawn failure. The check now stats the cwd and treats
  only ENOENT/ENOTDIR as "really not there".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f643b0ea49

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/tests/stacks/test/master.test.ts
The test awaited the child's 'spawn' event from a listener attached after
createChildProcess() resolved; Node gives no timing guarantee for 'spawn'
relative to that continuation, so a prompt emit could leave the promise
pending until the suite timeout. Await the child's first stdout chunk
instead: stream data is buffered until a listener attaches, and 'spawn' —
which sets the handler's latch — precedes all other events.
@fi3ework
fi3ework merged commit 01c1b97 into main Aug 25, 2026
3 checks passed
@fi3ework
fi3ework deleted the fix/not-installed-uniform-status branch August 25, 2026 03:25
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.

1 participant