Skip to content

sessions: show the Changes of a chat in several repositories per repository - #350808

Merged
Sandeep Somavarapu (sandy081) merged 17 commits into
mainfrom
sandy081/agents/workspaces-11-changes-per-repo
Nov 28, 2026
Merged

Sandeep Somavarapu (sandy081) merged 17 commits into
mainfrom
sandy081/agents/workspaces-11-changes-per-repo

Conversation

@sandy081

@sandy081 Sandeep Somavarapu (sandy081) commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

What: When a chat works in several folders or repositories, the Changes view and editor group its changes by repository: a row for each repository with its name and branch, then its files. A Repository picker in the Changes header shows all repositories or one, whose own Branch changes, actions, pull request and Agent Merge the Changes then offer.

Changes:

  • ChangesViewService groups a chat's changes by repository (groupByRepository, folder failures) and keeps a repository selection per chat; ChangesViewPane builds the repository rows.
  • ChangesRepositoryPicker in the Changes view and editor headers (Agents window; desktop and web), gated on ChatContextKeys.enabled and ChangesHasRepositoriesContext.
  • The agent host provider gives a repository its own Branch changeset (getRepositoryChangeset) and Agent Merge folder, only for hosts that serve folder scopes (servesFolderScopes: the local agent host of this build) and record the session's folders.
  • ISessionAgentMergeService owns the per-session, per-chat and per-repository Agent Merge observables that were cached in module state.
  • Session action context key binders are classes with injected services; the Changes editor actions resolve their services in run.
  • The selected repository's pull request drives the Checks rows, the CI context keys and Fix Checks (IGitHubService.getSessionPullRequest(session, repositoryObs)). IGitHubService.keepSessionPullRequestCurrent refreshes and polls it, also a pull request known only from repository metadata, for the main window's and each scoped Changes' selection.
  • Agent host repository records carry their GitHub info, and the Repository picker updates its failure rows while open.
  • Agent Merge is offered for a picked repository only where its host serves that repository's scope (IAgentHostSessionsProvider.supportsRepositoryAgentMerge); Agent Merge and Fix Checks act on the chat of the Changes header they run from.
  • The Changes header of several repositories shows no base branch; that of a picked repository describes its own changeset.

Notes for reviewers:

  • Rebased onto main after Agents window: sessions of several folders in the agent host provider #350785 (PR8) and Agent host: Agent Merge per repository #350649 (PR11a) merged.
  • Known limit: the host records a base branch only for a session's first folder, so a picked additional folder's Branch Changes show no target branch, and Commit is not offered for it.
  • Known limit: remote, Dev Container and cloud hosts keep the chats' changes for sessions of several folders, also when new enough to serve folder scopes, as no host advertises that support yet. Remote hosts keep one folder today (PR8). A follow-up can replace servesFolderScopes with a host-advertised capability.

Validation:

  • pnpm run typecheck-client: passed
  • ./scripts/test.sh --run over every test of sessions/contrib/{changes,chatWindow,providers/agentHost,providers/remoteAgentHost,sessions,chat,github,layout,codeReview}, sessions/services, workbench/contrib/{sessionChanges,sessions}, workbench/services/sessions and platform/agentHost/test/node (433 files): 11,856 passing, 0 failing
  • npx component-explorer render (all fixtures): rendered without errors; Playwright fixture tests: 99 passed
  • New tests fail against the code before their change
  • node build/oxlint.ts on the changed files, pnpm run valid-layers-check, node build/next/checkMobileBoundary.ts: passed

Written by GitHub Copilot on behalf of Sandeep Somavarapu (@sandy081)

@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.149.0 milestone Nov 28, 2026
Base automatically changed from sandy081/agents/workspaces-08-client-provider to main November 28, 2026 00:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

CI state and Fix Checks still target the session’s first repository rather than the selected one, causing repair prompts to address the wrong pull request.

3 open issues
What changed in this PR

Adds repository-based grouping and selection to chat Changes views and editors, building on multi-folder sessions and per-repository Agent Merge support.

Changes:

  • Groups changed files by repository, showing branch names and folder failures, with a repository picker in Changes headers.
  • Routes repository-specific operations through folder-scoped changesets and moves Agent Merge observables into an injected service.
  • Extends provider contracts, accessibility guidance, fixtures, and tests for multi-repository workflows.
File Description
src/​vs/​workbench/​test/​browser/​componentFixtures/​sessions/​changesRepositoryPicker.fixture.ts Adds repository-picker visual fixtures.
src/​vs/​workbench/​services/​sessions/​common/​session.ts Defines repositories, folder failures, and repository changesets.
src/​vs/​workbench/​contrib/​sessions/​test/​common/​agentHostSessionWorkspace.test.ts Tests repository Git-state workspace invalidation.
src/​vs/​workbench/​contrib/​sessions/​test/​browser/​sessionInputBanners/​sessionInputBanners.test.ts Updates banner tests for service injection.
src/​vs/​workbench/​contrib/​sessions/​test/​browser/​sessionAgentMerge.test.ts Tests service-owned Agent Merge caching.
src/​vs/​workbench/​contrib/​sessions/​test/​browser/​blockedSessions.test.ts Updates blocked-session service setup.
src/​vs/​workbench/​contrib/​sessions/​providers/​remoteAgentHost/​browser/​remoteAgentHostSessionsProvider.ts Checks resource ownership against the remote host.
src/​vs/​workbench/​contrib/​sessions/​providers/​agentHost/​browser/​localAgentHostSessionsProviderRegistration.ts Registers multi-folder session creation resolution.
src/​vs/​workbench/​contrib/​sessions/​providers/​agentHost/​browser/​localAgentHostSessionsProvider.ts Advertises local folder-scope support.
src/​vs/​workbench/​contrib/​sessions/​providers/​agentHost/​browser/​agentHostSessionFolders.ts Maps folder metadata, repositories, and failures.
src/​vs/​workbench/​contrib/​sessions/​providers/​agentHost/​browser/​agentHostSessionChangesets.ts Exposes changeset folder failures.
src/​vs/​workbench/​contrib/​sessions/​common/​sessionsProvider.ts Clarifies workspace-detachment documentation.
src/​vs/​workbench/​contrib/​sessions/​common/​changesViewService.ts Adds repository-selection and grouping contracts.
src/​vs/​workbench/​contrib/​sessions/​common/​changesRepositories.ts Defines repository grouping models.
src/​vs/​workbench/​contrib/​sessions/​common/​agentHostSessionWorkspace.ts Includes repository state in workspace identity.
src/​vs/​workbench/​contrib/​sessions/​common/​agentHostSessionsProvider.ts Adds repository targets to Agent Merge APIs.
src/​vs/​workbench/​contrib/​sessions/​browser/​views/​sessionsListRenderers.ts Uses the injected Agent Merge service.
src/​vs/​workbench/​contrib/​sessions/​browser/​views/​sessionsList.ts Supplies Agent Merge state through the service.
src/​vs/​workbench/​contrib/​sessions/​browser/​views/​sessionsFlatList.ts Passes the service to session renderers.
src/​vs/​workbench/​contrib/​sessions/​browser/​sessionInputBanners/​sessionInputBanners.ts Injects the Agent Merge service into banners.
src/​vs/​workbench/​contrib/​sessions/​browser/​sessionInputBanners/​sessionInputBannerModel.ts Reads chat configuration through the service.
src/​vs/​workbench/​contrib/​sessions/​browser/​chatEditor/​sessionChatEditorHost.ts Uses service-backed chat status configuration.
src/​vs/​workbench/​contrib/​sessions/​browser/​blockedSessions.ts Reads Agent Merge configuration through the service.
src/​vs/​workbench/​contrib/​sessions/​browser/​agentsView/​agentsChatPart.ts Updates chat-host service wiring.
src/​vs/​workbench/​contrib/​sessionChanges/​browser/​sessionsChangesAccessibilityHelp.ts Explains repository grouping and selection.
src/​vs/​workbench/​contrib/​sessionChanges/​browser/​sessionChanges.contribution.ts Registers the workbench repository picker.
src/​vs/​workbench/​contrib/​sessionChanges/​browser/​sessionActionContextKeys.ts Adds injectable binders and repository operation context.
src/​vs/​workbench/​contrib/​sessionChanges/​browser/​media/​changesView.css Styles picker labels and repository failures.
src/​vs/​workbench/​contrib/​sessionChanges/​browser/​changesViewRenderer.ts Renders repository roots, branches, and failures.
src/​vs/​workbench/​contrib/​sessionChanges/​browser/​changesView.ts Builds repository groups and scopes header operations.
src/​vs/​workbench/​contrib/​sessionChanges/​browser/​changesRepositoryPicker.ts Implements the repository picker and header integration.
src/​vs/​workbench/​contrib/​sessionChanges/​browser/​changesEditorActions.ts Resolves action services and repository operation targets.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostChatContribution.test.ts Tests multi-folder creation and trust checks.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionWorkingDirectoryResolver.ts Adds session-creation metadata resolution.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionHandler.ts Applies multi-folder creation data before first send.
src/​vs/​sessions/​SESSIONS.md Documents repository-specific Changes behavior.
src/​vs/​sessions/​sessions.common.main.ts Loads the Agents-window picker contribution.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsListTestUtils.ts Adds Agent Merge service test wiring.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​test/​browser/​remoteAgentHostSessionsProvider.test.ts Tests remote scope fallback and workspace ownership.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​agentMergeActions.test.ts Tests repository-targeted Agent Merge actions.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​agentHostSessionFolders.test.ts Tests folder metadata and URI mapping.
src/​vs/​sessions/​contrib/​chatWindow/​test/​browser/​sessionsChatWindowProvider.test.ts Updates chat-window service and Changes stubs.
src/​vs/​sessions/​contrib/​chatWindow/​test/​browser/​chatWindowChangesetActions.test.ts Updates scoped-action test dependencies.
src/​vs/​sessions/​contrib/​chatWindow/​browser/​sessionsChatWindowProvider.ts Injects Agent Merge into chat-window hosts.
src/​vs/​sessions/​contrib/​chat/​browser/​sideChatPane.contribution.ts Uses service-backed side-chat status.
src/​vs/​sessions/​contrib/​chat/​browser/​sessionLinkAttachmentWidget.ts Uses service-backed attachment status.
src/​vs/​sessions/​contrib/​changes/​test/​browser/​sessionChangesEditor.test.ts Tests picker registration in Changes headers.
src/​vs/​sessions/​contrib/​changes/​test/​browser/​sessionActionsHost.test.ts Adds repository observables to action-host tests.
src/​vs/​sessions/​contrib/​changes/​test/​browser/​sessionActionContextKeys.test.ts Tests repository-specific operation context.
src/​vs/​sessions/​contrib/​changes/​test/​browser/​changesViewActions.test.ts Updates picker and action test observables.
src/​vs/​sessions/​contrib/​changes/​test/​browser/​changesActionsBar.test.ts Adds operation-target observables to toolbar tests.
src/​vs/​sessions/​contrib/​changes/​browser/​sessionActionContextKeys.contribution.ts Supplies active repository operation context.
src/​vs/​sessions/​contrib/​changes/​browser/​changesViewActions.ts Updates main-window action-owner resolution.
src/​vs/​sessions/​contrib/​changes/​browser/​changesRepositoryPicker.contribution.ts Registers the Agents-window repository picker.
src/​vs/​platform/​agentHost/​test/​node/​agentService.test.ts Tests Agent Merge writes for discovered repositories.
src/​vs/​platform/​agentHost/​test/​node/​agentMergeController.test.ts Tests folder-scoped repairs and turn scheduling.
src/​vs/​platform/​agentHost/​test/​node/​agentHostPullRequestStatusService.test.ts Tests folder-scoped pull request watch lifecycles.
src/​vs/​platform/​agentHost/​test/​node/​agentHostGitStateService.test.ts Tests folder-scoped Git and pull request resolution.
src/​vs/​platform/​agentHost/​test/​node/​agentHostBaseBranchOperationProvider.test.ts Tests rejection of folder-only base changes.
src/​vs/​platform/​agentHost/​test/​common/​agentMergePrompt.test.ts Tests quoted repository paths in repair prompts.
src/​vs/​platform/​agentHost/​node/​agentService.ts Accepts eligible repository Agent Merge settings.
src/​vs/​platform/​agentHost/​node/​agentHostGitStateService.ts Resolves folder-only Git state and pull requests.
src/​vs/​platform/​agentHost/​node/​agentHostBranchChangesetScope.ts Identifies eligible roots and owning repair chats.
src/​vs/​platform/​agentHost/​node/​agentHostBaseBranchOperationProvider.ts Rejects base-branch changes for folder-only scopes.
src/​vs/​platform/​agentHost/​common/​agentMergePrompt.ts Directs repairs to the selected repository checkout.
src/​vs/​platform/​agentHost/​common/​agentHostGitStateService.ts Documents folder-only Git-state service contracts.

Review effort: Balanced

The Changes view and editor group a chat's changeset by repository: one
root per session folder or repository found in one, with its branch, and
other changes last. A repository picker, in the Changes editor's header
on desktop and web and in an editor window, filters the list to one
repository. The picked repository's actions, base branch and state come
from its own folder-only Branch changeset (`ISession.getRepositoryChangeset`),
observed only while it is picked or its changes are shown. Agent Merge
follows the picked repository. A session of several folders, also with
one in no repository, gives each repository its own scope. Single-folder
chats are unchanged.

The changes view service owns the repositories of the shown session, their
grouping (`groupByRepository`) and a repository's failure
(`findRepositoryFailure`).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… rows in the Changes view

- The Agent Merge state and configuration observables of a session's folders
  were cached in module-level maps. ISessionAgentMergeService now owns those
  caches as instance state; its consumers inject it instead of passing the
  providers and configuration services to module functions.
- buildRepositoryChildren becomes a private method of ChangesViewPane, its
  only consumer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… and scope the Changes actions without an accessor

- Session action context key binders are classes the context keys create with
  their services injected; Agent Merge's binder injects ISessionAgentMergeService.
- The Changes editor actions resolve their services in run and pass them to
  InvokingChangesScopeAction.getInvokingChangesScope; mainWindowChangesOwner
  takes the session host service.
- A repository of a session of several folders has its own Branch changeset
  only when the host lists the session's repositories; with a host that does
  not, the session's changes are its chats' as before.
- The Repository picker in the Changes file header requires chat to be enabled.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…folders on their own

A host records the folders of a multi-folder session on their own (the Git state
of a folder's scope, the repositories found in its folders, or the folders in no
repository) when it serves their scopes. The built-in host lists repositories
only when it finds nested ones, so the per-repository Branch changeset and Agent
Merge folder now follow those records, deriving each folder's scope as before;
a host that records none keeps the chats' changes only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hosts from before independent folder scopes already record the folders of a
session of several on their own, so their records do not tell that they serve
each folder's scope. The local agent host is of this build and does; a provider
now says so with `servesFolderScopes`, and only its sessions get a repository's
own Branch changeset and Agent Merge folder. Other hosts' sessions keep their
chats' changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandy081
Sandeep Somavarapu (sandy081) force-pushed the sandy081/agents/workspaces-11-changes-per-repo branch from 903c369 to e85645b Compare November 28, 2026 00:48
…epository picker current

- The CI context keys of the Changes and Fix Checks follow the pull request of
  the repository the Changes show, else of the session folder.
- A chat's workspace reports each repository's own GitHub info: its folder's, or
  its root's for one found in a folder.
- An open Repository picker updates when a repository's changes fail to load.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: aa8b6108 Current: c210ca4e

Added (11)

sessions/changes/repositoryPicker/changesRepositoryPicker/AllRepositories/Light

current

sessions/changes/repositoryPicker/changesRepositoryPicker/Open/Light

current

sessions/changes/repositoryPicker/changesRepositoryPicker/OneRepository/Light

current

sessions/changes/changesView/Repositories_List/Light

current

sessions/changes/changesView/Repositories_Tree/Light

current

sessions/changes/changesView/Repositories_OneShown/Light

current

sessions/changes/changesView/Repositories_Failed/Light

current

sessions/changes/changesView/Repositories_OtherChanges/Light

current

sessions/changes/changesView/Repositories_OneShownFailed/Light

current

sessions/changes/changesView/Repositories_ChecksAll/Light

current

sessions/changes/changesView/Repositories_ChecksOneShown/Light

current

…tures

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… the GitHub service

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n scoped Changes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical defects can route actions to the wrong chat or pull request, break modal diff navigation, and allow Agent Merge activation for unsupported repository scopes.

7 open issues
1 resolved since last review

Review effort: Balanced

…e checks following it

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…epository's scope, keep file item identity

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…one, by their own branch

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tion, grouping them once

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… Merge keys

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Commit can affect a repository outside the selected scope, and Fix Checks can submit repairs for a different chat and repository than the header shows.

7 open issues
1 previously missed issue

In code that hasn't changed since last review

High severity Repository-filtered drafts expose commits for another repository

src/​vs/​workbench/​contrib/​sessionChanges/​browser/​changesEditorActions.ts:669

For an untitled two-repository session, selecting repository B still exposes an enabled Commit backed by the chat's Uncommitted Changes when only repository A has edits. The draft path bypasses the repository-filtered operations and reads A's uncommitted count, so Commit can affect a repository that is not shown. Pass repositoryObs through getInvokingChangesScope and this helper, and return no title operations or titleChangeset for a repository-selected draft.

1 resolved since last review

Review effort: Balanced

…w shows another

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because Commit can modify a different repository than the one selected, alongside pull-request routing and repository-selection UI inconsistencies.

4 open issues
3 resolved since last review

Review effort: Balanced

@sandy081
Sandeep Somavarapu (sandy081) added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit a433239 Nov 28, 2026
54 checks passed
@sandy081
Sandeep Somavarapu (sandy081) deleted the sandy081/agents/workspaces-11-changes-per-repo branch November 28, 2026 08:43
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.

4 participants