Skip to content

fix: upgrade PostHog and Sentry to stop memory leaks - #1617

Merged
brendan-kellam merged 2 commits into
mainfrom
brendan/fix-sou-2011
Aug 25, 2026
Merged

fix: upgrade PostHog and Sentry to stop memory leaks#1617
brendan-kellam merged 2 commits into
mainfrom
brendan/fix-sou-2011

Conversation

@brendan-kellam

@brendan-kellam brendan-kellam commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Fixes SOU-2011

Summary

  • Upgrade posthog-node from 5.24.15 to 5.51.2, which removes the Node 24 BlobReader retention path used during compressed event flushes.
  • Upgrade the Sentry JavaScript SDK from 10.70.0 to 10.71.0, which bounds child-span tracking for long-lived parent spans.
  • Align the Sentry Node runtime across the web, backend, and shared packages.

Validation

  • yarn build:deps
  • yarn workspace @sourcebot/backend build
  • yarn workspace @sourcebot/web lint
  • yarn workspace @sourcebot/backend test --run (305 tests)
  • yarn workspace @sourcebot/web test --run --exclude .next/** (1,424 tests)
  • yarn workspace @sourcebot/web build

Note

Low Risk
Dependency-only patch upgrades for telemetry; no logic changes, though Sentry/PostHog still wrap production traffic so regressions would show up as tracing or analytics behavior rather than feature bugs.

Overview
Addresses SOU-2011 by bumping observability dependencies only—no application code changes.

posthog-node is raised from ^5.24.15 to ^5.51.2 in @sourcebot/backend and @sourcebot/web, pulling in a newer @posthog/core so compressed event flushes no longer retain request contexts indefinitely (including the Node 24 BlobReader path called out in the PR).

Sentry is aligned on ^10.71.0 across @sourcebot/backend (@sentry/node, @sentry/profiling-node), @sourcebot/web (@sentry/nextjs, @sentry/profiling-node), and @sourcebot/shared (@sentry/node, previously ^10.40.0), so long-lived parent spans stop accumulating unbounded child spans.

The unreleased CHANGELOG entry documents the fix; yarn.lock reflects the resolved dependency tree.

Reviewed by Cursor Bugbot for commit 04afe48. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of request contexts and child spans to prevent them from being retained indefinitely.
    • Updated error monitoring and analytics integrations for improved reliability.

@github-actions

This comment has been minimized.

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 25, 2026

Copy link
Copy Markdown

We've triggered an ultrareview automatically — Upgrades PostHog and Sentry across backend, shared, and web to fix memory leaks; the large version jumps could introduce subtle behavioral regressions in telemetry.. I'll post findings when complete.

An ultrareview is cubic's deepest review, catching hard-to-find bugs in the most critical PRs. It runs a longer, multi-pass analysis using cubic's most capable review models, and typically takes around 30 minutes. It consumes your team's reviewed-lines allowance at 3× the standard rate.

Automated ultrareviews are disabled by default. We triggered this run as part of your trial. Want cubic to do this for every high-risk PR? Enable auto-ultrareview in your settings.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c392aaa-6647-499b-b0cc-fd0947120643

📥 Commits

Reviewing files that changed from the base of the PR and between fb63ab8 and 04afe48.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • CHANGELOG.md
  • packages/backend/package.json
  • packages/shared/package.json
  • packages/web/package.json

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


Walkthrough

Updated Sentry and PostHog dependency versions in the backend, shared, and web packages. Added an Unreleased changelog entry for request-context and child-span retention fixes.

Changes

Dependency version alignment

Layer / File(s) Summary
Update package dependency ranges
packages/backend/package.json, packages/shared/package.json, packages/web/package.json, CHANGELOG.md
Sentry dependencies now use 10.71.0, and posthog-node now uses 5.51.2 where applicable. The changelog documents the updates and retention fixes.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 04afe

This PR updates telemetry dependencies to address memory retention issues without changing application logic, and no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: msukkari

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: upgrading PostHog and Sentry dependencies to address memory leaks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (4 skipped: 4 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch brendan/fix-sou-2011

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

License Audit

⚠️ Status: PASS

Metric Count
Total packages 2173
Resolved (non-standard) 26
Unresolved 0
Strong copyleft 0
Weak copyleft 28

Weak Copyleft Packages (informational)

Package Version License
@img/sharp-libvips-darwin-arm64 1.3.2 LGPL-3.0-or-later
@img/sharp-libvips-darwin-x64 1.3.2 LGPL-3.0-or-later
@img/sharp-libvips-linux-arm 1.3.2 LGPL-3.0-or-later
@img/sharp-libvips-linux-arm64 1.3.2 LGPL-3.0-or-later
@img/sharp-libvips-linux-ppc64 1.3.2 LGPL-3.0-or-later
@img/sharp-libvips-linux-riscv64 1.3.2 LGPL-3.0-or-later
@img/sharp-libvips-linux-s390x 1.3.2 LGPL-3.0-or-later
@img/sharp-libvips-linux-x64 1.3.2 LGPL-3.0-or-later
@img/sharp-libvips-linuxmusl-arm64 1.3.2 LGPL-3.0-or-later
@img/sharp-libvips-linuxmusl-x64 1.3.2 LGPL-3.0-or-later
@img/sharp-wasm32 0.35.3 Apache-2.0 AND LGPL-3.0-or-later AND MIT
@img/sharp-win32-arm64 0.35.3 Apache-2.0 AND LGPL-3.0-or-later
@img/sharp-win32-ia32 0.35.3 Apache-2.0 AND LGPL-3.0-or-later
@img/sharp-win32-x64 0.35.3 Apache-2.0 AND LGPL-3.0-or-later
axe-core 4.10.3 MPL-2.0
dompurify 3.4.13 (MPL-2.0 OR Apache-2.0)
lightningcss 1.32.0 MPL-2.0
lightningcss-android-arm64 1.32.0 MPL-2.0
lightningcss-darwin-arm64 1.32.0 MPL-2.0
lightningcss-darwin-x64 1.32.0 MPL-2.0
lightningcss-freebsd-x64 1.32.0 MPL-2.0
lightningcss-linux-arm-gnueabihf 1.32.0 MPL-2.0
lightningcss-linux-arm64-gnu 1.32.0 MPL-2.0
lightningcss-linux-arm64-musl 1.32.0 MPL-2.0
lightningcss-linux-x64-gnu 1.32.0 MPL-2.0
lightningcss-linux-x64-musl 1.32.0 MPL-2.0
lightningcss-win32-arm64-msvc 1.32.0 MPL-2.0
lightningcss-win32-x64-msvc 1.32.0 MPL-2.0
Resolved Packages (26)
Package Version Original Resolved Source
@sentry/cli 2.58.5 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli 2.58.6 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-darwin 2.58.5 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-darwin 2.58.6 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-linux-arm 2.58.5 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-linux-arm 2.58.6 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-linux-arm64 2.58.5 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-linux-arm64 2.58.6 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-linux-i686 2.58.5 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-linux-i686 2.58.6 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-linux-x64 2.58.5 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-linux-x64 2.58.6 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-win32-arm64 2.58.5 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-win32-arm64 2.58.6 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-win32-i686 2.58.5 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-win32-i686 2.58.6 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-win32-x64 2.58.5 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
@sentry/cli-win32-x64 2.58.6 FSL-1.1-MIT FSL-1.1-MIT published tarball LICENSE file (npm registry) - 'Functional Source License, Version 1.1, MIT Future License', abbreviation FSL-1.1-MIT, Copyright 2008-2025 Functional Software, Inc. dba Sentry. Source-available (non-compete restriction), converts to MIT after 2 years; not an SPDX-registered identifier and not OSI-approved.
codemirror-lang-elixir 4.0.0 UNKNOWN Apache-2.0 published tarball LICENSE file (npm registry) - full Apache License 2.0 text; matches Apache-2.0 declared by later versions
khroma 2.1.0 UNKNOWN MIT published tarball license file (npm registry) - 'The MIT License (MIT)', Copyright (c) 2019-present Fabio Spampinato
lezer-elixir 1.1.2 UNKNOWN Apache-2.0 published tarball LICENSE file (npm registry) - full Apache License 2.0 text; matches Apache-2.0 declared by later versions
map-stream 0.1.0 UNKNOWN MIT published tarball LICENCE file (npm registry) - MIT text, Copyright (c) 2011 Dominic Tarr
memorystream 0.3.1 UNKNOWN MIT extracted from object - npm registry legacy 'licenses' array [{type:'MIT'}]; confirmed by tarball LICENSE file
pause-stream 0.0.11 MIT,Apache2 (MIT OR Apache-2.0) extracted from object - license array ['MIT','Apache2']; tarball LICENSE confirms 'Dual Licensed MIT and Apache 2' ('Apache2' normalized to SPDX Apache-2.0)
posthog-js 1.369.0 SEE LICENSE IN LICENSE (Apache-2.0 AND MIT) published tarball LICENSE file (npm registry) - Apache-2.0 primary plus bundled MIT sections (Sentry, Meta, Expo); matches '(Apache-2.0 AND MIT)' declared by current versions
valid-url 1.0.9 UNKNOWN MIT published tarball LICENSE file (npm registry) - MIT text, Copyright (c) 2013 Odysseas Tsatalos and oDesk Corporation

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread CHANGELOG.md
@brendan-kellam
brendan-kellam merged commit 9fca705 into main Aug 25, 2026
16 checks passed
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