Skip to content

Convert workspace-less sessions to workspace sessions - #334250

Merged
Sandeep Somavarapu (sandy081) merged 10 commits into
mainfrom
sandy081/agents/workspace-less-to-workspace-conversion
Sep 4, 2026
Merged

Sandeep Somavarapu (sandy081) merged 10 commits into
mainfrom
sandy081/agents/workspace-less-to-workspace-conversion

Conversation

@sandy081

Copy link
Copy Markdown
Member

This pull request implements the conversion of workspace-less sessions to workspace sessions, addressing user requests for a seamless transition between session types. Key changes include:

  • New Features:

    • Introduced sessionWorkspaceConversionContribution and sessionWorkspaceConversionService to manage the conversion process.
    • Enhanced the agentHostTurnService to support a two-phase continuation for a smoother user experience during workspace setup.
  • Improvements:

    • Updated various agent host files to ensure the UI reflects the ongoing conversion without significant pauses.
    • Adjusted session management logic to allow for better handling of workspace transitions.
  • Bug Fixes:

    • Removed temporary protocol-level changes that caused interruptions during workspace setting.

This update aims to provide a more integrated experience for users transitioning from quick chats to full workspace sessions, maintaining session identity and improving UI responsiveness.

Copilot AI balanced review requested due to automatic review settings September 3, 2026 13:17
@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Base: be6bce25 Current: 2cd6a24e

No screenshot changes.

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.

Copilot review overview

🟡 Changes recommended

One or more issues must be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 4 Medium severity · 1 Low severity

New issues introduced by this change (5)
Severity Finding
Medium severity src/​vs/​platform/​agentHost/​common/​state/​sessionActions.ts — This type widening does not actually put null on the wire. SessionSummaryNotifier.flush still…
Medium severity src/​vs/​platform/​agentHost/​node/​agentHostStateManager.ts — This mutates authoritative SessionState without an action, so already-subscribed clients never…
Medium severity src/​vs/​platform/​agentHost/​node/​chatContributions/​sessionWorkspaceConversion/​sessionWorkspaceConversionService.ts — When unsafe provider cleanup succeeds, error.quarantined is false, so this removes the pending…
Medium severity src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts — These three writes are not atomic despite representing one metadata snapshot. A crash or write…
Low severity src/​vs/​platform/​agentHost/​node/​agentServiceComposition.ts — This lazily resolves a service through IInstantiationService, hiding the dependency and the…
What changed in this PR

Adds in-place conversion of workspace-less Agent Host sessions into workspace-backed sessions while preserving session identity and history.

Changes:

  • Adds the set_workspace tool, workspace trust flow, and optional worktree isolation.
  • Adds conversion lifecycle handling, continuation turns, and queue gating.
  • Synchronizes workspace metadata and confirmation presentation across Agent Host and Sessions UI.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​stateToProgressAdapter.test.ts Updated as part of this pull request.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​stateToProgressAdapter.ts Updated as part of this pull request.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionListStore.ts Updated as part of this pull request.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionHandler.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​localAgentHostSessionsProvider.test.ts Updated as part of this pull request.
src/​vs/​sessions/​contrib/​providers/​agentHost/​browser/​baseAgentHostSessionsProvider.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​shared/​worktreeIsolation.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​sessionServerTools.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​sessionDatabase.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​serverToolGroups.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​protocolServerHandler.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​mockAgent.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​copilotToolDisplay.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​copilotShellTools.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​codex/​codexCreateChat.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​claudeAgent.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​chatContributions.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​agentSideEffects.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​agentServiceTestUtils.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​agentService.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​agentHostTurnTelemetry.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​agentHostTurnHangTelemetry.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​agentHostToolCallTelemetry.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​node/​agentHostPromptRegistry.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​electron-browser/​agentHostProtocolClient.test.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​test/​common/​sessionTestHelpers.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​shared/​worktreeIsolation.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​shared/​sessionServerTools.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​shared/​artifactServerTools.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​shared/​agentServerToolHost.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​shared/​agentMergeServerTools.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​shared/​agentFeedbackServerTools.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​sessionDatabase.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​protocolServerHandler.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​copilot/​prompts/​systemMessage.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotToolDisplay.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotShellTools.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​copilot/​agentHostSandboxEngine.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​codex/​codexAgent.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​claude/​claudeCanUseTool.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​claude/​claudeAgent.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​chatContributions/​sessionWorkspaceConversion/​sessionWorkspaceConversionService.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​chatContributions/​sessionWorkspaceConversion/​sessionWorkspaceConversionContribution.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​chatContributions/​queueDrain/​queueDrainContribution.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​chatContributions/​builtInChatContributions.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​agentSideEffects.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​agentServiceFoundation.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​agentServiceComposition.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​agentService.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​agentHostTurnService.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​agentHostStateManager.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​agentHostServices.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​agentHostClientConnectionService.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​node/​agentHostBootstrap.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​common/​state/​sessionState.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​common/​state/​sessionActions.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​common/​sessionDataService.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​common/​serverToolNames.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​common/​agentHostExtensionProtocol.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​common/​agent.ts Updated as part of this pull request.
src/​vs/​platform/​agentHost/​browser/​agentHostProtocolClient.ts Updated as part of this pull request.
Suppressed comments (4)

