Skip to content

feat(node): Stop sending the process session once request sessions are tracked - #24915

Merged
mydea merged 6 commits into
developfrom
feat/node-process-session-server-aware
Oct 12, 2026
Merged

mydea merged 6 commits into
developfrom
feat/node-process-session-server-aware

Conversation

@mydea

@mydea mydea commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

A Node server currently reports release health twice: through request session aggregates, and through the process session started by processSessionIntegration. Request isolation scopes inherit the process session, so the first error in any request also marks the process session as errored, which double counts it. No other server SDK sends a process session alongside request aggregates (Python and Ruby send aggregates only, Rust makes you pick one mode), and the sessions spec describes servers as request mode only.

The process session is still useful for processes that don't serve requests (scripts, CLIs, workers), so instead of removing it we switch automatically: on the first tracked request session, the process session is dropped. The process session sends nothing until an error or beforeExit, so in the common case nothing was ever sent for it. If an update was already sent (an error before the first request), it is closed as exited so it doesn't stay open forever. Servers with httpServerIntegration({ sessions: false }) never record request sessions and keep the process session as before.

Request errors also no longer touch the process session inherited by the request scope, since the aggregate already counts them.

The process session is now started in setup rather than setupOnce, so the request-session hook can be tied to the client and the scope that holds the session. As a side effect, calling Sentry.init() again in the same process ends the current session and starts a new one, instead of keeping the first.

This changes release health numbers for Node servers: they lose the one errored/crashed process-session update they send today.

🤖 Generated with Claude Code

mydea and others added 2 commits October 1, 2026 10:05
…e tracked

A Node server reported release health twice: once through request session
aggregates, and once through the process session started by
`processSessionIntegration`. Request isolation scopes inherited the process
session, so the first error in any request also marked the process session as
errored. No other server SDK sends a process session alongside request
aggregates, and the sessions spec describes servers as request mode only.

`recordRequestSession` now removes the inherited session from the request scope
and emits a `startRequestSession` client hook. On the first one,
`processSessionIntegration` discards the process session, closing it as
`exited` if an update was already sent. Processes that never serve tracked
requests (scripts, workers, or servers with `sessions: false`) keep the process
session as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gates

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cursor cursor 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.

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 3df3e63. Configure here.

Comment thread packages/node/src/integrations/processSession.ts
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.36 kB - -
@sentry/browser - with treeshaking flags 27.65 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.54 kB - -
@sentry/browser (incl. Tracing) 51.3 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.32 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.31 kB - -
@sentry/browser (incl. Tracing, Replay) 90.89 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.99 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.58 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.57 kB - -
@sentry/browser (incl. Feedback) 46.88 kB - -
@sentry/browser (incl. sendFeedback) 34.43 kB - -
@sentry/browser (incl. FeedbackAsync) 39.54 kB - -
@sentry/browser (incl. Metrics) 30.38 kB - -
@sentry/browser (incl. Logs) 30.66 kB - -
@sentry/browser (incl. Metrics & Logs) 31.33 kB - -
@sentry/react 31.2 kB - -
@sentry/react (incl. Tracing) 53.67 kB - -
@sentry/vue 36.9 kB - -
@sentry/vue (incl. Tracing) 53.88 kB - -
@sentry/svelte 29.39 kB - -
CDN Bundle 31.18 kB - -
CDN Bundle (incl. Tracing) 51.95 kB - -
CDN Bundle (incl. Logs, Metrics) 33.43 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.89 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.16 kB - -
CDN Bundle (incl. Tracing, Replay) 89.52 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.5 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.7 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.67 kB - -
CDN Bundle - uncompressed 92.05 kB - -
CDN Bundle (incl. Tracing) - uncompressed 154.44 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 98.62 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.39 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.19 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.17 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280.1 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.87 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.8 kB - -
@sentry/nextjs (client) 55.91 kB - -
@sentry/sveltekit (client) 51.74 kB - -
@sentry/core/server 40.01 kB +0.04% +14 B 🔺
@sentry/core/browser 13.63 kB - -
@sentry/node 144.4 kB +0.06% +83 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.01 kB - -
@sentry/node - without tracing 93.03 kB +0.09% +82 B 🔺
@sentry/node - without channel injection 122.71 kB +0.06% +65 B 🔺
@sentry/aws-serverless 101.32 kB +0.07% +70 B 🔺
@sentry/cloudflare (withSentry) - minified 206.69 kB - -
@sentry/cloudflare (withSentry) 514.13 kB - -

View base workflow run

mydea and others added 4 commits October 1, 2026 10:25
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… requests

Event processing is async (e.g. ContextLines reads files), so on slower machines
the first request could arrive and drop the process session before the startup
error had updated it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Like `exited-session-aggregate`, it relies on `sessionFlushingDelayMS` passed to
`httpIntegration`, which `bunHttpServerIntegration` ignores, so the aggregate is
not flushed before the test times out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mydea
mydea marked this pull request as ready for review October 1, 2026 10:44
@mydea
mydea requested a review from a team as a code owner October 1, 2026 10:44
@mydea
mydea requested review from JPeer264 and isaacs and removed request for a team October 1, 2026 10:44
@mydea
mydea merged commit 81ad409 into develop Oct 12, 2026
350 checks passed
@mydea
mydea deleted the feat/node-process-session-server-aware branch October 12, 2026 13:11
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.

3 participants