fix(telemetry): skip os.cpus() in NodeContext to prevent crash on restricted systems (CLI-1ED)#876
Merged
fix(telemetry): skip os.cpus() in NodeContext to prevent crash on restricted systems (CLI-1ED)#876
Conversation
…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.
Contributor
|
Contributor
Codecov Results 📊✅ 6249 passed | Total: 6249 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ❌ Patch coverage is 66.67%. Project has 13061 uncovered lines. Files with missing lines (1)
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 |
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'.
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
LIBRARY_EXCLUDED_INTEGRATIONS already inherits Context from the base EXCLUDED_INTEGRATIONS via spread. Remove the explicit duplicate. Addresses Cursor Bugbot low-severity finding.
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.

Summary
os.cpus()throwing on systems with restricted/procaccess (Docker containers, some CI environments)Contextintegration callsos.cpus()unconditionally for device context, which fails withENOENTon some platformsContextintegration and re-add it withdevice: { cpu: false }to skip the problematic call while preserving OS, app, and culture contextChanges
src/lib/telemetry.ts: Add"Context"toEXCLUDED_INTEGRATIONS, re-addnodeContextIntegration({ device: { cpu: false } })in non-library modeFixes https://sentry.sentry.io/issues/7449019949/ (CLI-1ED, 6 users, 69 events)