Skip to content

[Fix] Chat window runs out of memory when transcript grows large#153

Merged
edelauna merged 4 commits into
mainfrom
fix/chat-transcript-memory-10ds8iy2mzhqo
Jun 12, 2026
Merged

[Fix] Chat window runs out of memory when transcript grows large#153
edelauna merged 4 commits into
mainfrom
fix/chat-transcript-memory-10ds8iy2mzhqo

Conversation

@roomote

@roomote roomote Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Toray Altas. View the task or mention @roomote for follow-up asks.

What problem this solves

Fixes an issue where users can hit heavy memory pressure in the chat window as long transcripts grow, which can eventually leave the UI in a gray-screen failure state.

Why this change was made

The chat list was already using react-virtuoso, but it was still pre-rendering a large amount of off-screen transcript content. This change tightens the off-screen render buffer, gives the virtualized list a stable item key, and provides a default row height so large transcripts keep less rich content mounted outside the viewport.

User impact

Large chat transcripts keep less text and markdown mounted when they are off screen. That should lower memory usage in long-running sessions and reduce the chances of the gray-screen failure when the transcript gets large.

@roomote roomote Bot added the roomote:auto-resolve-conflicts Allow Roomote to auto-resolve merge conflicts for this PR label May 16, 2026
@roomote roomote Bot assigned taltas May 16, 2026
@roomote roomote Bot added the roomote:auto-resolve-conflicts Allow Roomote to auto-resolve merge conflicts for this PR label May 16, 2026
@roomote

roomote Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

1 item outstanding: 1 code finding. Action required. See task

  • computeItemKey uses ts as the entire row key even though identical-timestamp transcripts are supported, so Virtuoso can merge distinct rows.
  • CI still pending after the review wait cap: platform-unit-test (ubuntu-latest)
  • CI still pending after the review wait cap: platform-unit-test (windows-latest)

],
)

const computeMessageKey = useCallback((_index: number, messageOrGroup: ClineMessage) => messageOrGroup.ts, [])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ts is not unique in this codebase, so using it as the sole Virtuoso item key will collide on supported histories. We already have coverage for identical-timestamp transcripts in src/core/webview/__tests__/ClineProvider.spec.ts, and when that data hits this list React will reuse a row for multiple messages instead of keeping them distinct.

@codecov

codecov Bot commented May 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.54839% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/core/webview/ClineProvider.ts 88.88% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@taltas

taltas commented May 17, 2026

Copy link
Copy Markdown
Contributor

Do not merge this PR, it's not ready for review, the bug needs to be replicated and then tested with this pr

@edelauna edelauna force-pushed the fix/chat-transcript-memory-10ds8iy2mzhqo branch from e0b66b7 to 2075784 Compare June 12, 2026 02:26
@edelauna edelauna marked this pull request as ready for review June 12, 2026 03:22

@edelauna edelauna left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shrinking view size, also adding diagnostic message to help identify stack size, will add in testing script as part of resolving issue #515

@edelauna edelauna added this pull request to the merge queue Jun 12, 2026
Merged via the queue into main with commit ed868c6 Jun 12, 2026
17 checks passed
@edelauna edelauna deleted the fix/chat-transcript-memory-10ds8iy2mzhqo branch June 12, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

roomote:auto-resolve-conflicts Allow Roomote to auto-resolve merge conflicts for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants