Skip to content

fix(telemetry): skip os.cpus() in NodeContext to prevent crash on restricted systems (CLI-1ED)#876

Merged
BYK merged 3 commits intomainfrom
fix/cli-1ed-cpu-crash
Apr 29, 2026
Merged

fix(telemetry): skip os.cpus() in NodeContext to prevent crash on restricted systems (CLI-1ED)#876
BYK merged 3 commits intomainfrom
fix/cli-1ed-cpu-crash

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 29, 2026

Summary

  • Fixes CLI crash caused by os.cpus() throwing on systems with restricted /proc access (Docker containers, some CI environments)
  • The Sentry SDK's Context integration calls os.cpus() unconditionally for device context, which fails with ENOENT on some platforms
  • Fix: exclude the default Context integration and re-add it with device: { cpu: false } to skip the problematic call while preserving OS, app, and culture context

Changes

  • src/lib/telemetry.ts: Add "Context" to EXCLUDED_INTEGRATIONS, re-add nodeContextIntegration({ device: { cpu: false } }) in non-library mode

Fixes https://sentry.sentry.io/issues/7449019949/ (CLI-1ED, 6 users, 69 events)

…crash (CLI-1ED)

On some systems (Docker containers, restricted /proc access), os.cpus()
throws ENOENT, crashing the CLI before the command even runs. The Sentry
SDK's Context integration calls os.cpus() unconditionally for device info.

Fix: exclude the default Context integration and re-add it with
device: { cpu: false } to skip the problematic call while preserving
OS, app, and culture context for telemetry.

Affects 6 users with 69 events.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-876/

Built to branch gh-pages at 2026-04-29 01:05 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

Codecov Results 📊

6249 passed | Total: 6249 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 66.67%. Project has 13061 uncovered lines.
✅ Project coverage is 75.88%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/telemetry.ts 66.67% ⚠️ 3 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    75.85%    75.88%    +0.03%
==========================================
  Files          293       293         —
  Lines        54163     54151       -12
  Branches         0         0         —
==========================================
+ Hits         41085     41090        +5
- Misses       13078     13061       -17
- Partials         0         0         —

Generated by Codecov Action

Comment thread src/lib/telemetry.ts
Comment thread src/lib/telemetry.ts
The SDK integration name is 'Context' not 'NodeContext'. Fixed both the
normal mode exclusion (already correct) and the library mode exclusion
(was 'NodeContext', now 'Context').

Addresses Seer and Cursor Bugbot review: verified via
getDefaultIntegrations({}) that the name IS 'Context'.
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ba92df5. Configure here.

Comment thread src/lib/telemetry.ts Outdated
LIBRARY_EXCLUDED_INTEGRATIONS already inherits Context from the base
EXCLUDED_INTEGRATIONS via spread. Remove the explicit duplicate.

Addresses Cursor Bugbot low-severity finding.
@BYK BYK merged commit 56b4cd9 into main Apr 29, 2026
26 checks passed
@BYK BYK deleted the fix/cli-1ed-cpu-crash branch April 29, 2026 01:10
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