Skip to content

chat: sync queued agent host messages - #315130

Merged
Connor Peet (connor4312) merged 1 commit into
mainfrom
connor4312/314824
May 8, 2026
Merged

Connor Peet (connor4312) merged 1 commit into
mainfrom
connor4312/314824

Conversation

@connor4312

Copy link
Copy Markdown
Member

chat: sync queued agent host messages

Ensures agent host sessions keep chat-model pending requests synchronized when an existing session is restored while a turn is already active.

  • Starts pending-message sync for restored agent-host sessions, including when the chat model is created after session content is provided.
  • Treats same-id steering and queued pending-message text changes as protocol upserts so edited pending requests are sent to the backend.
  • Adds regression coverage for restored active sessions and queued pending-message text updates.

Fixes #314824

(Commit message generated by Copilot)

Ensures agent host sessions keep chat-model pending requests synchronized when an existing session is restored while a turn is already active.

- Starts pending-message sync for restored agent-host sessions, including when the chat model is created after session content is provided.
- Treats same-id steering and queued pending-message text changes as protocol upserts so edited pending requests are sent to the backend.
- Adds regression coverage for restored active sessions and queued pending-message text updates.

Fixes #314824

(Commit message generated by Copilot)
Copilot AI review requested due to automatic review settings May 7, 2026 23:24
@connor4312
Connor Peet (connor4312) enabled auto-merge (squash) May 7, 2026 23:24

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

This PR fixes agent-host session restore behavior so chat-model pending (queued/steering) requests stay synchronized with the agent host protocol state when restoring a session that already has an active turn.

Changes:

  • Start pending-message synchronization for restored agent-host sessions (including when the chat model is created after session content is provided).
  • Treat same-id steering and queued pending-message text changes as upserts so edited pending requests are re-sent to the backend.
  • Add regression tests for restored active sessions and queued pending-message text updates.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts Wires pending-message sync on restore, treats text updates as upserts, and subscribes to model creation when needed.
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts Adds tests covering restored active sessions and queued pending-message text update synchronization.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

// --- Steering ---
if (currentSteering) {
if (currentSteering.id !== prevSteering?.id) {
if (currentSteering.id !== prevSteering?.id || currentSteering.text !== prevSteering.userMessage.text) {
Comment on lines +2391 to +2398

this._pendingMessageSubscriptions.set(sessionResource, this._chatService.onDidCreateModel(model => {
if (!isEqual(model.sessionResource, sessionResource)) {
return;
}
this._pendingMessageSubscriptions.deleteAndDispose(sessionResource);
this._ensurePendingMessageSubscription(sessionResource, backendSession);
}));
@connor4312
Connor Peet (connor4312) merged commit 6537e5e into main May 8, 2026
30 checks passed
@connor4312
Connor Peet (connor4312) deleted the connor4312/314824 branch May 8, 2026 02:08
@vs-code-engineering vs-code-engineering Bot added this to the 1.120.0 milestone May 8, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Jun 22, 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.

AgentHost: Queued messages not actually sent

3 participants