automations: fix: honor worktree and provider session configuration - #335018
Merged
Ulugbek Abdullaev (ulugbekna) merged 15 commits intoSep 10, 2026
Merged
Conversation
Copilot started reviewing on behalf of
Ulugbek Abdullaev (ulugbekna)
September 8, 2026 09:10
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Workspace-specific worktree validation remains incomplete, allowing unsupported targets to be re-enabled or created through the Automation tool.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 2
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/vs/sessions/contrib/automations/browser/automationDialog.ts — This does not fully prevent re-enabling an unsupported saved target. After unchecking Worktree,… |
|
src/vs/sessions/services/sessions/common/sessionsProvider.ts — The new workspace-specific capability is not consulted by ConfigureAutomationTool:… |
What changed in this PR
This PR preserves provider-owned worktree and session configuration across Automation editing, execution, and Agent Host restarts.
Changes:
- Adds workspace-specific provider worktree discovery and remote branch filtering.
- Persists models, agents, sandbox, modes, and effective approval preferences correctly.
- Fixes Agent Host worktree initialization and Codex custom-agent routing.
| File | Description |
|---|---|
src/vs/sessions/SESSIONS.md |
Documents provider-owned worktree discovery. |
src/vs/sessions/services/sessions/common/sessionsProvider.ts |
Adds the worktree-options provider API. |
src/vs/sessions/contrib/automations/browser/automationDialog.ts |
Integrates provider branch and capability discovery. |
src/vs/sessions/contrib/automations/test/browser/automationDialog.test.ts |
Covers Automation worktree behavior. |
src/vs/sessions/contrib/chat/browser/branchPicker.ts |
Adds asynchronous branch filtering states. |
src/vs/platform/actionWidget/browser/actionList.ts |
Handles canceled IME-driven dynamic filtering. |
src/vs/platform/actionWidget/test/browser/actionList.test.ts |
Tests dynamic-filter restart behavior. |
src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts |
Implements Agent Host worktree options and template capture. |
src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionConfigPicker.ts |
Exposes provider configuration in Automations. |
src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostSessionConfigPicker.test.ts |
Tests Automation configuration controls. |
src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts |
Covers local Agent Host configuration persistence. |
src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts |
Tests remote worktree discovery. |
src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.ts |
Preserves Cloud and fallback CLI preferences. |
src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.ts |
Adds Sandbox to Automation controls. |
src/vs/sessions/contrib/providers/copilotChatSessions/test/browser/copilotChatSessionsProvider.test.ts |
Tests model, sandbox, agent, and approval restoration. |
src/vs/sessions/contrib/providers/copilotChatSessions/test/browser/sandboxPicker.test.ts |
Verifies Sandbox menu visibility. |
src/vs/platform/agentHost/node/agentService.ts |
Marks generated sessions worktree-pending before creation. |
src/vs/platform/agentHost/test/node/agentService.test.ts |
Tests pending-state timing and cleanup. |
src/vs/platform/agentHost/node/agentHostAutomationService.ts |
Inherits initial model and agent selections. |
src/vs/platform/agentHost/test/node/agentHostAutomationService.test.ts |
Tests first-message selection inheritance. |
src/vs/platform/agentHost/node/codex/codexAgent.ts |
Resolves workspace agents inside worktrees. |
src/vs/platform/agentHost/test/node/codex/codexPrewarmEviction.test.ts |
Covers Codex prewarming and agent restoration. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Ulugbek Abdullaev (ulugbekna)
force-pushed
the
ulugbekna/agents/disable-new-worktree-automations
branch
from
September 8, 2026 09:41
5e63915 to
174a44d
Compare
Ulugbek Abdullaev (ulugbekna)
force-pushed
the
ulugbekna/agents/disable-new-worktree-automations
branch
from
September 10, 2026 16:38
80d9e48 to
48230e4
Compare
Ulugbek Abdullaev (ulugbekna)
marked this pull request as ready for review
September 10, 2026 21:49
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Sandeep Somavarapu (@sandy081)Matched files:
Ladislau Szomoru (@lszomoru)Matched files:
|
Ulugbek Abdullaev (ulugbekna)
force-pushed
the
ulugbekna/agents/disable-new-worktree-automations
branch
from
September 10, 2026 21:58
48230e4 to
f824999
Compare
Ulugbek Abdullaev (ulugbekna)
marked this pull request as draft
September 10, 2026 22:01
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Consult provider-owned workspace capabilities before accepting an explicit worktree target. Preserve legacy providers and unrelated edits, propagate lookup failures, and cancel pending validation without writing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Keep the saved-branch exception only while Worktree is already selected. After opting out, require available repository branches before enabling isolation again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
Ulugbek Abdullaev (ulugbekna)
force-pushed
the
ulugbekna/agents/disable-new-worktree-automations
branch
from
September 10, 2026 22:10
f824999 to
25b984c
Compare
Ulugbek Abdullaev (ulugbekna)
marked this pull request as ready for review
September 10, 2026 22:11
Ulugbek Abdullaev (ulugbekna)
enabled auto-merge (squash)
September 10, 2026 22:11
Anthony Kim (anthonykim1)
approved these changes
Sep 10, 2026
Ulugbek Abdullaev (ulugbekna)
deleted the
ulugbekna/agents/disable-new-worktree-automations
branch
September 10, 2026 23:01
This was referenced Sep 10, 2026
Ulugbek Abdullaev (ulugbekna)
added a commit
that referenced
this pull request
Sep 10, 2026
Revert 1328607 (#335018) so the worktree availability fix and unrelated provider configuration changes can be reviewed separately. Preserve subsequent main changes and the independent ActionList PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e4e70d7c-fbe2-487b-a6c5-177af2abae2f
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
An automation stores two different kinds of state. Its target identifies the provider, agent/session type, workspace, isolation mode, and base branch. Its provider-owned session template stores model selection and model options, a custom agent, and native configuration such as Mode and Approvals.
Both must survive editing and later execution. The browser can dispatch a legacy automation, while a migrated automation runs directly in the Agent Host, including after a host restart. Saved preferences are not permission grants: the current provider schema and managed policy still determine effective behavior.
What was broken
The Automation dialog gated New Worktree on a Copilot-CLI-only declaration, even though worktree isolation is implemented by the shared host for other agents, including Claude and Codex. It also asked the local Git extension for every target's repository. That extension rejects remote workspace URIs, so merely enabling the checkbox would not fix remote automations.
Several adjacent configuration paths were also incomplete:
How the fixes work
Provider-owned worktree discovery
ISessionsProvider.getWorktreeOptionsnow exposes workspace-specific worktree support, the current branch, initial branch choices, and an optional loader for incomplete result sets.Agent Host providers resolve these choices on the selected host. Branch searches reuse that resolved configuration rather than re-resolving the full schema for every query. Providers without the operation retain the existing local Git path.
This keeps shared Automation UI provider-neutral. The static Agent Host declaration no longer singles out Copilot; the host's workspace schema determines whether worktrees can actually be chosen.
Remote completion windows are not treated as complete branch inventories. A saved or searched branch outside the initial window is not falsely marked unavailable. Search immediately removes selectable stale results, exposes loading, and supports retry. Related target/provider notifications are coalesced before starting repository work. Shared IME cancellation behavior is explicitly outside this PR's scope.
If a saved Worktree target becomes unsupported, its checkbox can still be unchecked. After opting out, normal repository availability checks must pass before Worktree can be enabled again. Explicit worktree targets submitted through the automation tool also resolve workspace-specific support before persistence.
Provider-native session controls and preferences
The Automation controls reuse native provider configuration pickers. Generic enum/boolean settings are available alongside dedicated provider Mode and Approvals controls, without duplicating worktree/branch controls or exposing transient/session-only fields.
Cloud automations can display and save the existing Sandbox choice. Restoration does not rewrite ordinary-composer defaults. Explicit picker changes retain the existing shared-default semantics.
Cloud model selection now synchronizes its extension option through the same path for interactive changes, template restoration, and late option discovery. Canonical values take precedence over compatibility aliases, and unknown provider preferences remain intact.
Fallback CLI approvals retain the saved preference separately from the policy-effective observable value. Display and execution use the effective value; capture preserves unchanged intent.
Execution and custom agents
The first host automation message inherits creation-time model and agent selections independently, while preserving explicit message overrides.
Session IDs are allocated before provider creation, so both supplied and generated IDs are worktree-pending before eager provider work can start. Failure paths clear the pending state.
Codex resolves original workspace-agent selections at customization launch using host worktree metadata and canonical repository roots. It preserves the original persisted selection rather than rewriting protocol identity. Regression coverage includes repeated
changeAgentcalls, provider reload, linked source checkouts, and plugin/external selections that must not be redirected.Provider coverage and intentional limits
Cloud custom agents and workspace-less Cloud sessions remain unsupported. Transient local Dev Container handoff controls are not newly made into Automation template fields; selecting an existing remote/container host continues through the remote-provider boundary. No new protocol fields, user settings, dependencies, or policy channels are introduced.
Shared ActionList scope
This PR makes no changes to
src/vs/platform/actionWidget/browser/actionList.tsor its tests. The two shared IME fixes have been removed from this branch and are delivered separately in #335578.This deliberately allows the provider/worktree fixes to land without changing a component consumed by many unrelated surfaces. Until the separate IME fix lands, cancelling IME composition during a pending remote branch search while retaining the same query can leave that picker loading. Changing the query or reopening the picker remains the workaround. That edge case is not claimed fixed by this PR.
Resolved follow-up fixes
The two worktree follow-up fixes remain in this PR. The shared IME follow-up has moved to separate delivery:
getWorktreeOptionsbefore creation or update. Missing repositories and unsupported results become tool input errors. Registered legacy providers without the optional operation keep their previous behavior. Cancellation interrupts a pending lookup without writing; provider errors propagate rather than becoming successful targets. Non-worktree and unrelated partial updates do not perform repository discovery.All four Astra lenses reviewed the complete six-file follow-up diff and returned Ship, with no findings or file modifications.
Rebase on current main
The original fixes were subsequently rebased onto
5559183ea8eeb0fda5cdce67967f9bdc3af6e2e5. Resolutions preserve upstream combobox/type-to-filter tests, Codex workspace-less customization filtering and telemetry, relocated Dev Container controls, and updated provider imports. The reload regression now answers the upstream thread metadata read before resume. Test adaptations remain folded into the owning fixes.The later extraction removed exactly the two ActionList commits: both shared files match the base, and every other file is byte-for-byte identical to the pre-extraction branch. Both handled Copilot review threads remain resolved.
Validation
After removing the shared ActionList changes:
Rebase validation:
Follow-up validation:
npm run typecheck-client, six-file ESLint,git diff --check, and each commit's normal hygiene hook passed.Earlier validation of the original implementation:
npm run typecheck-clientpassed.npm run valid-layers-checkpassed.git diff --checkpassed.The replay scenarios use committed model traffic, not live model services. Cloud and arbitrary remote deployment behavior is covered at the provider-adapter boundary; no paid Cloud runs or live third-party remote-host jobs were launched.
Review
Two complete independent four-lens Astra reviews covered architecture, performance, UI/UX, and correctness/simplicity. All findings were addressed with regressions. Astra then independently verified the final IME-cancellation and duplicate-lookup follow-ups and reported no remaining evidence-backed issues in those repairs.
Later Copilot review identified two worktree validation issues, and a shared-component scope review identified the completed-request retry concern. A complete four-lens Astra review of the follow-up fixes returned Ship in every lens. The two worktree fixes remain here; the reviewed shared-component fixes have since been deliberately extracted for independent landing.