Skip to content

chat: unify history in different editors#278846

Merged
connor4312 merged 2 commits intomainfrom
connor4312/unified-chat-history
Nov 21, 2025
Merged

chat: unify history in different editors#278846
connor4312 merged 2 commits intomainfrom
connor4312/unified-chat-history

Conversation

@connor4312
Copy link
Member

Previously history was read and updated individually by chat components,
which could cause some history to get lost if multiple chat editors
were open.

This adds a ChatHistoryNavigator which is a view on the chat history.
It reacts when new entries are appended, preserving the history position
of other editors while allowing editor-local modifications via its
'overlay' (which is also used to keep the current in-progress edit
when navigating back in history).

Also brings back _getFilteredEntry which was lost in my earlier refactor.

Refs #277318

cc @TylerLeonhardt please let me know if you see any more issues
after this is in :)

Copilot AI review requested due to automatic review settings November 21, 2025 19:25
@connor4312 connor4312 enabled auto-merge (squash) November 21, 2025 19:25
@connor4312 connor4312 self-assigned this Nov 21, 2025
Previously history was read and updated individually by chat components,
which could cause some history to get lost if multiple chat editors
were open.

This adds a ChatHistoryNavigator which is a view on the chat history.
It reacts when new entries are appended, preserving the history position
of other editors while allowing editor-local modifications via its
'overlay' (which is also used to keep the current in-progress edit
when navigating back in history).

Also brings back _getFilteredEntry which was lost in my earlier refactor.

Refs #277318
@connor4312 connor4312 force-pushed the connor4312/unified-chat-history branch from 74b7bc9 to 44ead28 Compare November 21, 2025 19:26
@vs-code-engineering
Copy link

vs-code-engineering bot commented Nov 21, 2025

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatInputPart.ts
  • src/vs/workbench/contrib/chat/browser/chatWidget.ts

dmitrivMS
dmitrivMS previously approved these changes Nov 21, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors chat history management to centralize it in a unified service, addressing issues where history could be lost when multiple chat editors were open. Previously, each chat component managed its own history independently, leading to synchronization problems.

Key changes:

  • Introduced ChatHistoryNavigator as a view on the centralized chat history with support for editor-local modifications via an overlay mechanism
  • Migrated from HistoryNavigator2 to a custom navigation implementation that supports concurrent navigators
  • Added comprehensive test coverage for both ChatWidgetHistoryService and ChatHistoryNavigator

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/vs/workbench/contrib/chat/test/common/chatWidgetHistoryService.test.ts Comprehensive test suite for the new history service and navigator with 413 lines covering navigation, overlay, concurrent navigators, and history limits
src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.ts Added ChatHistoryNavigator class and refactored ChatWidgetHistoryService to use events and lazy persistence via onWillSaveState
src/vs/workbench/contrib/chat/browser/chatInputPart.ts Simplified history management by replacing direct HistoryNavigator2 usage with ChatHistoryNavigator, removed manual saveState calls, restored _getFilteredEntry to filter image values from history
src/vs/workbench/contrib/chat/browser/chatWidget.ts Removed now-unnecessary saveState calls since history is auto-saved via the service's event handler

roblourens
roblourens previously approved these changes Nov 21, 2025
@connor4312 connor4312 disabled auto-merge November 21, 2025 19:46
@connor4312 connor4312 dismissed stale reviews from roblourens and dmitrivMS via 2db1638 November 21, 2025 19:50
@connor4312 connor4312 enabled auto-merge November 21, 2025 19:51
@connor4312 connor4312 mentioned this pull request Nov 21, 2025
21 tasks
@connor4312 connor4312 merged commit c953458 into main Nov 21, 2025
28 checks passed
@connor4312 connor4312 deleted the connor4312/unified-chat-history branch November 21, 2025 20:14
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants