Prefer Copilot harness once for editor sessions#326178
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces opt-in preference and one-time migration toward Agent Host Copilot for editor chat sessions.
Changes:
- Replaces the provider enum with
chat.editor.preferCopilotHarness. - Adds persisted one-time migration state and provider resolution.
- Updates session creation, restoration, picker behavior, and tests.
Show a summary per file
| File | Description |
|---|---|
constants.test.ts |
Tests provider preference and migration behavior. |
constants.ts |
Implements default-provider and migration resolution. |
chatSessionTypePreference.ts |
Persists the migration marker. |
chatViewPane.ts |
Applies preference during panel restoration. |
sessionTargetPickerActionItem.ts |
Reacts to the new setting. |
chatActions.ts |
Uses migration-aware resolution for new sessions. |
agentHostEnablementService.ts |
Registers the boolean setting. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 5
- Review effort level: Medium
roblourens
previously approved these changes
Jul 16, 2026
Add the `chat.editor.preferCopilotHarness` setting (replacing the `chat.editor.defaultProvider` enum). When enabled, an existing local editor chat session is swapped to the Agent Host Copilot CLI exactly once, guarded by a persisted marker (CHAT_PREFERRED_COPILOT_HARNESS_STORAGE_KEY). The one-time swap only fires when the agent host is enabled, since the Copilot harness is otherwise unavailable. The setting has no other effect: it does not change the computed default provider or editor session-type visibility for fresh users, so leaving it off (the default) preserves today's behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
TylerLeonhardt
force-pushed
the
tyleonha/prefer-copilot-harness
branch
from
July 16, 2026 17:49
f80dfbb to
7a5a9f6
Compare
The comment referenced the `chat.editor.preferCopilotHarness` setting selecting a provider, but that setting no longer drives the computed default. Describe the actual behavior: acquire the computed default when it is non-local, else fall back to a local session. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
TylerLeonhardt
marked this pull request as draft
July 16, 2026 17:58
`resolveDefaultNewChatSessionType` set the migration marker as a side effect of
merely computing the type, so callers that discarded the result (notably the
editor New Chat path, which called `widget.clear()`) consumed the one-time swap
without ever applying it. The editor then stayed on Local, and the marker
blocked any future swap.
Make `resolveDefaultNewChatSessionType` pure: it returns
`{ sessionType, isPreferCopilotHarnessSwap }` and no longer writes the marker.
Callers persist the marker only when they actually apply the swap:
- The sidebar path in `clearChatSessionPreservingType` marks after loading the
swapped session.
- `clearChatEditor` now resolves the swap for a local editor session, opens a
Copilot editor, and marks it there instead of recomputing a swap-unaware
default via `getDefaultNewChatSessionResource`.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
TylerLeonhardt
marked this pull request as ready for review
July 16, 2026 18:43
TylerLeonhardt
enabled auto-merge (squash)
July 16, 2026 18:43
pwang347
approved these changes
Jul 16, 2026
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.
What
Base PR of a stacked pair. Adds the
chat.editor.preferCopilotHarnesssetting (replacing thechat.editor.defaultProviderenum).When enabled, an existing local editor chat session is swapped to the Agent Host Copilot CLI exactly once, guarded by a persisted marker (
CHAT_PREFERRED_COPILOT_HARNESS_STORAGE_KEY).The one-time swap only fires when the agent host is enabled — we don't try to swap to a Copilot harness that isn't available. The setting has no other effect: it does not change the computed default provider or editor session-type visibility, so leaving it off (the default) preserves today's behavior. Fresh users are unaffected by this PR.
Scope
chat.editor.preferCopilotHarnesssetting.resolveDefaultNewChatSessionType, gated on the marker andagentHostEnabled.agentHostEnabled(fromIAgentHostEnablementService) into the swap path (clearChatSessionPreservingTypeand its callers).constants.test.ts(including the agent-host gate and the once-only marker).Stacked follow-up
The stacked PR (#326086) builds on this to make Agent Host Copilot the default for both editor and panel chat whenever the agent host is enabled (i.e. for first-time users), while
preferCopilotHarnessstays scoped to this one-time migration.