Skip to content

Agent Host: Open Dev Container workspaces in Agents - #334249

Merged
Christof Marti (chrmarti) merged 9 commits into
mainfrom
chrmarti/open-in-agents-devcontainer
Sep 4, 2026
Merged

Agent Host: Open Dev Container workspaces in Agents#334249
Christof Marti (chrmarti) merged 9 commits into
mainfrom
chrmarti/open-in-agents-devcontainer

Conversation

@chrmarti

@chrmarti Christof Marti (chrmarti) commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Make Open in Agents from an editor connected to an Agent Host Dev Container open the new-session page for the corresponding local folder and preselect Dev Container execution when the feature is enabled.

Session Context

Key decisions from the development session:

  • Keep this separate from container lifecycle work: This PR is based directly on current main; it does not depend on Agent Host: Manage idle Dev Container lifecycle #333955.
  • Keep the cross-process handoff small and self-describing: The editor sends its original workspace URI through the existing Agents Window IPC arguments. The Agents Window recognizes vscode-remote://dev-container+<hex-host-path>/..., decodes the local folder, and derives the Dev Container preference there; no Dev Container-specific flag or new options bag crosses the native or main-process APIs.
  • Make the handoff win startup races: The explicit new-session intent cancels startup session restoration so a previously visible session cannot replace the requested composer. Ordinary eager draft creation retains its existing non-cancelling behavior.
  • Reuse the composer retry lifecycle: Folder selection goes through the existing workspace-picker path, so a cold local Agent Host can publish session types later and recreate the draft before the preference is applied.
  • Respect availability and settings: The Dev Container preference is honored only when chat.agentHost.devContainer.enabled is enabled and the local folder passes the existing asynchronous availability check. Unsupported folders remain unchecked.

Changes

  • Pass the source editor workspace through the existing Agents Window handoff.
  • Decode Dev Container remote authorities in the Agents Window to recover the local host folder and preference.
  • Open and retain the new-session composer by cancelling startup restoration for this explicit handoff.
  • Apply the Dev Container preference through the composer retry path after the local provider creates a draft and resolves workspace availability.
  • Add focused coverage for the editor action, URI parsing and setting gate, cold provider startup, restore race, and asynchronous availability/cancellation.

Validation

  • 11 focused unit tests passing
  • ESLint
  • Client typecheck
  • Layer validation
  • Hygiene and diff checks

Refs #317380

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 3, 2026 13:07
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Base: be6bce25 Current: 718495b5

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

Ordinary local workspaces are incorrectly marked as Dev Container-preferred, and cold Agent Host startup can lose the requested handoff.

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

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

New issues introduced by this change (3)
Severity Finding
Medium severity src/​vs/​sessions/​contrib/​chat/​electron-browser/​chat.contribution.tsresolveWorkspace() is not a readiness check: the local Agent Host provider resolves every file:
Medium severity src/​vs/​workbench/​contrib/​chat/​electron-browser/​agentSessions/​agentSessionsActions.ts — This marks every ordinary file: workspace handoff as preferring a Dev Container, not just…
Low severity src/​vs/​sessions/​services/​sessions/​browser/​sessionsService.ts — This new branch makes the existing _restoreCts and _cancelRestore documentation inaccurate:…
What changed in this PR

Adds Dev Container-aware Open in Agents handoff support.

Changes:

  • Decodes Dev Container authorities to local folders.
  • Propagates and applies a Dev Container preference.
  • Cancels startup restoration and adds focused tests.
File Description
agentSessionsActions.test.ts Tests workspace handoff options.
agentSessionsActions.ts Decodes Dev Container workspace authorities.
sessionsManagementService.test.ts Tests restoration cancellation.
sessionsService.ts Adds optional restoration cancellation.
localAgentHostSessionsProvider.test.ts Tests asynchronous preference handling.
localAgentHostSessionsProvider.ts Tracks pending Dev Container preferences.
agentsWindowOpenIntent.test.ts Tests preference gating and routing.
chat.contribution.ts Handles the incoming handoff intent.
agentsWindowOpenIntent.ts Creates and configures the preferred draft.
agentHostSessionsProvider.ts Extends the Agent Host provider contract.
windowsMainService.ts Forwards preference through window IPC.
windows.ts Extends the window service API.
nativeHostMainService.ts Propagates the native handoff option.
native.ts Adds the native option type.

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

Comment thread src/vs/sessions/contrib/chat/electron-browser/chat.contribution.ts Outdated
Comment thread src/vs/sessions/services/sessions/browser/sessionsService.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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

🔵 Needs a closer look

The restoration implementation still documents an invariant contradicted by the new cancellation path.

Review tier: Balanced
Findings: None

Issues resolved since last review (3)
Severity Finding
Low severity src/​vs/​sessions/​services/​sessions/​browser/​sessionsService.ts — This new branch makes the existing _restoreCts and _cancelRestore documentation inaccurate:… View resolved comment
Medium severity src/​vs/​workbench/​contrib/​chat/​electron-browser/​agentSessions/​agentSessionsActions.ts — This marks every ordinary file: workspace handoff as preferring a Dev Container, not just… View resolved comment
Medium severity src/​vs/​sessions/​contrib/​chat/​electron-browser/​chat.contribution.tsresolveWorkspace() is not a readiness check: the local Agent Host provider resolves every file:View resolved comment
Suppressed comments (1)

src/vs/sessions/services/sessions/browser/sessionsService.ts:1056

  • This new cancellation path leaves the comment in _restoreVisibleSessions (around line 1472) contradictory: it still says the restore token is cancelled only when the user explicitly opens a session. Please document the cancelRestore new-session exception there as well so the restore lifecycle has one consistent contract.
		if (options?.cancelRestore) {
			this._cancelRestore();

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@chrmarti
Christof Marti (chrmarti) marked this pull request as ready for review September 4, 2026 10:07
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

Benjamin Christopher Simmonds (@benibenj)

Matched files:

  • src/vs/sessions/browser/parts/chatGroupView.ts
  • src/vs/sessions/browser/parts/chatGroupsView.ts
  • src/vs/sessions/browser/parts/chatView.ts
  • src/vs/sessions/browser/parts/sessionView.ts

Sandeep Somavarapu (@sandy081)

Matched files:

  • src/vs/sessions/services/sessions/browser/sessionsService.ts
  • src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts

Ladislau Szomoru (@lszomoru)

Matched files:

  • src/vs/sessions/services/sessions/browser/sessionsService.ts
  • src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts

@chrmarti
Christof Marti (chrmarti) merged commit c772f67 into main Sep 4, 2026
40 checks passed
@chrmarti
Christof Marti (chrmarti) deleted the chrmarti/open-in-agents-devcontainer branch September 4, 2026 10:49
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants