Skip to content

automations: fix: restore provider configuration and custom agents - #335595

Draft
Ulugbek Abdullaev (ulugbekna) wants to merge 8 commits into
ulugbekna/fix-automation-worktree-gatingfrom
ulugbekna/automation-config-followups
Draft

automations: fix: restore provider configuration and custom agents#335595
Ulugbek Abdullaev (ulugbekna) wants to merge 8 commits into
ulugbekna/fix-automation-worktree-gatingfrom
ulugbekna/automation-config-followups

Conversation

@ulugbekna

@ulugbekna Ulugbek Abdullaev (ulugbekna) commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Automation provider configuration and custom-agent follow-ups

Contents

Context

An automation separates its execution target from its provider-owned session template. The target selects the provider, workspace, isolation mode, and branch. The template holds model configuration, custom-agent selection, and native preferences such as Mode, Approvals, and Cloud Sandbox.

Editing and executing an automation must preserve those preferences without turning them into permanent permission grants. The provider's current capabilities and policy still determine the effective runtime behavior. Both the browser fallback executor and the durable Agent Host executor must pass the selected model and custom agent to the first turn.

Stack and review scope

This draft extracts the eight provider-configuration and custom-agent fixes from the already-merged #335018.

The draft is #335595. It intentionally remains a draft with automatic merging disabled.

The review stack is:

  1. #335591: the full revert of the original fifteen-fix PR.
  2. #335593 (ulugbekna/fix-automation-worktree-gating): the smaller seven-commit worktree-discovery, branch-picker, validation, and startup repair.
  3. This draft, ulugbekna/automation-config-followups: the remaining eight logical commits, based on the smaller worktree branch rather than main.

Review this draft against #335593, on ulugbekna/fix-automation-worktree-gating. Its diff is limited to ten files covering provider configuration, custom-agent execution, and their regression tests.

There are no standalone worktree-capability, New Worktree gating, branch-search, or worktree-pending-startup changes in this draft. Those belong to its base. There are also no shared ActionList or IME changes. The Codex worktree changes here specifically preserve custom-agent identity and instructions during worktree execution.

Restored fixes

Cloud model selection and canonical preferences

Restoring a Cloud model previously updated the visible selection without consistently updating the extension's model option. The shared model-update path now synchronizes both representations, including when the extension's option catalogue arrives later.

Canonical template configuration takes precedence over legacy mode and permission aliases. Unknown provider values remain intact so saving an automation does not erase preferences the current provider cannot interpret. Unsupported Cloud permission changes are no-ops: they do not silently replace the saved canonical preference or change Cloud's effective default permissions.

Fallback CLI approvals

The fallback CLI keeps a restored approval preference separately from its policy-effective value. Current policy controls display and execution; an unchanged saved preference survives capture so editing an automation does not accidentally replace its intent with a temporary policy restriction.

Cloud Sandbox execution

Cloud Sandbox is part of the automation's own captured template and is restored independently of the ordinary composer's remembered choice. Legacy definitions retain their previous fallback behavior until their first capture. The existing Sandbox control is available in Automation controls and remains gated by AI visibility.

The original regression does not enable unsupported Cloud worktree or branch configuration is rehomed into this commit rather than the smaller worktree PR. It asserts that Cloud does not acquire worktree support, isolation or branch values, and captures { autoApprove: Default, useSandbox: false }. It requires these Cloud fixes and therefore belongs with them.

First-turn custom agents

The Agent Host executor inherits the creation-time custom agent into the first message, independently of model inheritance. An explicit first-message selection still takes precedence. Fallback-provider tests also cover sending the restored custom agent on the first automation request.

Codex custom agents in worktrees and restored sessions

Codex resolves a selected native workspace agent against the host-owned worktree when preparing customization launch. Host worktree metadata and canonical repository roots establish the relationship; the persisted agent URI is not rewritten.

This keeps agent instructions available on repeated turns, after reapplying the same selection, and after provider reload, including linked source checkouts. Plugin and external selections are not redirected. Existing telemetry injection and workspace-less customization directories are preserved.

Native configuration controls

Automation controls reuse the provider's existing enum and boolean pickers so equivalent settings remain consistent across surfaces. Generic controls do not duplicate the dedicated worktree, branch, Mode, or Approvals controls and do not expose transient session-only configuration.

The existing Dev Container handoff remains separate. The extraction preserves the current picker constructor options and the upstream relocation of the Dev Container control.

Intentional limits

  • Cloud worktrees, workspace-less Cloud sessions, and Cloud custom agents remain unsupported.
  • Saved mode and approval values are preferences, not grants that bypass current policy.
  • Existing remote/container hosts continue to use their provider boundary; transient local Dev Container handoff is not a new template field.
  • No new protocol fields, dependencies, settings, policy channels, or architecture changes are introduced.
  • This is a scope split of existing fixes, not a new feature or refactor.

Commit inventory

Original commit Extracted commit Logical fix
1b7e62e17e3 df4ac6382b1 Synchronize restored Cloud model options
1f44f2eaac3 173f1775aba Preserve canonical Cloud configuration
507adda226c deabc94ebcb Ignore unsupported Cloud permission overrides
4d4c118577e f870ec0dc06 Clamp restored CLI approval preferences
afc2e297266 558f45ca91d Persist Cloud Sandbox choices and rehome the Cloud-only regression
6eb7c964c2a a2edf971fb6 Retain custom agents on the first run turn
d5884de7f7e 564cd05e5e5 Retain Codex workspace agents across worktree turns and reloads
c461304d323 66ee5f960b0 Expose native provider configuration controls

There are exactly eight commits above base 790568f194ff986449c9c1fb62142149fc8e09d7. The draft head is 66ee5f960b032875783ab5c1779499cb4142cab2.

Validation

  • npm run typecheck-client: passed.
  • npm run transpile-client: passed.
  • The five requested test files ran in one existing Electron runner invocation: 308 passing, 0 failing.
  • git diff --check against the stacked base: passed.
./scripts/test.sh \
  --run src/vs/sessions/contrib/providers/copilotChatSessions/test/browser/copilotChatSessionsProvider.test.ts \
  --run src/vs/sessions/contrib/providers/copilotChatSessions/test/browser/sandboxPicker.test.ts \
  --run src/vs/sessions/contrib/providers/agentHost/test/browser/agentHost/agentHostSessionConfigPicker.test.ts \
  --run src/vs/platform/agentHost/test/node/agentHostAutomationService.test.ts \
  --run src/vs/platform/agentHost/test/node/codex/codexPrewarmEviction.test.ts

The passing coverage includes the rehomed Cloud worktree/branch regression, canonical and late Cloud model restoration, Sandbox feature gating, policy-effective CLI approvals, native configuration controls, first-message selections, and Codex worktree/provider-reload behavior.

Draft readiness and CI

The branch is pushed and clean, with eight commits across ten files. The current GitHub check snapshot reports CLA and Dependencies Check passing, VS Code PR Check pending, and no failed checks or unresolved review comments.

The main Code OSS, Component Fixtures and CodeQL workflows only trigger for pull requests targeting main or release branches. They are not running for this draft's feature-branch base. Local validation is complete, but this must not be described as full GitHub CI coverage.

Keep this draft stacked on #335593 while the revert and smaller fix are reviewed. Once those prerequisites land, rebase/retarget this draft onto main, review the eight follow-ups, and run the normal main-targeted checks before considering it ready.

Exact-tree guarantee

The complete stacked tree is byte-for-byte identical to main at 5e142ece6c7aeb3d5f56892328b7300f15de8b36, including unrelated upstream changes.

git diff --exit-code 5e142ece6c7aeb3d5f56892328b7300f15de8b36 HEAD

The command exits successfully with no output. Both trees have Git tree ID 62f713c2aa784ad9fb7df897d327822dcf79cc5b. This verifies that the revert, smaller worktree repair, and eight follow-ups only restructure the existing fix and do not introduce content drift.

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
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.

1 participant