Skip to content

fix(sessions): cap transcript payloads to stop renderer OOM - #3778

Closed
charlesvien wants to merge 3 commits into
mainfrom
fix/renderer-crash-loop-recovery
Closed

fix(sessions): cap transcript payloads to stop renderer OOM#3778
charlesvien wants to merge 3 commits into
mainfrom
fix/renderer-crash-loop-recovery

Conversation

@charlesvien

@charlesvien charlesvien commented Jul 24, 2026

Copy link
Copy Markdown
Member

Problem

Opening a task with a huge session transcript OOMs the renderer (V8 "young object promotion failed") and the app crash-loops on that route. A user hit this 46 times on one task across three app versions. Transcript entries are loaded at full fidelity: whole-file tool outputs, diffs, terminal dumps and pasted media all stay uncapped in renderer heap, and resume chains fetch and stringify two full transcripts.

Changes

  • New capStoredEntryPayloads bounds every stored transcript entry at acquisition: strings inside tool rawInput/rawOutput/_meta and diff old/new text truncate at 100k chars with a marker (structure preserved so tool views still render), text blocks truncate the same way, and media blocks over 10M chars become a text placeholder instead of a broken truncated base64 blob.
  • Applied at all entry acquisition points so downstream comparisons (resume overlap detection, hydration hashes) see identical shapes: local/S3 log parse, the cloud hydration fetches, cloud watcher pages and the SSE stream.
  • Diagnostics so the next report pinpoints itself: a renderer heap watchdog logs each upward 512MB heap crossing with the active route (lands in the chromium log tail attached to crash events), and session loads log entry counts and content sizes.

How did you test this?

  • New vitest coverage: sessionEntryCaps.test.ts (19 cases) and useRendererHeapWatchdog.test.ts.
  • Full @posthog/core (2508) and @posthog/ui (2021) suites, typecheck on code, @posthog/core and @posthog/ui, biome lint packages/core with zero noRestrictedImports.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@trunk-io

trunk-io Bot commented Jul 24, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 0438991.

@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "log transcript sizes when loading sessio..." | Re-trigger Greptile

@charlesvien
charlesvien force-pushed the fix/renderer-crash-loop-recovery branch from 6fb915c to 0438991 Compare July 24, 2026 01:19
@charlesvien charlesvien changed the title fix(code): break renderer crash loop on repeat same-route crashes fix(sessions): cap transcript payloads to stop renderer OOM Jul 24, 2026
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