Skip to content

[Improve] Reduce chat memory retained during long sessions - #1466

Draft
zoomote[bot] wants to merge 1 commit into
mainfrom
feature/webview-memory-optimization-0lkgswz0njjgl
Draft

[Improve] Reduce chat memory retained during long sessions#1466
zoomote[bot] wants to merge 1 commit into
mainfrom
feature/webview-memory-optimization-0lkgswz0njjgl

Conversation

@zoomote

@zoomote zoomote Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

​Opened on behalf of @taltas. Follow up by mentioning @roomote, in the web UI, or in Discord.

What changed

  • Intern repeated strings in completed chat messages and task history to reduce duplicate webview allocations during streaming and state broadcasts.
  • Scope message caches to the active task, skip transient partial messages and rejected stale updates, and clear retained message strings on explicit task transitions.
  • Remount the chat tree between tasks and remount message rows when they transition from partial to complete.
  • Add focused coverage for recursive interning, cache lifecycle and stale updates, task-level chat remounts, and virtualized row keys.

Why this change was made

Long-running webview sessions repeatedly deserialize the same message and history strings, while old React closures can retain prior task state. This implements the linked optimization proof of concept with stricter lifecycle handling and regression coverage suitable for production.

Impact

Chat behavior and appearance are unchanged. The webview can release prior-task message data more reliably and avoid retaining duplicate completed-message and history strings, reducing memory pressure during long sessions.

@zoomote zoomote Bot assigned taltas Aug 31, 2026
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Review process

This PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging.

  1. Required CI checks pass.
  2. The workflow starts CodeRabbit automatically.
  3. For eligible human-authored PRs, CodeRabbit reviews and approves the latest commit.
  4. A human maintainer reviews and approves after CodeRabbit.

Current step: Resolve the merge conflicts. The review sequence resumes after the branch is mergeable.

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.37931% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
webview-ui/src/context/ExtensionStateContext.tsx 83.33% 4 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added has-conflicts PR has merge conflicts with the base branch and removed has-conflicts PR has merge conflicts with the base branch labels Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has-conflicts PR has merge conflicts with the base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant