Repository navigation
chat: allow cloud sandbox creation from the editor window - #340817
Merged
Osvaldo Ortega (osortega) merged 10 commits intoOct 14, 2026
Merged
Conversation
The editor window could only discover and resume existing cloud sandbox sessions; creating one required the Agents window. Lift provisioning and creation-progress tracking into the shared CloudSandboxSessionContribution so both windows use the same provision -> seed -> connect path, and expose a "GitHub Sandbox" creation target in the editor's chat session picker. - Base contribution gains _provisionSandbox() and trackSessionCreationProgress(); the Agents-window subclass delegates to them. - CloudSandboxSessionListController tracks provisional sessions and resolves the working directory to the chosen repository (or the host default when no repository is selected). - EditorCloudSandboxSessionContribution registers a visible picker type with a repository option group, implements newChatSessionItem with a cancellable progress notification, and rebinds the untitled draft to the per-environment session type once the sandbox is connected. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Repository-less sessions can incorrectly inherit a local workspace path, provisional state lacks production cleanup, and the owning specification remains outdated.
3 open findings
What changed in this PR
Enables cloud sandbox creation from the editor chat session picker while sharing provisioning logic with the Agents window.
Changes:
- Adds repository-aware sandbox creation and progress reporting.
- Tracks provisional sessions and working directories.
- Refactors shared sandbox provisioning and adds editor tests.
| File | Description |
|---|---|
editorCloudSandboxContribution.test.ts |
Tests editor sandbox creation flows. |
editorCloudSandboxContribution.ts |
Adds the picker target and creation workflow. |
cloudSandboxSessionListController.ts |
Tracks provisional repositories and directories. |
cloudSandboxSessionContribution.ts |
Centralizes provisioning and progress logic. |
cloudSandboxAgentHostContribution.ts |
Delegates Agents-window provisioning to the shared implementation. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Wire remote Agent Host session materialization through IChatSessionsService.notifySessionMaterialized so provisional repository state is released once the first turn is accepted, matching the local contribution. - Let a session type signal that the host must choose the working directory: the resolver service and handler config accept an explicit null, which short-circuits the local new-session/workspace fallbacks. "No Repository" sandbox sessions use it instead of relying on the host advertising a default directory. - Update the provider specification to describe cross-window sandbox creation. Co-authored-by: Copilot <[email protected]>
Contributor
Rename the sandbox host group, creation provider, editor session types and models vendor from "GitHub Sandbox(es)" to "Cloud" so both windows use the same name as the environment they already fold into. Replace the package workspace type icon with the cloud glyph and give the host group a cloud icon. Identity stays on ids, so existing sessions, stored picks and filters are unaffected. Co-authored-by: Copilot <[email protected]>
…type The repository picker collapses its default item to an icon, so the "No Repository" default rendered as a second cloud glyph beside the Cloud session type. Use the circle-slash glyph for it instead. Co-authored-by: Copilot <[email protected]>
Offer one repository per workspace root (origin first) instead of every remote, drop the picker when a single repository is implied, list only the roots for multi-root windows, and keep "No Repository" to empty windows, where a "Search Repositories..." command delegates to the extension's picker and records the choice on the draft. A folder without a GitHub remote now asks for a repository instead of silently starting empty. While the sandbox Cloud type is registered it replaces the extension's cloud agent in the editor picker, so there is a single Cloud entry whose backend follows the sandbox setting, as in the Agents window. Co-authored-by: Copilot <[email protected]>
…draft type The repository picker no longer lists "No Repository": leaving the "Select Repository" placeholder in place simply starts an empty sandbox, and a folder without a GitHub remote does the same instead of demanding a pick. When the sandbox setting is turned off the chat view's empty draft stayed bound to the now unregistered type, so the picker could neither show Cloud nor leave it. Start a fresh default draft when the current empty draft's type is withdrawn, as is already done when the displayed session is archived. Co-authored-by: Copilot <[email protected]>
A sandbox draft has no backend until its first send, so everything the chat input normally reads from a live Agent Host connection has to be supplied for the draft itself. Mirror what the Agents window does for its drafts: - Models: register a CloudSandboxModels pool under the creation type, fed by the shared cloud catalog, and mark the type as owning its models. The environment's handler accepts the creation type's identifiers as aliases, and the chat service re-keys the carried intended model into the environment's type so the picker reclaims the choice once that pool publishes. - Mode and approvals: move the draft vocabulary (createCloudSandboxSessionConfig) into the shared remoteAgentHost folder, present it as option groups on the draft, confirm the picks with the provisioned host, and hand them to the handler through a new resolveInitialSessionConfig hook on the connection customization. The Agents window provider reuses the shared validation. - Repository: pre-select a "Select Repository" placeholder when no workspace repository is known so the picker renders with only the search command; the placeholder is never offered as a choice and leaves the sandbox empty. Co-authored-by: Copilot <[email protected]>
Use one label for the placeholder and the command that opens the picker, and keep the group hover on what the repository is for. Co-authored-by: Copilot <[email protected]>
…-sandbox-creation # Conflicts: # src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts
…-sandbox-creation # Conflicts: # src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionListController.ts # src/vs/workbench/contrib/chat/test/browser/remoteAgentHost/editorCloudSandboxContribution.test.ts
Osvaldo Ortega (osortega)
marked this pull request as ready for review
October 14, 2026 05:07
Osvaldo Ortega (osortega)
enabled auto-merge (squash)
October 14, 2026 05:07
Vritant Bhardwaj (vritant24)
approved these changes
Oct 14, 2026
Comment on lines
+901
to
+905
| const created = await this._apiService.createSession(request, token); | ||
| const name = request.repoNwo ?? created.taskId; | ||
| const address = cloudSandboxAddress(created.environmentId); | ||
| if (!this._isEnabled() || token.isCancellationRequested || enabledToken.isCancellationRequested) { | ||
| throw new CancellationError(); |
Comment on lines
+156
to
+160
| seedProvisionalSession(metadata: IAgentSessionMetadata): void { | ||
| const rawId = AgentSession.id(metadata.session); | ||
| const project = metadata.project ? getGitHubRepositoryFromRemoteUrl(metadata.project.uri.toString(), ['github.com']) : undefined; | ||
| this._provisionalRepositories.set(rawId, project ? `${project.owner}/${project.repo}` : undefined); | ||
| this._sessionListStore.addPendingNewSession(CLOUD_SANDBOX_AGENT_PROVIDER, URI.from({ scheme: this.sessionType, path: `/${rawId}` })); |
| Agent discovery is dynamic. Changes to a host's advertised agents update the provider's session types without recreating the provider. | ||
|
|
||
| Both windows use [CloudSandboxSessionContribution](../../../../workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionContribution.ts) for sandbox discovery, connection-on-open, and offline history. Each supplies its own session-list adapter. Discovery remains account-wide; the Editor adapter scopes its list to the workspace's GitHub repositories, or all projects in an empty window, and groups its filters under Cloud. Repository scope applies to cached and connected sessions without changing their routing; opening one preserves its host and session identity and does not provision a replacement. Sandbox creation remains an Agents Window operation. The Editor keeps the discovery and environment providers registered for existing conversations but excludes them from the harness picker and automatic new-chat selection. | ||
| Both windows use [CloudSandboxSessionContribution](../../../../workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionContribution.ts) for sandbox discovery, connection-on-open, and offline history. Each supplies its own session-list adapter. Discovery remains account-wide; the Editor adapter scopes its list to the workspace's GitHub repositories, or all projects in an empty window, and groups its filters under Cloud. Repository scope applies to cached and connected sessions without changing their routing; opening one preserves its host and session identity and does not provision a replacement. Both windows create sandboxes through the shared contribution's provisioning path, which seeds the created task like a discovered one before connecting. The Editor offers a single `cloud-sandbox` creation target in the harness picker with a repository option group derived from the workspace's GitHub repositories plus "No Repository"; discovered environment providers stay registered for existing conversations but remain excluded from the picker and automatic new-chat selection. On the first send, the Editor provisions the sandbox, reports progress through a cancellable notification, and returns the item under the environment's own session type so the untitled draft rebinds to it. A selected repository resolves the new session's working directory to its GitHub URL for session preparation; "No Repository" explicitly leaves the working directory to the host rather than substituting a local workspace folder. |
Aiday Marlen Kyzy (aiday-mar)
approved these changes
Oct 14, 2026
Osvaldo Ortega (osortega)
deleted the
osortega/editor-cloud-sandbox-creation
branch
October 14, 2026 10:04
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
Today the editor window can only discover and resume existing cloud sandbox sessions; creating a new one requires the Agents window. This PR lets users create a cloud sandbox session directly from the editor's chat session picker, with the same draft experience the Agents window offers (repository, model, mode, approvals).
Design
A sandbox environment does not exist until it is provisioned, so a new session cannot be drafted under an environment's session type. Instead:
SessionType.CloudSandbox). New chats are drafted under it.newChatSessionItemprovisions the sandbox (Mission Control task → connect), confirms the draft's picks with the host, and returns an item under the environment's session type; the chat infrastructure rebinds the untitled draft to it.While the sandbox type is registered it replaces the extension's cloud agent in the editor picker, so there is always exactly one "Cloud" entry whose backend follows
chat.agentHost.cloudSandbox.enabled(as in the Agents window).What changed
Shared (
workbench/contrib/chat/browser/remoteAgentHost)CloudSandboxSessionContribution— lifts_provisionSandbox()/trackSessionCreationProgress()out of the Agents-window subclass so both windows share one provision → seed → connect path; populates the connection customization withresolveInitialSessionConfigandmodelIdentifierAliases.cloudSandboxSessionConfig.ts— moved here fromvs/sessionsso both windows share the draft vocabulary; addsresolveCloudSandboxSessionConfig(host confirmation),createCloudSandboxDraftOptionGroups,readCloudSandboxDraftConfig.CloudSandboxSessionListController— tracks provisional repositories and draft config per session; resolves the working directory to the chosen repository, or explicitly leaves it to the host (null) for an empty sandbox.EditorCloudSandboxSessionContribution— the creation type, its option groups (repository / mode / approvals), aCloudSandboxModelspool fed by the cloud catalog, "Search Repositories…" (delegates to the extension's picker), andnewChatSessionItemwith a cancellable progress notification.Chat infrastructure
AgentHostSessionHandler— new config hooksresolveInitialSessionConfigandmodelIdentifierAliases;RequestedWorkingDirectorylets a type say "host chooses" without local fallbacks.chatServiceImpl— re-keys the carried intended model when a draft materializes under a different session type.constants.ts—isVisibleEditorChatSessionTypehidescopilot-cloud-agentwhilecloud-sandboxis registered.chatViewPane— when an empty draft's session type is withdrawn (feature turned off), starts a fresh default draft instead of leaving the picker on a dead type.Agents window
$(cloud)to match;CloudSandboxSessionsProviderreuses the shared config validation. No behavior change otherwise.Repository picker rules (same as the cloud agent's)
How to test
chat.agentHost.cloudSandbox.enabledandchat.remoteAgentHostsEnabled.Validation
npm run typecheck-client,npm run eslint -- <changed files>,npm run valid-layers-check— passednode test/unit/browser/index.js --browser chromium --run …):editorCloudSandboxContribution.test.ts— 88 passingcloudSandboxAgentHostContribution.test.ts+constants.test.ts— 146 passingchatService.test.ts(rekeyIntendedModel,backfillTransferredModel) — 8 passingagentHostFilterService.test.ts— 30 passingscripts/test.sh) was not usable in my container due to a pre-existing module-fetch flake that reproduces onmain; the browser runner was used instead.copilotChatSessionsProvider.test.tscould not be loaded by either runner here (import updated for the moved module; typecheck covers it).