Support multi-agent agent host session types#309238
Draft
roblourens wants to merge 2 commits intomainfrom
Draft
Conversation
(Written by Copilot)
Contributor
Screenshot ChangesBase: Changed (16) |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the agent-host-backed sessions (local + remote) to support multiple agents per host by deriving session types dynamically from each host’s advertised rootState.agents, and by aligning session-type IDs/labels so chat routing + model routing stay consistent across boundaries.
Changes:
- Derive remote agent-host session types from
rootState.agents(no longer hard-coded to Copilot), and introduce a shared helper to pin the remote session-type wire format. - Add local agent-host support for multiple advertised agents, including contribution-based fallback before root state hydration and stable routing for existing sessions.
- Wire session-type updates through the sessions layer (
ISessionsProvider.onDidChangeSessionTypes→ management service → session type picker), plus fix language model registration ordering so initial model updates are observed.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/loggingAgentConnection.ts | Improves IPC logging to include cached root state and root-state change events. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.ts | Fixes model provider registration ordering so initial model updates are not missed. |
| src/vs/sessions/SESSIONS_PROVIDER.md | Updates documentation to reflect per-host providers and dynamic session types derived from rootState.agents. |
| src/vs/sessions/services/sessions/common/sessionsProvider.ts | Adds optional onDidChangeSessionTypes for providers with dynamic session types. |
| src/vs/sessions/services/sessions/browser/sessionsManagementService.ts | Subscribes to provider session-type changes and updates the global session-type list accordingly. |
| src/vs/sessions/contrib/remoteAgentHost/test/common/remoteAgentHostSessionType.test.ts | Adds tests pinning the remote session-type ID wire format. |
| src/vs/sessions/contrib/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts | Expands coverage for dynamic agent discovery, session typing, and pending-session type switching. |
| src/vs/sessions/contrib/remoteAgentHost/common/remoteAgentHostSessionType.ts | Introduces remoteAgentHostSessionTypeId(...) helper to unify routing across boundaries. |
| src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts | Implements dynamic session types from root state and supports changing type for pending sessions. |
| src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHost.contribution.ts | Registers per-agent contributions/providers for any advertised agent (not just Copilot). |
| src/vs/sessions/contrib/localAgentHost/test/browser/localAgentHostSessionsProvider.test.ts | Adds coverage for local multi-agent typing, hydration fallback, and pending-session type switching. |
| src/vs/sessions/contrib/localAgentHost/browser/localAgentHostSessionsProvider.ts | Implements local multi-agent session typing with contribution fallback + stable handling for existing sessions. |
| src/vs/sessions/contrib/chat/browser/sessionTypePicker.ts | Refreshes the picker when providers change session types at runtime; merges “supported types” with provider list. |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Aligns Copilot agent display name with the new session-type labeling conventions. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts:547
- When rebuilding the pending new session in
setSessionType,_selectedModelIdis not cleared. Because the rebuilt session has a newid/resource, any previously selected model will carry over to the new agent type and may be invalid for that agent. Clear/reset the pending session’s selected model when the session type changes.
const rebuilt = this._buildNewSessionData(workspace, newType);
this._currentNewSession = rebuilt.data;
this._currentNewSessionStatus = rebuilt.status;
const fromSession = this._chatToSession(prev);
const toSession = this._chatToSession(rebuilt.data);
this._onDidReplaceSession.fire({ from: fromSession, to: toSession });
return toSession;
- Files reviewed: 14/14 changed files
- Comments generated: 3
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts
Show resolved
Hide resolved
src/vs/sessions/contrib/localAgentHost/browser/localAgentHostSessionsProvider.ts
Show resolved
Hide resolved
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHost.contribution.ts
Outdated
Show resolved
Hide resolved
(Written by Copilot)
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.
This draft PR updates local and remote agent host sessions to support agent-specific session types and model routing.
Summary:
Copilot [Local]andCopilot [My Host].Validation:
(Written by Copilot)