Skip to content

Support multi-agent agent host session types#309238

Draft
roblourens wants to merge 2 commits intomainfrom
roblou/agent-host-session-types
Draft

Support multi-agent agent host session types#309238
roblourens wants to merge 2 commits intomainfrom
roblou/agent-host-session-types

Conversation

@roblourens
Copy link
Copy Markdown
Member

This draft PR updates local and remote agent host sessions to support agent-specific session types and model routing.

Summary:

  • Derive remote agent host session types from advertised root-state agents instead of hard-coding Copilot.
  • Add local agent host support for multiple root-state agents, including stable existing-session routing and pre-hydration fallback behavior.
  • Align session type labels to show the agent name with the host in square brackets, such as Copilot [Local] and Copilot [My Host].
  • Fix agent-host language model registration ordering so initial model updates are observed.
  • Improve IPC logging so cached root state and later root-state changes are visible in the output channel.

Validation:

  • Focused agent-host/session provider tests passed.
  • Core typecheck passed with 0 errors.

(Written by Copilot)

Copilot AI review requested due to automatic review settings April 12, 2026 00:43
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 12, 2026

Screenshot Changes

Base: 48409a5d Current: f2cdf295

Changed (16)

agentSessionsViewer/CompletedRead/Dark
Before After
before after
agentSessionsViewer/CompletedRead/Light
Before After
before after
agentSessionsViewer/FailedWithoutDuration/Dark
Before After
before after
agentSessionsViewer/FailedWithoutDuration/Light
Before After
before after
agentSessionsViewer/WithFileChangesList/Dark
Before After
before after
agentSessionsViewer/WithFileChangesList/Light
Before After
before after
agentSessionsViewer/WithBadge/Dark
Before After
before after
agentSessionsViewer/WithBadge/Light
Before After
before after
agentSessionsViewer/WithMarkdownBadge/Dark
Before After
before after
agentSessionsViewer/WithMarkdownBadge/Light
Before After
before after
agentSessionsViewer/WithBadgeAndDiff/Dark
Before After
before after
agentSessionsViewer/WithBadgeAndDiff/Light
Before After
before after
agentSessionsViewer/BackgroundProvider/Dark
Before After
before after
agentSessionsViewer/BackgroundProvider/Light
Before After
before after
agentSessionsViewer/ClaudeProvider/Dark
Before After
before after
agentSessionsViewer/ClaudeProvider/Light
Before After
before after

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 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, _selectedModelId is not cleared. Because the rebuilt session has a new id/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

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.

2 participants