Skip to content

chat: sync agent host pending messages across clients#327420

Merged
connor4312 merged 1 commit into
mainfrom
connor4312/sync-agent-host-pending-messages
Jul 25, 2026
Merged

chat: sync agent host pending messages across clients#327420
connor4312 merged 1 commit into
mainfrom
connor4312/sync-agent-host-pending-messages

Conversation

@connor4312

Copy link
Copy Markdown
Member
  • 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

- 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>
Copilot AI review requested due to automatic review settings July 24, 2026 23:32
@connor4312
connor4312 enabled auto-merge (squash) July 24, 2026 23:32

Copilot AI 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.

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 IRemotePendingRequest and a new IChatService.syncPendingRequestsFromRemote API for atomic reconciliation.
  • Implemented pending-request reconciliation in ChatService and added ChatModel.replacePendingRequests to 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

Comment thread src/vs/workbench/contrib/chat/common/model/chatModel.ts
@connor4312
connor4312 merged commit 07b058a into main Jul 25, 2026
30 checks passed
@connor4312
connor4312 deleted the connor4312/sync-agent-host-pending-messages branch July 25, 2026 00:01
@vs-code-engineering vs-code-engineering Bot added this to the 1.131.0 milestone Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants