chat: sync agent host pending messages across clients#327420
Merged
Conversation
- Queued and steering messages were only published from the local chat model, so other connected editors and agent windows could not display server-side changes. - Attaching an empty local model could incorrectly remove messages already queued by another client. Reconciliation now treats protocol state as authoritative while remaining atomic and idempotent. - Preserving protocol ids, attachments, deferred cleanup, and yield state keeps queue behavior consistent across clients without re-entrancy guards. - Adds coverage for cross-client additions, initial hydration, atomic updates, and no-op synchronization. (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
connor4312
enabled auto-merge (squash)
July 24, 2026 23:32
joshspicer
approved these changes
Jul 24, 2026
dmitrivMS
approved these changes
Jul 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Enables cross-client synchronization of pending (queued/steering) chat messages by treating protocol state as authoritative and reconciling local chat models atomically, with added test coverage for hydration and no-op updates.
Changes:
- Added
IRemotePendingRequestand a newIChatService.syncPendingRequestsFromRemoteAPI for atomic reconciliation. - Implemented pending-request reconciliation in
ChatServiceand addedChatModel.replacePendingRequeststo apply the reconciled queue. - Added tests covering cross-client pending message projection, initial hydration, atomic emission/no-op behavior, and reorder/add/remove semantics.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts | Updates mock to implement new remote-pending sync API. |
| src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts | Adds unit tests for remote pending request reconciliation behavior. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Adds integration-style tests for agent host projection/hydration of remote pending messages. |
| src/vs/workbench/contrib/chat/common/model/chatModel.ts | Adds replacePendingRequests to atomically replace the queue and fire a single change event. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Implements reconciliation logic, id preservation, and deferred completion for removed requests. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Introduces IRemotePendingRequest and extends IChatService with syncPendingRequestsFromRemote. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Synchronizes pending messages bidirectionally between protocol and chat model; hydrates before outbound diff. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 4
- Review effort level: Low
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Commit message generated by Copilot)
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com