Repository navigation
Agents: move workspace-less sessions and chats in Move Chats (Block 9) - #343022
Merged
Sandeep Somavarapu (sandy081) merged 62 commits intoOct 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Scratch cleanup can delete live chat files, and unresolved workspace classification, metadata projection, and movability defects affect the new behavior.
5 open issues
Protect parent scratch folders containing active chat subdirectories · New Use pending folders when determining workspace-less chat context · New Refresh sibling movability when chat membership or folders change · New Preserve folder GitHub associations when moving chats to quick chat · New Expose primary quick-chat scratch folder in workspace metadata · New
What changed in this PR
Extends Move Chats to workspace-less sessions, connecting host-side scratch-folder handling with the Agents Window’s chat actions and workspace presentation.
Changes:
- Adds scratch-folder persistence, cleanup, and per-chat workspace-less classification.
- Enables nested chats in quick chats and updates folder presentation and refusal messages.
- Expands regression tests and documents the updated behavior.
| File | Description |
|---|---|
| src/vs/sessions/SESSIONS.md | Documents mixed chat workspaces. |
| src/vs/sessions/SESSIONS_LIST.md | Documents nested quick chats. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsListChatMoveDnd.test.ts | Tests quick-chat move eligibility. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts | Tests actions and folder labels. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsActions.test.ts | Updates action visibility expectations. |
| src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts | Shows folder badges in quick chats. |
| src/vs/sessions/contrib/sessions/browser/sessionsActions.ts | Enables nested-chat actions for quick chats. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts | Tests mixed workspaces and move refusals. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostChatMoveErrors.test.ts | Tests revised refusal messages. |
| src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts | Projects scratch-aware chat workspaces. |
| src/vs/sessions/contrib/providers/agentHost/browser/agentHostChatMoveErrors.ts | Explains workspace-less move refusals. |
| src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md | Documents scratch-folder presentation. |
| src/vs/sessions/contrib/chat/test/browser/sessionsChatAccessibilityHelp.test.ts | Tests new accessibility guidance. |
| src/vs/sessions/contrib/chat/browser/sessionsChatAccessibilityHelp.ts | Explains nested quick chats and moves. |
| src/vs/sessions/common/agentHostSessionWorkspace.ts | Adds scratch-aware workspace helpers. |
| src/vs/platform/agentHost/test/node/sessionWorkspaceConversion.test.ts | Tests independent foldered-chat conversion. |
| src/vs/platform/agentHost/test/node/sessionStateCompatibilityFixtures.test.ts | Updates database compatibility expectations. |
| src/vs/platform/agentHost/test/node/sessionServerTools.test.ts | Tests foldered chats within quick chats. |
| src/vs/platform/agentHost/test/node/providerIntegration/copilotCredentialSponsorship.integrationTest.ts | Updates chat context fixtures. |
| src/vs/platform/agentHost/test/node/copilotAgent.test.ts | Tests scratch recovery and customization scope. |
| src/vs/platform/agentHost/test/node/codex/codexPrewarmEviction.test.ts | Updates chat context fixtures. |
| src/vs/platform/agentHost/test/node/codex/codexModelRefresh.test.ts | Updates creation context. |
| src/vs/platform/agentHost/test/node/codex/codexChatDiscovery.test.ts | Updates discovery contexts. |
| src/vs/platform/agentHost/test/node/codex/codexAgent.test.ts | Updates context resolution fixtures. |
| src/vs/platform/agentHost/test/node/claudeAgent.test.ts | Tests scratch-folder recreation. |
| src/vs/platform/agentHost/test/node/claudeAgent.integrationTest.ts | Updates chat context helper. |
| src/vs/platform/agentHost/test/node/chatMetadataTestHelpers.ts | Supports scratch database operations. |
| src/vs/platform/agentHost/test/node/agentSideEffects.test.ts | Updates changeset catalog calls. |
| src/vs/platform/agentHost/test/node/agentHostWorktreeRemovalDatabase.test.ts | Updates migration expectations. |
| src/vs/platform/agentHost/test/node/agentHostWorktreeCleanupService.test.ts | Tests scratch cleanup and retries. |
| src/vs/platform/agentHost/test/node/agentHostSessionStateDatabase.test.ts | Updates schema version expectations. |
| src/vs/platform/agentHost/test/node/agentHostSeams.test.ts | Tests per-chat workspace classification. |
| src/vs/platform/agentHost/test/node/agentHostScratchFolderDatabase.test.ts | Tests scratch persistence and ownership. |
| src/vs/platform/agentHost/test/node/agentHostDatabase.test.ts | Updates schema and migration assertions. |
| src/vs/platform/agentHost/test/node/agentHostCustomizationEnablementService.test.ts | Tests scratch-based customization scope. |
| src/vs/platform/agentHost/test/node/agentHostChatMovability.test.ts | Tests shared scratch-folder restrictions. |
| src/vs/platform/agentHost/test/node/agentHostChangesetStrategy.test.ts | Updates changeset catalog setup. |
| src/vs/platform/agentHost/test/node/agentHostChangesetService.test.ts | Updates changeset catalog calls. |
| src/vs/platform/agentHost/test/node/agentHostChangesetCoordinator.test.ts | Updates coordinator fixtures. |
| src/vs/platform/agentHost/test/node/agentChatContextTestUtils.ts | Adds workspace-less context default. |
| src/vs/platform/agentHost/test/common/sessionWorkspacelessMeta.test.ts | Tests scratch metadata helpers. |
| src/vs/platform/agentHost/test/common/changesetUri.test.ts | Tests per-chat changeset classification. |
| src/vs/platform/agentHost/test/common/agentHostWorkspaceTrust.test.ts | Tests scratch-folder trust filtering. |
| src/vs/platform/agentHost/node/shared/sessionServerTools.ts | Checks workspace status per chat. |
| src/vs/platform/agentHost/node/shared/sessionMoveTools.ts | Updates move guidance and refusals. |
| src/vs/platform/agentHost/node/copilot/prompts/promptRegistry.ts | Clarifies workspace-less context documentation. |
| src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts | Exposes launch workspace-less status. |
| src/vs/platform/agentHost/node/compatibleAgentHostDatabase.ts | Maps scratch ownership identities. |
| src/vs/platform/agentHost/node/claude/claudeAgent.ts | Recreates missing scratch folders. |
| src/vs/platform/agentHost/node/chatContributions/sessionWorkspaceConversion/sessionWorkspaceConversionService.ts | Applies per-chat conversion eligibility. |
| src/vs/platform/agentHost/node/agentHostWorktreeRemovalDatabase.ts | Shares working-directory query logic. |
| src/vs/platform/agentHost/node/agentHostWorktreeCleanupService.ts | Reclaims eligible scratch folders. |
| src/vs/platform/agentHost/node/agentHostStateManager.ts | Tracks recorded scratch folders. |
| src/vs/platform/agentHost/node/agentHostScratchFolderDatabase.ts | Adds scratch-folder storage and queries. |
| src/vs/platform/agentHost/node/agentHostDatabase.ts | Integrates scratch migration and deletion. |
| src/vs/platform/agentHost/node/agentHostCustomizationEnablementService.ts | Uses default-chat workspace classification. |
| src/vs/platform/agentHost/node/agentHostChatMovability.ts | Checks shared scratch-folder usage. |
| src/vs/platform/agentHost/node/agentHostChangesetService.ts | Classifies changesets per chat. |
| src/vs/platform/agentHost/node/agentChatContext.ts | Derives per-chat workspace-less context. |
| src/vs/platform/agentHost/common/state/sessionState.ts | Adds scratch-folder metadata helpers. |
| src/vs/platform/agentHost/common/changesetUri.ts | Accepts explicit workspace-less classification. |
| src/vs/platform/agentHost/common/agentHostWorkspaceTrust.ts | Excludes reported scratch folders. |
| src/vs/platform/agentHost/common/agent.ts | Extends the chat context contract. |
Review effort: Balanced
…eless) WIP for Block 9b: required per-chat workspaceless on the chat context, decided from recorded scratch folders and the session marker, never from a path or URI. Launch directories follow it. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…space-less sessions Co-authored-by: Copilot <[email protected]>
…olders, mark promoted quick chats Co-authored-by: Copilot <[email protected]>
…pilot and Claude Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…'s, test workspace-less moves Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…r; WL->WL and promotion marker tests Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…ders - New Nested Session and the agent host's multiple-chats capability no longer exclude quick chats. - Read vscode.scratchFolders once per session _meta change: scratch folders are left out of session and chat workspaces, the changes scope roots and label homes; a chat with its own folder in a quick chat shows that folder. Co-authored-by: Copilot <[email protected]>
…folders Quick chats are no longer excluded as chat move sources or targets; the host decides with movable. A workspace-less refusal now says whether the chat shares its scratch folder with another chat of its session (read from summaries when explaining the refusal) or has no folder. Co-authored-by: Copilot <[email protected]>
Quick chats with chats that brought their folder along stay in Chats; those chat rows show their folder (and announce it), scratch chats show none. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…scratch folder Co-authored-by: Copilot <[email protected]>
…tes a moved chat's missing folder; WL move tests Co-authored-by: Copilot <[email protected]>
…of a staying session Co-authored-by: Copilot <[email protected]>
…te published ones; commit failure keeps the folder An allocation in flight is tracked in memory; an allocating row that is not in flight and not listed by any chat is reclaimed (at startup nothing is in flight), one that is listed becomes owned. A failure recording ownership after the chat was published no longer deletes the folder under it. Co-authored-by: Copilot <[email protected]>
…h their own folders changes only that chat Co-authored-by: Copilot <[email protected]>
…s before listing, drop dead scratch DB methods A fork sharing a removed owner's folder stays workspace-less after a restart; listSessions waits for the load and sessions registered earlier republish their identities. The moved-session record checks one row instead of reading the table. Co-authored-by: Copilot <[email protected]>
…ument guards Co-authored-by: Copilot <[email protected]>
…ratch folders Co-authored-by: Copilot <[email protected]>
…n apply, clean refusals - createChat and setChatWorkspace refuse a folder workspace naming a recorded scratch folder, a workspace-less session's own primary folder or a published scratch folder. - Working-directory identities and vscode.scratchFolders are republished after an apply and on rollback, so a new scratch chat is shown and trusted as scratch at once. - Refusals reach the client as the message only; the stack is logged on the host. - Rolling back a chat without folders of its own leaves it without folders and re-creates its backing as createChat did, never in another chat's scratch folder. Co-authored-by: Copilot <[email protected]>
The scratch-folder refusal for chat workspaces uses publishedScratchFolders, the one definition of a session's scratch folders. Co-authored-by: Copilot <[email protected]>
…space Co-authored-by: Copilot <[email protected]>
…s its scratch definition Co-authored-by: Copilot <[email protected]>
…med them in another spelling A scratch row allocated for a chat about to be created (createChat, and setChatWorkspace through the same allocation) was written before the chat had a storage identity, so it named the chat by its runtime spelling while chats_v2 records the storage spelling. Deleting the chat tombstoned it, but the tombstone's chat_uri match missed the row: the folder leaked. - The allocation records the chat's storage identity before writing the row, so every row names its chat as its catalog row does. - A chat's tombstone also marks `removing` the scratch rows of the folders it recorded that no other live chat lists, whatever chat they name. - At startup, an owned row whose chat is live under no recorded spelling and whose folder nothing lists is released (rows of earlier builds). Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…d path A chat's recorded scratch folder deleted while the host runs was only recreated on restore. Copilot and Claude now recreate it (under the chats root only) before using a live chat. Codex still refuses. Co-authored-by: Copilot <[email protected]>
…vider's stale true on restore The restore merge spread the provider's metadata under the persisted one, but a false marker is the absence of the key, so a stale discovered true survived and was written back, undoing a whole-session conversion after a restart. Co-authored-by: Copilot <[email protected]>
…ored workspace-less session lists a foldered chat Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Restore published working-directory identities but not vscode.scratchFolders, so a restored session's live state made the client treat a scratch chat's own folder as a workspace. Co-authored-by: Copilot <[email protected]>
…e change The folder stayed listed on the session, so the clean-up pass kept it after the chat was deleted. Co-authored-by: Copilot <[email protected]>
The pre-send working directory check refused it before the agent could recreate it. Co-authored-by: Copilot <[email protected]>
…folders A chat whose state was not hydrated yet counted as folderless, so its send resolved the session's non-scratch folders and a scratch chat ran in the user's repo. It now uses the folders recorded in its catalog summary. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081)
marked this pull request as ready for review
October 21, 2026 03:59
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: TylerLeonhardtMatched files:
Ladislau Szomoru (@lszomoru)Matched files:
Anthony Kim (@anthonykim1)Matched files:
|
Vritant Bhardwaj (vritant24)
previously approved these changes
Oct 21, 2026
Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081)
enabled auto-merge (squash)
October 21, 2026 06:47
Dirk Bäumer (dbaeumer)
approved these changes
Oct 21, 2026
Sandeep Somavarapu (sandy081)
deleted the
agents/move-chats-workspaceless
branch
October 21, 2026 07:22
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.


