Agent Host: Run Dev Containers on new worktrees - #333736
Merged
Christof Marti (chrmarti) merged 6 commits intoSep 1, 2026
Merged
Conversation
Copilot started reviewing on behalf of
Christof Marti (chrmarti)
September 1, 2026 09:18
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 2
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/vs/sessions/contrib/providers/agentHost/browser/localAgentHostSessionsProvider.ts — Calling setSessionConfigValue here persists isolation: 'folder' to the shared profile storage… |
|
src/vs/platform/agentHost/node/shared/worktreeIsolation.ts — Recent unclaimed records are skipped here, but _cleanupUnclaimedDetachedWorktrees is invoked only… |
What changed in this PR
Adds local worktree preparation before launching Dev Container-backed Agent Host sessions.
Changes:
- Passes the initial query into draft preparation.
- Adds detached-worktree protocol, persistence, lifecycle, and reconciliation.
- Preserves worktree handles across remote metadata, restoration, and caches.
| File | Description |
|---|---|
src/vs/sessions/SESSIONS.md |
Documents query-aware draft preparation. |
src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts |
Tests query forwarding. |
src/vs/sessions/services/sessions/common/sessionsProvider.ts |
Extends the preparation contract. |
src/vs/sessions/services/sessions/browser/sessionsManagementService.ts |
Forwards initial queries. |
src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts |
Tests delegated lifecycle and reconciliation. |
src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/devContainerAgentHostService.test.ts |
Tests reconciliation scope configuration. |
src/vs/sessions/contrib/providers/remoteAgentHost/REMOTE_AGENT_HOST_SESSIONS_PROVIDER.md |
Documents detached-worktree ownership. |
src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts |
Delegates worktree lifecycle locally. |
src/vs/sessions/contrib/providers/remoteAgentHost/browser/devContainerAgentHostService.ts |
Supplies worktree reconciliation scope. |
src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts |
Tests worktree preparation and transfer. |
src/vs/sessions/contrib/providers/agentHost/browser/localAgentHostSessionsProvider.ts |
Creates and transfers Dev Container worktrees. |
src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts |
Preserves metadata and adds lifecycle hooks. |
src/vs/platform/agentHost/test/node/shared/worktreeIsolation.test.ts |
Tests detached-worktree persistence and cleanup. |
src/vs/platform/agentHost/test/node/sessionDataService.test.ts |
Tests protected detached records. |
src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts |
Tests private protocol operations. |
src/vs/platform/agentHost/test/node/agentService.test.ts |
Tests metadata and detached creation. |
src/vs/platform/agentHost/node/shared/worktreeIsolation.ts |
Implements detached-worktree ownership. |
src/vs/platform/agentHost/node/sessionDataService.ts |
Lists and preserves detached records. |
src/vs/platform/agentHost/node/protocolServerHandler.ts |
Handles detached-worktree requests. |
src/vs/platform/agentHost/node/agentService.ts |
Exposes lifecycle operations and persistence. |
src/vs/platform/agentHost/electron-browser/localAgentHostService.ts |
Proxies local lifecycle calls. |
src/vs/platform/agentHost/common/sessionDataService.ts |
Adds data-ID listing. |
src/vs/platform/agentHost/common/meta/agentDevContainerWorktreeMeta.ts |
Defines validated handle metadata. |
src/vs/platform/agentHost/common/agentService.ts |
Extends service and connection contracts. |
src/vs/platform/agentHost/common/agentHostExtensionProtocol.ts |
Defines methods and capability metadata. |
src/vs/platform/agentHost/browser/nullAgentHostService.ts |
Implements unsupported stubs. |
src/vs/platform/agentHost/browser/agentHostProtocolClient.ts |
Sends lifecycle protocol requests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
Base:
|
Christof Marti (chrmarti)
changed the base branch from
main
to
release/1.136
September 1, 2026 12:20
Christof Marti (chrmarti)
force-pushed
the
chrmarti/devcontainer-worktree-sessions
branch
from
September 1, 2026 12:20
fd05480 to
217aa02
Compare
Create selected worktrees locally before launching Dev Containers, persist opaque local lifecycle handles in remote session metadata, and reconcile archive and deletion through the local Agent Host. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update the rebased tests for forced archive cleanup, retained metadata naming, and the branch-name generator service brand. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fall back to the inherited process environment when user shell environment resolution fails so transient shell startup timeouts do not hide Dev Container support. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep VS Code extension methods disabled on the local AHP data plane and use the trusted management channel for detached worktree creation and lifecycle operations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Assert that submitting an Agent Host draft removes the new-session homepage, activates the in-progress session input, and renders the response. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Christof Marti (chrmarti)
changed the base branch from
release/1.136
to
main
September 1, 2026 13:48
Christof Marti (chrmarti)
force-pushed
the
chrmarti/devcontainer-worktree-sessions
branch
from
September 1, 2026 13:48
217aa02 to
40b208b
Compare
Return to the new-session page so subsequent Agent Host smoke tests retain their expected initial state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Christof Marti (chrmarti)
marked this pull request as ready for review
September 1, 2026 14:38
Christof Marti (chrmarti)
enabled auto-merge (squash)
September 1, 2026 14:38
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Sandeep Somavarapu (@sandy081)Matched files:
Ladislau Szomoru (@lszomoru)Matched files:
|
Alex Ross (alexr00)
approved these changes
Sep 1, 2026
Christof Marti (chrmarti)
deleted the
chrmarti/devcontainer-worktree-sessions
branch
September 1, 2026 14:48
Bhavya U (bhavyaus)
pushed a commit
that referenced
this pull request
Sep 1, 2026
* Agent Host: Run Dev Containers on new worktrees Create selected worktrees locally before launching Dev Containers, persist opaque local lifecycle handles in remote session metadata, and reconcile archive and deletion through the local Agent Host. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Tests: Align Dev Container worktree coverage Update the rebased tests for forced archive cleanup, retained metadata naming, and the branch-name generator service brand. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Agent Host: Preserve Dev Container availability Fall back to the inherited process environment when user shell environment resolution fails so transient shell startup timeouts do not hide Dev Container support. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Agent Host: Route local worktree lifecycle over management IPC Keep VS Code extension methods disabled on the local AHP data plane and use the trusted management channel for detached worktree creation and lifecycle operations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Smoke: Verify new session view replacement Assert that submitting an Agent Host draft removes the new-session homepage, activates the in-progress session input, and renders the response. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Smoke: Reset Agents Window after replacement test Return to the new-session page so subsequent Agent Host smoke tests retain their expected initial state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Summary
Create a local worktree before starting a Dev Container when both New Worktree and Dev Container are selected, then run the replacement Agent Host session inside the container opened on that worktree.
Tracking issue: #317380
Session Context
Key decisions from the development session:
devcontainer up; the container-backed session uses folder isolation so it does not create a second worktree inside the container.Changes
Validation
npm run typecheck-clientnpm run transpile-clientgit diff --check