Skip to content

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

Draft
roomote[bot] wants to merge 1 commit into
mainfrom
fix/chat-transcript-memory-10ds8iy2mzhqo
Draft

[Fix] Chat window runs out of memory when transcript grows large#153
roomote[bot] wants to merge 1 commit into
mainfrom
fix/chat-transcript-memory-10ds8iy2mzhqo

Conversation

@roomote
Copy link
Copy Markdown
Contributor

@roomote roomote Bot commented May 16, 2026

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
Copy link
Copy Markdown
Contributor Author

roomote Bot commented May 16, 2026

3 items outstanding: 1 code finding and 2 checks still pending. 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
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@taltas
Copy link
Copy Markdown
Contributor

taltas commented May 17, 2026

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

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.

1 participant