Support multi-root Agent Host session metadata - #328863
Merged
DonJayamanne merged 2 commits intoAug 3, 2026
Merged
Conversation
Persist Editor workspace provenance on Agent Host sessions and use it for authoritative multi-root session filtering. Remove the temporary workspace membership memento. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Replaces the temporary workspace membership memento with durable Agent Host multi-root workspace metadata.
Changes:
- Forwards and validates
_meta.multiRootduring session creation. - Persists metadata across forks, restoration, and startup caching.
- Filters Editor sessions by workspace-file identity.
Show a summary per file
| File | Description |
|---|---|
.github/skills/sessions/SKILL.md |
Documents metadata-based filtering. |
src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.ts |
Sends creation metadata. |
src/vs/platform/agentHost/common/agentService.ts |
Adds creation metadata API. |
src/vs/platform/agentHost/common/state/protocol/common/commands.ts |
Adds protocol request metadata. |
src/vs/platform/agentHost/common/state/sessionState.ts |
Defines validated multi-root metadata helpers. |
src/vs/platform/agentHost/node/agentService.ts |
Persists, restores, and inherits metadata. |
src/vs/platform/agentHost/node/protocolServerHandler.ts |
Forwards protocol metadata. |
src/vs/platform/agentHost/test/common/sessionWorkspacelessMeta.test.ts |
Tests metadata validation. |
src/vs/platform/agentHost/test/electron-browser/remoteAgentHostProtocolClient.test.ts |
Tests client forwarding. |
src/vs/platform/agentHost/test/node/agentService.test.ts |
Tests persistence and restoration. |
src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts |
Tests server forwarding. |
src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md |
Documents persistence behavior. |
src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts |
Preserves metadata in startup cache. |
src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts |
Adds cache coverage. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts |
Adds metadata to direct creation. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListStore.ts |
Uses workspace-file filtering. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.ts |
Creates Editor workspace metadata. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostWorkspaceSessionMembershipStore.ts |
Removes the membership memento. |
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts |
Updates filtering and creation tests. |
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostUntitledProvisionalSessionService.test.ts |
Tests provisional metadata paths. |
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostWorkspaceSessionMembershipStore.test.ts |
Removes obsolete memento tests. |
Review details
- Files reviewed: 21/21 changed files
- Comments generated: 3
- Review effort level: Balanced
Apply workspace-file filtering across folder-count transitions, sanitize provider metadata before database fallbacks, and exercise cache deserialization in tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Review details
Suppressed comments (2)
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.ts:306
- This folder-count gate drops provenance for sessions created after a
.code-workspaceis reduced to one (or zero) folders.WorkbenchState.WORKSPACEis determined by the presence ofworkspace.configuration, not by folder count (configurationService.ts:184-192), so those are still workspace-file sessions; unlike sessions created before the folder change, they fall back to path filtering and can disappear when folders change again. Remove the folder-count condition and key this metadata solely on the workspace-file identity.
|| workspace.folders.length < 2
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListStore.ts:377
extUriBiasedIgnorePathCasetreats every non-filescheme as case-insensitive (resources.ts:340-343). For the remote workspace URIs this feature explicitly supports, two distinct case-sensitive paths such as/work/Demo.code-workspaceand/work/demo.code-workspacetherefore compare equal and expose the wrong workspace's sessions. InjectIUriIdentityServiceand compare with its provider-awareextUri.isEqualinstead.
&& extUriBiasedIgnorePathCase.isEqual(URI.parse(multiRoot.workspaceFile), workspace.configuration);
- Files reviewed: 21/21 changed files
- Comments generated: 0 new
- Review effort level: Balanced
DonJayamanne
marked this pull request as ready for review
August 3, 2026 23:29
DonJayamanne
enabled auto-merge (squash)
August 3, 2026 23:29
justschen
approved these changes
Aug 3, 2026
DonJayamanne
deleted the
don/agents/agents-window-multi-root-support-study
branch
August 3, 2026 23:52
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.
Summary
The corresponding Agent Host Protocol request metadata change was merged in microsoft/agent-host-protocol#379. This PR intentionally does not update
.ahp-version: a full sync from current AHP main also includes unrelated protocol 0.8 changes that require a separate referencedToolInputadoption.Out of scope
Agents Window workspace grouping and disabling the workspace-section
+action will be handled in a separate PR.Validation
npm run typecheck-clientnpm run valid-layers-checknpm run precommitnpm test, Rust clippy, andcargo test --workspace