Repository navigation
agentHost: let chats switch workspace or move to a worktree via tools - #339778
Merged
Sandeep Somavarapu (sandy081) merged 20 commits intoOct 5, 2026
Merged
Sandeep Somavarapu (sandy081) merged 20 commits into
Sandeep Somavarapu (sandy081) merged 20 commits into
Conversation
Add the main-chat-only isolate_session tool, defer conversion until active chats finish, and preserve session histories while switching all Copilot backings to one worktree. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Enable session-wide Codex isolation with durable directory updates and rollback handling. Seed the generated branch before exposing the worktree and simplify the isolation divider. Co-authored-by: Copilot <[email protected]>
Preserve session isolation alongside updated server-tool discovery and provider lifecycle handling. Adapt the cold Codex isolation test to the provider-history lookup before resume. Co-authored-by: Copilot <[email protected]>
Preserve session isolation test coverage alongside upstream provider and chat contribution updates. Co-authored-by: Copilot <[email protected]>
Allow main and peer chats to request isolation while preserving other chat scopes. Persist exact-chat provider directories, update the Sessions workspace and branch model, and quarantine uncertain changes per chat. Co-authored-by: Copilot <[email protected]>
Preserve chat-scoped isolation alongside upstream orchestration controls and provider changes. Co-authored-by: Copilot <[email protected]>
Allow single-chat isolation without multi-root support while preserving repository identity. Keep multi-chat isolation gated, correct Git-state ownership, avoid refresh cooldown waits, and remove the superseded session-wide provider path. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…ate_session tools A chat can now move to another folder or into a new Git worktree when the model calls set_workspace or isolate_session, including in sessions that already have a workspace. The change is deferred until the requesting turn ends and the original task then continues automatically. Only the addressed chat changes: a single user chat replaces the session roots under the chat catalog lock, and with several chats the siblings keep their folders. Host: restore sibling chats before the provider moves, validate the chat identity across the asynchronous steps, quarantine the exact chat durably when the outcome is uncertain, and reject cancel, steering, new turns, truncation and archive while the host-owned conversion turn is running. Publish a per-chat workspace change state so clients can block input and show a blocked notice. Providers: pin sibling working directories before a main chat move, guard archived-history resume, distinguish definitive Codex rejections from uncertain outcomes, and retain or reconcile worktrees through ownership records. Client: block input while a conversion runs, render the workspace transition notice, and roll back an archive that the host rejects. There is no UI for changing the workspace; the tools are the only entry point. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]> # Conflicts: # src/vs/platform/agentHost/node/agentService.ts # src/vs/platform/agentHost/node/chatContributions/sessionWorkspaceConversion/sessionWorkspaceConversionService.ts # src/vs/platform/agentHost/node/copilot/copilotAgent.ts # src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts # src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts
Co-authored-by: Copilot <[email protected]> # Conflicts: # src/vs/platform/agentHost/node/agentService.ts # src/vs/platform/agentHost/test/node/agentService.test.ts # src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts # src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts # src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts # src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.ts # src/vs/sessions/contrib/sessions/test/browser/sessionsSessionManagementActions.test.ts
Co-authored-by: Copilot <[email protected]> # Conflicts: # src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts # src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts # src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts # src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts
There is no UI to start a workspace change, so remove the client reactions that only supported a user-initiated change: the workbench input blocking and notice, the Sessions archive rollback and bulk archive handling, and the published per-chat state they read. The host still rejects cancel, steering, new turns, truncation and archive while a conversion owns the turn.
Drop incidental churn from the feature diff and keep the project and worktree handling the Agents Window adapter needs after a tool-driven change. The transition notice now reads 'Workspace changed to a new worktree of {0}' for a worktree and 'Workspace changed to {0}' for a folder.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]> # Conflicts: # src/vs/platform/agentHost/node/agentService.ts
Co-authored-by: Copilot <[email protected]>
This reverts commit a155fcb.
Contributor
Screenshot ChangesBase: Changed (3) |
…of another folder A chat already in its session's worktree was refused a new worktree of a different folder with a generic error. Only reject when the target is the chat's current folder, keep the old worktree on disk, and explain the rejection. Co-authored-by: Copilot <[email protected]>
Giuseppe Cianci (Giuspepe)
previously approved these changes
Oct 5, 2026
…workspace Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Martin Aeschlimann (aeschli)
approved these changes
Oct 5, 2026
Sandeep Somavarapu (sandy081)
disabled auto-merge
October 5, 2026 15:02
Sandeep Somavarapu (sandy081)
deleted the
sandy081/agents/folder-to-isolation-session-feature
branch
October 5, 2026 15:02
This was referenced Oct 5, 2026
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.
Lets the model move a chat in the Agents Window to another folder or into a new Git worktree, without losing the chat's identity or history. This is tools only; no new UI.
What changed
set_workspacenow works on chats that already have a workspace, not only workspace-less ones. It changes this chat's folder, or withisolatemoves it into a new worktree of that folder.isolate_sessionmoves the calling chat into a new Git worktree.restoreChatIsolation) instead of being left half moved.worktreeIsolation.ts.resolveDiffBaseBranchNamenow uses||instead of??. Retaining a worktree and the peer baseline reset write''to the diff-base-branch meta, which must fall back to the default branch.baseAgentHostSessionsProvider.tskeeps project and worktree-flag state correct after a tool-driven change. Nothing changed underworkbench.Things to know
trustedParent, which can fail for a repo subfolder or a linked worktree.restoreChatIsolationcan leave an ordinary chat quarantined if its database read fails.isolate_sessionapproval text does not vary with the number of chats.How to test
Unit tests, run with
./scripts/test.sh --glob ...:vs/platform/agentHost/test/**/*.test.js: 10,280 passing, 72 pendingvs/sessions/**/*.test.js: 5,679 passing, 23 pendingvs/workbench/contrib/chat/test/**/*.test.js: 10,754 passing, 36 pendingvs/platform/actions/test/**/*.test.js: 26 passingnpm run typecheck-client, ESLint, the formatter check andnpm run valid-layers-checkare clean.Manual: in the Agents Window, ask a chat to "move this chat to " and "continue in a new worktree". Check that the notice appears, the session shows the new folder or branch, and the task continues.