Skip to content

fix(core): improve plugin worker error messages and lifecycle timeouts#34251

Merged
AgentEnder merged 5 commits intomasterfrom
fix/plugin-worker-debug-error-messages
Jan 29, 2026
Merged

fix(core): improve plugin worker error messages and lifecycle timeouts#34251
AgentEnder merged 5 commits intomasterfrom
fix/plugin-worker-debug-error-messages

Conversation

@AgentEnder
Copy link
Copy Markdown
Member

Current Behavior

Plugin workers occasionally fall over during the start up steps.

Expected Behavior

Improves some issues with the error handling when loading plugin workers and adds some more logs to help understand what's went wrong here.

Related Issue(s)

Fixes #

AgentEnder and others added 2 commits January 28, 2026 18:23
- Include plugin name in all error messages for easier debugging
- Replace boolean-based connection timeout with `setErrorTimeout` helper
  that provides clearable, descriptive timeouts
- Add `expectedPluginName` from argv to worker process for context
- Fix missing `clearInterval` on rejection path in `startPluginWorker`
- Reject with `Error` object instead of plain string for stack traces
- Add `performance.mark`/`performance.measure` around worker startup
- Fix "recieve" typo and missing sentence spacing in error message

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Replace `Promise.all` with `Promise.allSettled` in
  `loadSpecifiedNxPlugins`, `loadDefaultNxPlugins`, and `getPlugins`
  so every plugin error is collected rather than short-circuiting on
  the first failure
- Throw `AggregateError` listing all failed plugins with their
  individual error messages
- Clean up successfully started workers before throwing on failure
- Rename shadowed `loadedPlugins` variable in `loadDefaultNxPlugins`
  to `defaultPluginResults` to avoid confusion with the module-level
  cache variable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@AgentEnder AgentEnder requested a review from a team as a code owner January 28, 2026 23:31
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 28, 2026

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

Project Deployment Review Updated (UTC)
nx-dev Ready Ready Preview Jan 29, 2026 3:43am

Request Review

@netlify
Copy link
Copy Markdown

netlify Bot commented Jan 28, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit df5419d
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/697ad63596e1d700084b6f7d
😎 Deploy Preview https://deploy-preview-34251--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Jan 28, 2026

View your CI Pipeline Execution ↗ for commit df5419d

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 22m 12s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 58s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 11s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-29 04:05:45 UTC

Add 6 targeted `logger.verbose` calls (gated behind
`NX_VERBOSE_LOGGING=true`) covering the 3 key worker lifecycle
transitions from both host and worker perspectives:

- Spawn: host logs PID + socket path; worker logs listening
- Connect: host logs attempt count; worker logs connection
- Load: host logs plugin name; worker logs successful load

This enables bilateral tracing — if a transition fails, logs from the
succeeding side pinpoint where the breakdown occurred.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
nx-cloud[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud Bot left a comment

Choose a reason for hiding this comment

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

✅ The fix from Nx Cloud was applied

We've updated the snapshot serializers in four e2e release test files to filter out the new plugin worker verbose logs introduced by this PR. The PR intentionally added lifecycle logging for plugin workers (spawn, connect, load events), which now appears in CLI output when using --verbose flags, causing snapshot mismatches in tests that capture this output.

Tip

We verified this fix by re-running e2e-release:e2e-ci--src/version-plans-check.test.ts.

Suggested Fix changes
diff --git a/e2e/release/src/independent-projects.workspaces.test.ts b/e2e/release/src/independent-projects.workspaces.test.ts
index 907d090386..700cb94c77 100644
--- a/e2e/release/src/independent-projects.workspaces.test.ts
+++ b/e2e/release/src/independent-projects.workspaces.test.ts
@@ -54,6 +54,8 @@ expect.addSnapshotSerializer({
         .replaceAll('pnpm install --lockfile-only', '{lock-file-command}')
         .replaceAll(getSelectedPackageManager(), '{package-manager}')
         .replaceAll(e2eRegistryUrl, '{registryUrl}')
+        // Filter out plugin worker verbose logs
+        .replaceAll(/\[plugin-(pool|worker)\].*\n/g, '')
         // We trim each line to reduce the chances of snapshot flakiness
         .split('\n')
         .map((r) => r.trim())
diff --git a/e2e/release/src/preserve-local-dependency-protocols.test.ts b/e2e/release/src/preserve-local-dependency-protocols.test.ts
index e521081fa8..92ae5e7d8d 100644
--- a/e2e/release/src/preserve-local-dependency-protocols.test.ts
+++ b/e2e/release/src/preserve-local-dependency-protocols.test.ts
@@ -47,6 +47,8 @@ expect.addSnapshotSerializer({
           /Integrity:\s*.*/g,
           'Integrity: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
         )
+        // Filter out plugin worker verbose logs
+        .replaceAll(/\[plugin-(pool|worker)\].*\n/g, '')
 
         .split('\n')
         .map((r) => r.trim())
diff --git a/e2e/release/src/version-plans-check.test.ts b/e2e/release/src/version-plans-check.test.ts
index cdef4819e8..b18aebe2c0 100644
--- a/e2e/release/src/version-plans-check.test.ts
+++ b/e2e/release/src/version-plans-check.test.ts
@@ -32,6 +32,8 @@ expect.addSnapshotSerializer({
         .replaceAll(/Test @[\w\d]+/g, 'Test @{COMMIT_AUTHOR}')
         // Normalize the version title date.
         .replaceAll(/\(\d{4}-\d{2}-\d{2}\)/g, '(YYYY-MM-DD)')
+        // Filter out plugin worker verbose logs
+        .replaceAll(/\[plugin-(pool|worker)\].*\n/g, '')
         // We trim each line to reduce the chances of snapshot flakiness
         .split('\n')
         .map((r) => r.trim())
diff --git a/e2e/release/src/version-plans-only-touched.test.ts b/e2e/release/src/version-plans-only-touched.test.ts
index 4d77dc183e..5ad43e01bd 100644
--- a/e2e/release/src/version-plans-only-touched.test.ts
+++ b/e2e/release/src/version-plans-only-touched.test.ts
@@ -29,6 +29,8 @@ expect.addSnapshotSerializer({
         .replaceAll(/Test @[\w\d]+/g, 'Test @{COMMIT_AUTHOR}')
         // Normalize the version title date.
         .replaceAll(/\(\d{4}-\d{2}-\d{2}\)/g, '(YYYY-MM-DD)')
+        // Filter out plugin worker verbose logs
+        .replaceAll(/\[plugin-(pool|worker)\].*\n/g, '')
         // We trim each line to reduce the chances of snapshot flakiness
         .split('\n')
         .map((r) => r.trim())

Revert fix via Nx Cloud  

View interactive diff ↗
This fix was applied by Craigory Coppola

🎓 Learn more about Self-Healing CI on nx.dev

@AgentEnder AgentEnder merged commit 4f4b9dc into master Jan 29, 2026
20 checks passed
@AgentEnder AgentEnder deleted the fix/plugin-worker-debug-error-messages branch January 29, 2026 06:57
FrozenPandaz pushed a commit that referenced this pull request Jan 29, 2026
#34251)

## Current Behavior
Plugin workers occasionally fall over during the start up steps.

## Expected Behavior
Improves some issues with the error handling when loading plugin workers
and adds some more logs to help understand what's went wrong here.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: AgentEnder <[email protected]>
(cherry picked from commit 4f4b9dc)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 4, 2026

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants