You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Workbench: worktree locations from agent host sessions, a shown-session seam and shared folder picker sections (infra, unused) - #348304
Infra for worktree support in the editor window (#348306) and for the chat area's folder picker (#348298). No behavior change: nothing registers or uses these pieces yet. Merge order: this PR first; #348298 and #348306 merge its branch.
Changes
Shown-session seam:
IChatViewHostService.shownSession, with IChatViewHost.shownSession (optional) and IChatViewHostShownSession { resource, reason: 'open' | 'commit' | 'restore' }: the chat that the host in use shows, and why: the user brought it up (open), a new chat's first request made it (commit), or the host restored it (restore). IChatViewHostOpenOptions gains restore and commit.
The Chat view reports it: restore only inside its two restore paths, commit for the session that a new chat's first request makes (commitChatSession opens it with commit: true, and the widget's view model change carries committed), and open for a chat picked in its sessions list or a new chat.
A registered host that replaces the Chat view reports its own; one that reports none leaves it undefined.
Worktree locations from agent host sessions: AgentHostWorktreeLocationProvider, an IWorkspaceFolderLocationProvider that is not registered here.
A folder's locations are the distinct working directories of the local agent host's sessions that are linked checkouts of the folder's git repository, as the editor window decides that a folder belongs to its repository (WorkspaceFolderRepositories), and whose entry in the repository names them back.
Where sessions work comes from the Chat view's sessions list and from IAgentHostWorktreeSessionSources, where another session surface (such as a sessions list the Chat view does not show) registers a source. Sources only nominate working directories; the provider alone decides which are locations of the folder.
There is no discovery of the repository's worktrees.
Shared folder picker labels and sections (services/workspaces/common/folderLocationSections.ts), so that the pickers in chat and in sessions share them: groupFolderLocations (a Folder section, Folders with several, and a Worktrees section, each with the current folder first), and the labels Current, New Worktree, and the detail lines of the folder ("Works in the folder already on this computer") and of New Worktree ("Creates a separate copy for this session", as the Agents window's isolation picker says).
readFolderGitCheckout, the reading of a folder's .git that WorkspaceFolderRepositories does, moves to services/workspaces/common/gitFolderCheckout.ts so that chat can use it too. WorkspaceFolderRepositories behaves as before.
Review fixes
The Chat view reports restore only for the chat it restores: a chat that the user loads during a restore is open.
Copilot code review:
ChatViewPane.reportOpened (from the Chat view host's openSession and revealIfShowing) reports an explicit open of a chat that the view shows already, such as one it restored, as open.
The worktree provider waits for the sessions list (and every registered source) to resolve before reading working directories.
agentHostWorktreeLocations.test.ts: which sessions count, from the sessions list and from registered sources, and which working directories are offered and resolved.
chatViewHostService.test.ts and chatViewPane.test.ts: the shown chat follows the host in use, with its reason.
folderLocationSections.test.ts: the sections and their order.
Validation (macOS, on ca9b1ea, up to date with main9bfb9e7):
pnpm run typecheck-client: passed
pnpm run build-fast --client-only, then ./scripts/test.sh --reporter dot --run <agentHostWorktreeLocations, chatViewHostService, chatViewPane, folderLocationSections, workspaceFolderRepositories, chatWidgetService, chatMoveActions .test.ts>: 87 passing
Earlier, before the merge of main: pnpm run valid-layers-check and oxlint on the changed files: passed
Not run: the full unit suite, and a live Code OSS run (the try-out covers the features that use it).
Final sweep
Final sweep: merged main776b518 (25ab514, clean). pnpm run typecheck-client: passed; pnpm run build-fast --client-only, then ./scripts/test.sh --reporter dot --run <changed test files vs main>: 82 passing.
…s locations of the window's folder
A window with a single local folder can now move that folder to the worktrees its local agent host sessions work in, behind the experimental setting chat.editorWindow.enableWorktree (off by default, experiment-controlled).
- AgentHostWorktreeLocationProvider: the locations of a folder are the distinct working directories of the local agent host's sessions (not archived; local chats and extension sessions belong to the folder itself). A working directory counts when it is a linked checkout of the folder's git repository, as the editor window decides that a folder belongs to its repository, and when the repository's entry for it names it back, so a folder that only points into the repository does not inherit the folder's trust. Any such checkout resolves, also before the sessions load, to restore the location the folder was at. There is no discovery of the repository's worktrees.
- It is registered as a built-in provider while the setting is on, not in the Agents window.
- readFolderGitCheckout moves from WorkspaceFolderRepositories to services/workspaces/common, so that both can read a folder's checkout; WorkspaceFolderRepositories is unchanged otherwise.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The picker snapshots sessions before initial model resolution completes, omitting uncached worktrees until reopened; it should await resolution and test initially unloaded sessions.
Adds local agent-host session worktrees to VS Code’s existing folder-location service, laying the groundwork for switching a single-folder editor window between checkouts.
Changes:
Registers a worktree location provider behind the default-off experimental chat.editorWindow.enableWorktree setting.
Validates repository membership and reverse Git links, including when restoring locations no longer listed by sessions.
Extracts shared Git-checkout parsing and adds focused provider tests.
…r picker sections (infra, unused)
Infra for worktree support in the editor window; nothing registers or uses it yet.
- IChatViewHostService.shownSession, with IChatViewHost.shownSession and IChatViewHostShownSession { resource, reason: 'open' | 'restore' }: the chat that the host in use shows, and whether the user brought it up or the host restored it. The Chat view reports it: 'restore' for the chat it restores, 'open' for a chat picked in its sessions list, a new chat, and a new chat that its first request made real. A host that replaces the Chat view reports its own; one that reports none leaves it undefined.
- folderLocationSections.ts: the sections that every picker of a window's folders and their worktrees shows (Folder or Folders, then Worktrees, each with the current folder first), and their labels, so that the pickers share them.
- AgentHostWorktreeLocationProvider is no longer registered here, and the setting moves out with its registration: the feature that uses them registers them.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sandeep Somavarapu (sandy081)
changed the title
Editor window: offer the worktrees that agent host sessions work in as locations of the window's folder
Workbench: worktree locations from agent host sessions, a shown-session seam and shared folder picker sections (infra, unused)
Nov 14, 2026
… folder picker sections
The Folder (or Folders) and Worktrees sections of a composer restricted to a window's folders, their order and their labels (Current, New Worktree) now come from folderLocationSections (#348304), which the Chat view's folder chip shares, rather than from rules of its own. The picker shows the same items as before.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… not one that the user loads meanwhile
The Chat view marked every chat it showed while its restore was under way as restored, also a chat that the user loaded meanwhile and that superseded the restore. It now passes the reason with the chat it shows, and reports it only while it sets that chat.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
As the Chat view does since #348304: a chat that the user opens while the chat part restores its tabs is opened, not restored.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ectories, and report an explicitly opened chat as opened
Copilot code review fixes:
- AgentHostWorktreeLocationProvider waits for the sessions list to resolve before reading the working directories of its sessions, so the worktrees of sessions that it did not cache are not missing.
- The Chat view reports a chat that the user opens or reveals as opened, also one that it shows already, such as one it restored that the user picks in a sessions list (ChatViewPane.reportOpened, from the Chat view host's openSession and revealIfShowing).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ows it
The Chat view host service now reports the shown chat of the host that showed a chat last: the
host that an open, start or reveal goes to (the Chat view for the chats a registered host leaves
to it), or the host that restores or shows a chat on its own. New Chat of every icon variant now
lets a host that replaces the Chat view start the new chat.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The resolution guard can skip waiting when a sibling provider finishes first, causing uncached worktrees to be omitted while the agent host is still loading.
model.resolved becomes true when any single provider finishes (agentSessionsModel.ts:876–877), not when the initial resolution of all providers completes. If a local-chat provider finishes before the agent host, this guard skips waiting while the host is still loading, so uncached worktrees remain absent from the returned locations. Await the relevant agent-host providers' resolution (or expose and await the model's full initial-resolution promise), and cover a fast sibling provider with a delayed agent-host provider in the test.
… report first sends and restored opens
- The location provider resolves through real paths (a symlinked primary or worktree keeps its identity), reads the entry's HEAD for the branch or short commit, and no longer drops all locations when one fails to read.
- IChatViewHostShownSession gains reason 'commit' for the chat a first request made; IChatViewHostOpenOptions gains restore to show a session without reporting it as opened.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
First-request replacements can still report open or bypass the event, preventing consumers from reliably distinguishing commits from user selections across host-driven and direct-widget model-binding paths.
- chatViewHostService.ts: restore the reportRestored branch (#348304's
039d452), lost in an earlier resolution; now identical to #347688 and #348283.
- agentsViewGate.test.ts: take the banner's test, which matches the banner's gate.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ugh an extension's commit, and follow symbolic links of worktree folders and .git files
- ChatWidget marks the view model change to the session its first request made; the Chat view reports it as 'commit'.
- IChatViewHostOpenOptions.commit: the extension commit path opens the committed session through the Chat view host as 'commit'.
- The location provider compares the real paths of the repository's worktrees folder and of a worktree's .git file.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tself, and an open through the Chat view host reports its chat once
- The location provider accepts a candidate only where the folder of the .git file its entry names is the candidate, by real paths, so another folder whose .git links to the same file does not inherit the primary's trust.
- ChatViewPaneHost reports a chat after loading it only where the load reported nothing, such as the chat it shows already.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s a later open supersedes it
The host no longer infers from the shown session whether a load reported its chat: a superseded restore no longer reports its reason after the explicit open that superseded it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…des the Chat view's sessions list
IAgentHostWorktreeSessionSources lets another session layer, such as the editor window's, nominate where its sessions and chats work. AgentHostWorktreeLocationProvider offers the union of the Chat view's sessions and every source, deduplicated, and still accepts only a linked checkout that git names back.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… as committed
As the Chat view shows it (#348304dd8a606), so a follow of where the window's folder is does not take it for a session the user opened.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
getComposerFolderOptions returns live options: a composer created before a feature offers its folders, such as the Chat view's composer during restore, follows that feature's folders and presentation, and the window's folders again once it goes. Also disposes the Chat view host service of #348304's committed-session test.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The folder picker can show duplicate entries when sessions reference the same worktree via real and symlink paths; deduplication by real checkout path and a regression test are needed.
…e (CCR)
A worktree that sessions work in through a symbolic link and through its real path showed twice in the folder picker. Locations are now deduplicated by their real path, keeping the first.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
No deployments
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
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.
Infra for worktree support in the editor window (#348306) and for the chat area's folder picker (#348298). No behavior change: nothing registers or uses these pieces yet. Merge order: this PR first; #348298 and #348306 merge its branch.
Changes
IChatViewHostService.shownSession, withIChatViewHost.shownSession(optional) andIChatViewHostShownSession { resource, reason: 'open' | 'commit' | 'restore' }: the chat that the host in use shows, and why: the user brought it up (open), a new chat's first request made it (commit), or the host restored it (restore).IChatViewHostOpenOptionsgainsrestoreandcommit.restoreonly inside its two restore paths,commitfor the session that a new chat's first request makes (commitChatSessionopens it withcommit: true, and the widget's view model change carriescommitted), andopenfor a chat picked in its sessions list or a new chat.undefined.AgentHostWorktreeLocationProvider, anIWorkspaceFolderLocationProviderthat is not registered here.WorkspaceFolderRepositories), and whose entry in the repository names them back.IAgentHostWorktreeSessionSources, where another session surface (such as a sessions list the Chat view does not show) registers a source. Sources only nominate working directories; the provider alone decides which are locations of the folder.services/workspaces/common/folderLocationSections.ts), so that the pickers in chat and in sessions share them:groupFolderLocations(a Folder section, Folders with several, and a Worktrees section, each with the current folder first), and the labels Current, New Worktree, and the detail lines of the folder ("Works in the folder already on this computer") and of New Worktree ("Creates a separate copy for this session", as the Agents window's isolation picker says).readFolderGitCheckout, the reading of a folder's.gitthatWorkspaceFolderRepositoriesdoes, moves toservices/workspaces/common/gitFolderCheckout.tsso that chat can use it too.WorkspaceFolderRepositoriesbehaves as before.Review fixes
restoreonly for the chat it restores: a chat that the user loads during a restore isopen.ChatViewPane.reportOpened(from the Chat view host'sopenSessionandrevealIfShowing) reports an explicit open of a chat that the view shows already, such as one it restored, asopen.How to test
Unit tests:
agentHostWorktreeLocations.test.ts: which sessions count, from the sessions list and from registered sources, and which working directories are offered and resolved.chatViewHostService.test.tsandchatViewPane.test.ts: the shown chat follows the host in use, with its reason.folderLocationSections.test.ts: the sections and their order.Validation (macOS, on ca9b1ea, up to date with
main9bfb9e7):pnpm run typecheck-client: passedpnpm run build-fast --client-only, then./scripts/test.sh --reporter dot --run <agentHostWorktreeLocations, chatViewHostService, chatViewPane, folderLocationSections, workspaceFolderRepositories, chatWidgetService, chatMoveActions .test.ts>: 87 passingmain:pnpm run valid-layers-checkand oxlint on the changed files: passedNot run: the full unit suite, and a live Code OSS run (the try-out covers the features that use it).
Final sweep
main776b518 (25ab514, clean).pnpm run typecheck-client: passed;pnpm run build-fast --client-only, then./scripts/test.sh --reporter dot --run <changed test files vs main>: 82 passing.