Skip to content

fix(core): surface clearer error when CNW hits SANDBOX_FAILED#34724

Merged
FrozenPandaz merged 1 commit intomasterfrom
NXC-4035
Mar 5, 2026
Merged

fix(core): surface clearer error when CNW hits SANDBOX_FAILED#34724
FrozenPandaz merged 1 commit intomasterfrom
NXC-4035

Conversation

@jaysoo
Copy link
Member

@jaysoo jaysoo commented Mar 5, 2026

This PR surfaces install errors instead of silently failing without anything useful printed. It also records needs_input in the AX flow as cancelled so we account for cases where AI agents exit without recording either success, complete, or cancelled.

BEFORE:

image

AFTER:

Screenshot 2026-03-05 at 12 30 25 PM

Notes

  1. Remove --silent from all PM install commands — since execAndWait uses exec() (captures output in memory, never shown to terminal), --silent just suppressed error info for no benefit
  2. Increase maxBuffer from default 1MB to 10MB to prevent process being killed when PMs emit verbose output
  3. Fallback error message when both stderr and stdout are empty — includes exit code and log file path
  4. Structured sandbox error with exit code, log file, and actionable hint
  5. Record telemetry stat for AI agent needs_input flow (was previously missing)
  6. Migrate from deprecated CreateNxWorkspaceError to CnwError in execAndWait

Related Issue(s)

Fixes NXC-4035

## Current Behavior

When `npm install` fails during CNW sandbox creation (e.g. due to
~/.npm permission issues), the error message is empty because
`--silent` suppresses all output including errors. Users see
"Failed to install dependencies:" with no details.

## Expected Behavior

The actual package manager error is now surfaced with exit code,
log file path, and an actionable hint. For example:
"Failed to install dependencies
npm error EACCES: permission denied, mkdir ~/.npm/_cacache
Exit code: 243
Log file: /tmp/.../error.log
Please verify that "npm install --ignore-scripts" runs successfully
in a temporary directory."

## Related Issue(s)

Fixes NXC-4035
@jaysoo jaysoo requested a review from a team as a code owner March 5, 2026 17:44
@jaysoo jaysoo requested a review from FrozenPandaz March 5, 2026 17:44
@netlify
Copy link

netlify bot commented Mar 5, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 7380a54
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69a9c10039b0ce000831ad67
😎 Deploy Preview https://deploy-preview-34724--nx-dev.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.

@netlify
Copy link

netlify bot commented Mar 5, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 7380a54
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69a9c10099fec600081c373a
😎 Deploy Preview https://deploy-preview-34724--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
Contributor

nx-cloud bot commented Mar 5, 2026

View your CI Pipeline Execution ↗ for commit 7380a54

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 12m 55s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3m 21s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 8s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-05 18:08:59 UTC

@FrozenPandaz FrozenPandaz merged commit b316ec1 into master Mar 5, 2026
27 checks passed
@FrozenPandaz FrozenPandaz deleted the NXC-4035 branch March 5, 2026 18:42
@github-actions
Copy link
Contributor

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 Mar 11, 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