agentHost: fix bugs around message handling#311054
Merged
connor4312 merged 2 commits intomainfrom Apr 17, 2026
Merged
Conversation
- Fix a bug where a sessions were not restored correctly because they had in-progress data (that is the move of the `providedSession.isCompleteObs?.get()`) - Fix a bug where sessions that supported progress streaming would not have sendable messages if they were already complete (that is the addition of `this._pendingRequests.deleteAndDispose(model.sessionResource);`) - Fix a bug in the agent host where we didn't provide `onDidStartServerRequest` consistently which often prevented multi-client messaging from working - DRY up some logic and add tests
connor4312
commented
Apr 17, 2026
Contributor
Screenshot ChangesBase: Changed (7) |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes several edge cases in chat session restoration/cancellation behavior across remote/agent-host sessions, improving reliability of in-progress turn handling and multi-client messaging.
Changes:
- Adjust remote session load logic to avoid creating/sticking pending requests for already-complete sessions and to clean up pending requests on completion.
- Make Agent Host sessions consistently expose an interrupt callback and update observable writes atomically for server-initiated turns.
- Add targeted ChatService tests covering progress-streaming load/cancel/complete scenarios.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts | Adds regression tests for remote-session progress streaming and cancellation behavior. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Refactors remote-session cancellation tracking and ensures pending requests are removed on completion. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Ensures interrupt callback is always present; batches observable updates for server turns; centralizes cancellation dispatch. |
| src/vs/workbench/api/common/extHostChatSessions.ts | Updates input-state RPC to accept undefined session resource components. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 2
osortega
previously approved these changes
Apr 17, 2026
Yoyokrazy
approved these changes
Apr 17, 2026
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.
providedSession.isCompleteObs?.get())this._pendingRequests.deleteAndDispose(model.sessionResource);)onDidStartServerRequestconsistently which often prevented multi-client messaging from working