What / why
Block 9 of Move Chats: sessions without a workspace ("workspace-less", WL) can now move like any other session, and chats can move between WL and foldered sessions. Includes the host side (move validation, scratch-folder rows, session-move recording, Claude recreate of a moved chat's missing folder,
move_sessiontool texts) and the Agents-window client (provider, sessions list/actions, refusal texts, trust filtering of scratch folders).Move matrix
Workspaceless)Workspaceless)/tmp/vscode-agent-codex/...)SessionNotReady)Decisions
Q1 own folder, Q2 mixed, Q3 keep, Q4 withhold (resolved: no code needed, see below), Q5 document, Q6 chat-only, Q7 stay, Q8 quick, Q9 recreate for Copilot/Claude and refuse Codex tmp, Q10 allowed.
Q11 (a), Q12 (a), Q13 (c) forks share the source folder: coordinator decision, pending user confirmation.
M1 (Q4): a whole-session move tombstones the source session (
tombstoneKey+ deleted rows); 1.142/1.143 list only via the registry, which filters tombstones, and discovery registers withcheckTombstone, so older builds don't list the moved-from session and can't delete a folder still in use.Validation
On head 5c188d1 (Block 9 + 9d r4 + startup/restart/greeting/final fixes + HIGH-16, merged with origin/main):
npm run typecheck-clientcopilotSdkManagedSettings.integrationTest.tscaused by the local SDK being older (1.0.23) than main's 1.0.24 (install blocked by registry E401); environmentaleslinton the 97 changed.tsfiles vs origin/mainsrc/vs/sessions/**/test/browser)agentHostWorkspaceTrust10, plus workbench trust)./scripts/test-agent-host-e2e.sh(deterministic, strict replay)npm run transpile-clientSub-block 9d: nested chat composer
The "New Chat" in a session uses the same composer as New Session, with the user's decisions:
On send, the composer adopts its untitled chat: the client sends
vscode/setChatWorkspace(createChat_metavscode.chatWorkspace, gated by a capability), and the host re-creates the chat's backing in the chosen folder or new worktree. A refusal keeps the draft and says why; a failure fully releases the folder or worktree again. An untitled chat holding a turn is never dropped.Round 3 fixed the two review items: re-applying a workspace now releases the previous folder or worktree, and persistence is rolled back after a failure.
Known residuals:
Overnight live/real-data findings and fixes
vscode.scratchFoldersfor catalog and fallback rows, and the session list waits for the scratch load.publishedScratchFolders/inheritedChatFolders).setChatWorkspace, the host refuses a scratch folder as kindfolder(using the same shared scratch definition), clearer error messages, and workspace trust inheritance for a chat's own worktree.set_workspace(setChatWorkingDirectory) retires the chat's old scratch folder and republishes.getEffectiveWorkingDirectoriesuses the chat's recorded own folders from its catalog summary when its state isn't hydrated, so after a restart a scratch chat in a workspace session no longer resumes in the session's real folder. The other "not hydrated = folderless" readers were audited and are safe.For reviewers: a chat's own worktree (a VS Code-created
<repo>.worktrees/...folder) now inherits workspace trust from any trusted repository folder of the session, not only the session's project. This extends the existing project rule and is path-based like it; an untrusted repo still prompts. Tests pin the limits: untrusted repo, picked folders outside.worktrees, scratch folders and the isolated-session rule.Known limits:
Overnight live/real-data summary: live testing and the real-data check found the startup scratch publish, the workspace-less session's own scratch marking, cross-chat scratch inheritance, delete reclaim and orphan repair (HIGH-9), conversion persistence (HIGH-11), retire on chat-only
set_workspace(HIGH-12), unhydrated-state resume in the session folder (HIGH-16) and missing-scratch recreate (MED-13); all are fixed above.Review and perf handling
allocatingrows are reclaimed at startup.set_workspace; the session and other chats stay as they are.allocatingrow whose folder is in use is promoted toowned.removingrows are loaded too, so a fork sharing a removed owner's folder stays workspace-less after a restart.createChat/restoreSessionawait the load.isScratchFolderInUseis a payload scan (likeworktreeInUseSql), off the hot path.ownedrows are ignored by 1.142/1.143; the effect is a disk leak only (scratch folders of chats deleted while downgraded stay until cleaned after re-upgrade).Not run
Follow-up round: moves (chat and session) now republish
vscode.scratchFoldersfor the target and source so a moved workspace-less chat never shows as a workspace chat; MCP start on a cold workspace-less chat keeps it workspace-less; scratch recreate is limited to folders under the chats root; the default chat of a workspace-less session accepts chat-only set_workspace; the post-load republish also invalidates the session list.