src/vs/platform/agentHost/node/agentHostTurnService.ts:29

  • This class is stateless routing, but the established contribution architecture keeps such logic as a plain ServicesAccessor function (agentHostTurnStarter.ts:45-47) to avoid adding registrations to every hand-built service graph. This new service already forces several unrelated telemetry tests to wire it. Keep handleTurnStarted/host-authored start as plain helpers instead.
/** Standard turn admission and provider routing shared by client- and host-authored turns. */
export class AgentHostTurnService implements IAgentHostTurnService {

src/vs/platform/agentHost/node/chatContributions/sessionWorkspaceConversion/sessionWorkspaceConversionService.ts:415

  • setSessionConfig is a create/restore seeding API that only mutates host memory. During this live conversion, existing subscribers do not receive the added schema; when they previously had no config, the following SessionConfigChanged action is also a no-op in channels-session/reducer.ts:214-216. Publish a config-replacement action (schema and values), or ensure this schema is part of the initial snapshot.
			this._stateManager.setSessionConfig(session.toString(), {
				schema: { type: 'object', properties },
				values: { ...currentConfig?.values },
			});

src/vs/platform/agentHost/node/chatContributions/sessionWorkspaceConversion/sessionWorkspaceConversionService.ts:473

  • This text is rendered as a visible system-initiated request row, so these hard-coded English strings are user-facing. Localize the success/failure variants with placeholders, as is already done for the labels below.
		const text = converted
			? `The current session is now attached to ${(pending.resolvedWorkingDirectory ?? pending.workspaceFolder).fsPath}${pending.isolation ? ' in an isolated worktree' : ''}. Continue the user's original task in this workspace. Do not request another session or workspace conversion.`
			: `The requested workspace setup did not complete successfully: ${errorMessage}. Do not run the user's task. Tell the user that workspace setup failed and include this error.`;

src/vs/platform/agentHost/node/chatContributions/sessionWorkspaceConversion/sessionWorkspaceConversionService.ts:250

  • Publish the new working directory before clearing the workspace-less marker. Each state-manager mutation is delivered separately, so the current order briefly exposes a regular workspace session whose only root is still the scratch directory; Sessions clients can react to that intermediate snapshot and open/group the session under the wrong workspace. Keeping the marker set until the replacement action lands avoids making that stale state observable.
		this._stateManager.setSessionMeta(session.toString(), withSessionWorkspaceless(finalState._meta, false));

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sandy081
Sandeep Somavarapu (sandy081) force-pushed the sandy081/agents/workspace-less-to-workspace-conversion branch 3 times, most recently from f01d3c0 to 1bf3d6b Compare September 3, 2026 19:43
@sandy081
Sandeep Somavarapu (sandy081) marked this pull request as ready for review September 4, 2026 05:39
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

TylerLeonhardt

Matched files:

  • src/vs/platform/agentHost/node/claude/claudeAgent.ts
  • src/vs/platform/agentHost/node/claude/claudeCanUseTool.ts

@sandy081
Sandeep Somavarapu (sandy081) force-pushed the sandy081/agents/workspace-less-to-workspace-conversion branch from 1bf3d6b to a99508b Compare September 4, 2026 05:47
Allow an agent to attach a workspace-less session to a folder or managed worktree without replacing the session or losing conversation history. Propagate the new project, working directory, continuation, and activity state through Agent Host and Sessions UI.

Co-authored-by: Copilot <[email protected]>
Reserve a visible host-authored turn while workspace setup completes, then route that same turn through normal provider admission. Keep project updates catalog-only, durably quarantine disposed provider sessions, atomically persist Copilot workspace metadata, and wire conversion without lazy service lookup.\n\nCo-authored-by: Copilot <[email protected]>
Use a stable visible continuation request and add synchronized Workspace Set or Workspace Setup Failed notifications to the same turn.\n\nCo-authored-by: Copilot <[email protected]>
Clean up imports left behind while adapting the workspace conversion changes to the current Agent Host composition.

Co-authored-by: Copilot <[email protected]>
Pass operation names through the updated Copilot chat queue API for working-directory mutations and their sequencing tests.

Co-authored-by: Copilot <[email protected]>
Create in-memory customization directories before writing fixtures and derive expected paths from URI.fsPath so assertions follow the host platform.\n\nCo-authored-by: Copilot <[email protected]>
Serialize creation of customization fixture directories because the in-memory filesystem's recursive mkdir path is not safe when sibling operations race.\n\nCo-authored-by: Copilot <[email protected]>
Use the real disk provider for native Windows customization paths, prevent late aborted-idle events from cancelling replacement turns, and give the full property initialization checker enough heap for the expanded Agent Host sources.\n\nCo-authored-by: Copilot <[email protected]>
@sandy081
Sandeep Somavarapu (sandy081) merged commit a9864c0 into main Sep 4, 2026
41 checks passed
@sandy081
Sandeep Somavarapu (sandy081) deleted the sandy081/agents/workspace-less-to-workspace-conversion branch September 4, 2026 10:06
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Sep 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants