Skip to content

agentHost: Restore selected model across sessions#309331

Merged
roblourens merged 4 commits intomainfrom
roblou/agent-host-model-restore
Apr 13, 2026
Merged

agentHost: Restore selected model across sessions#309331
roblourens merged 4 commits intomainfrom
roblou/agent-host-model-restore

Conversation

@roblourens
Copy link
Copy Markdown
Member

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:

  • Add model metadata to agent-host session list/create/fork/restore paths.
  • Remove picker-owned model storage so model state is owned by sessions/providers.
  • Propagate restored model ids into chat history so the chat widget model picker restores through existing chat input state.
  • Add provider unit coverage and a websocket protocol integration test for model summary propagation.

Validation:

  • Focused unit tests: 154 passed.
  • Targeted websocket integration: session model flows through create, subscribe, listSessions, and modelChanged passed.
  • Core Typecheck latest: 0 errors.
  • Direct hygiene on touched files passed.
  • npm run valid-layers-check passed.

(Written by Copilot)

Copilot AI review requested due to automatic review settings April 13, 2026 00:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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 model metadata to agent-host session metadata, protocol listSessions output, 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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

Screenshot Changes

Base: 689454c4 Current: 6eb8fde2

Changed (2)

editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after
agentSessionsViewer/ApprovalRowLongLabel/Dark
Before After
before after

@roblourens roblourens marked this pull request as ready for review April 13, 2026 16:26
@roblourens roblourens enabled auto-merge (squash) April 13, 2026 16:26
@roblourens roblourens merged commit 985aca6 into main Apr 13, 2026
26 checks passed
@roblourens roblourens deleted the roblou/agent-host-model-restore branch April 13, 2026 17:31
@vs-code-engineering vs-code-engineering bot added this to the 1.117.0 milestone Apr 13, 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.

3 participants