agentHost: Restore selected model across sessions#309331
Merged
roblourens merged 4 commits intomainfrom Apr 13, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores the selected language model across agent-host-backed session surfaces by propagating model metadata end-to-end (agent host session summaries → protocol list responses → sessions providers → restored chat history), and by shifting model selection ownership from the picker to the sessions/providers.
Changes:
- Add
modelmetadata to agent-host session metadata, protocollistSessionsoutput, and session create/fork/restore flows. - Plumb restored model ids into chat session request history so the chat widget’s model picker can restore selection via existing chat input state mechanisms.
- Add/extend unit and integration tests covering model propagation (local/remote providers + WebSocket protocol integration).
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts | Adds coverage ensuring restored request history includes modelId. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts | Extends history restoration to attach modelId to request items. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Threads model id into restored history and into fork creation path; adds helper to normalize model ids. |
| src/vs/sessions/contrib/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts | Adds tests for model metadata on list/notifications and model-change action handling. |
| src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts | Surfaces session model as observable state; adds setModel and handles SessionModelChanged. |
| src/vs/sessions/contrib/localAgentHost/test/browser/localAgentHostSessionsProvider.test.ts | Adds tests for local provider model propagation and SessionModelChanged handling. |
| src/vs/sessions/contrib/localAgentHost/browser/localAgentHostSessionsProvider.ts | Surfaces session model as observable state; adds setModel and handles SessionModelChanged. |
| src/vs/sessions/contrib/copilotChatSessions/browser/copilotChatSessionsActions.ts | Removes picker-owned storage and drives picker selection from active session’s modelId. |
| src/vs/platform/agentHost/test/node/protocol/sessionFeatures.integrationTest.ts | Adds WebSocket integration test asserting model flows through create/subscribe/list/modelChanged. |
| src/vs/platform/agentHost/node/protocolServerHandler.ts | Includes model in protocol listSessions responses. |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Adds model persistence/restore into session listing and resume/recreate flows. |
| src/vs/platform/agentHost/node/agentService.ts | Ensures live session state model is reflected in metadata and session summaries. |
| src/vs/platform/agentHost/common/agentService.ts | Extends IAgentSessionMetadata to include optional model. |
Copilot's findings
- Files reviewed: 13/13 changed files
- Comments generated: 3
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts
Outdated
Show resolved
Hide resolved
src/vs/sessions/contrib/copilotChatSessions/browser/copilotChatSessionsActions.ts
Show resolved
Hide resolved
Contributor
zhichli
approved these changes
Apr 13, 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.
Restores the selected model across agent-host session surfaces by carrying model metadata through backend session summaries, websocket list responses, local/remote session providers, and restored chat history.
Summary:
Validation:
session model flows through create, subscribe, listSessions, and modelChangedpassed.npm run valid-layers-checkpassed.(Written by Copilot)