Skip to content

Preserve explicit local chat editor sessions#324669

Merged
anthonykim1 merged 1 commit into
release/1.128from
anthonykim1/copilot-to-local-release-1.128
Jul 7, 2026
Merged

Preserve explicit local chat editor sessions#324669
anthonykim1 merged 1 commit into
release/1.128from
anthonykim1/copilot-to-local-release-1.128

Conversation

@anthonykim1

@anthonykim1 anthonykim1 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Resolves: #324648
Mirror main: #324672

Regressed by: #323914

  • Add explicitSessionType?: string to IChatEditorOptions so callers can preserve an explicit session picker choice when opening a new chat editor.
  • Set explicitSessionType: localChatSessionType in openChatSession only when the user picks Local for an editor session.
  • Make ChatEditorInput.resolve() honor explicit Local before applying last-used-agent/default-provider resolution, so switching from Copilot AH to Local starts a local session instead of resolving back to Copilot.
  • Make shouldReplaceEmptyLocalSession() skip replacing an empty session that was explicitly opened as Local, so it is not swapped back to the default provider on a later resolve.
  • Add unit tests covering both paths: starting a fresh explicit Local session, and preserving an already-resolved empty Local session.

Regression history:


Evidence:


Inspirations from:

  • The explicitSessionType branching in resolve() follows the existing options.target handling in the same method: ChatEditorInput.resolve().
  • The shouldReplaceEmptyLocalSession() guard extends the existing predicate rather than adding a new code path: shouldReplaceEmptyLocalSession.

Validation:

  • git diff --check clean.
  • npm run typecheck-client fails on unrelated src/vs/workbench/api/node/proxyResolver.ts(115,52) / resolveProxyByURL, which is outside this PR's touched files.
  • Added two unit tests in chatEditorInput.test.ts: explicit Local resolves to a fresh local session without consulting the default/last-used path, and an empty explicitly-Local session is preserved instead of replaced.

Manual test:

  1. Open a Copilot (AH) chat editor, then use the picker to switch to Local -> stays Local, no flicker back to Copilot.
  2. Repeat with chat.editor.defaultProvider set to a non-local provider -> explicit Local still sticks, including after a window reload with the empty session open.
  3. Open a plain new chat editor without an explicit picker choice -> existing default/last-used behavior is unchanged.

/cc @benvillalobos

Copilot AI review requested due to automatic review settings July 7, 2026 02:46
@anthonykim1 anthonykim1 self-assigned this Jul 7, 2026
@anthonykim1 anthonykim1 added this to the 1.128.0 milestone Jul 7, 2026
@anthonykim1 anthonykim1 marked this pull request as ready for review July 7, 2026 02:47

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.

Pull request overview

This PR fixes a regression (issue #324648) where switching from Copilot Agent Host to Local in the editor chat picker would flicker back to Copilot. Because local editor sessions open with a generic vscode-chat-editor resource, the editor input could not distinguish an explicit "Local" pick from a normal new-editor open, so last-used/default-provider resolution (reintroduced in #323914) would override the user's choice. The PR threads an explicit-intent signal through the editor options to preserve the Local selection.

Changes:

  • Add explicitSessionType?: string to IChatEditorOptions and set it to localChatSessionType in openChatSession only when the user picks Local for an editor session.
  • Make ChatEditorInput.resolve() honor an explicit Local choice before last-used/default-provider resolution, and make shouldReplaceEmptyLocalSession() skip replacing a session explicitly opened as Local.
  • Add unit tests covering a fresh explicit-Local session and preservation of an already-resolved empty Local session.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.ts Adds the explicitSessionType option to IChatEditorOptions with documentation of its narrow local-preservation purpose.
src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditorInput.ts Prioritizes explicit Local in resolve() and prevents empty-local-session replacement when Local was explicitly chosen.
src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts Sets explicitSessionType: localChatSessionType when opening a Local editor session from the picker.
src/vs/workbench/contrib/chat/test/browser/widgetHosts/editor/chatEditorInput.test.ts New tests validating explicit-Local start and empty-local-session preservation.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Medium

@bhavyaus bhavyaus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tagging @DonJayamanne @benvillalobos also

@anthonykim1 anthonykim1 disabled auto-merge July 7, 2026 03:14
@anthonykim1 anthonykim1 enabled auto-merge (squash) July 7, 2026 03:16
@anthonykim1 anthonykim1 closed this Jul 7, 2026
auto-merge was automatically disabled July 7, 2026 03:18

Pull request was closed

@anthonykim1 anthonykim1 reopened this Jul 7, 2026
@anthonykim1 anthonykim1 enabled auto-merge (squash) July 7, 2026 03:18
@anthonykim1 anthonykim1 merged commit bff8736 into release/1.128 Jul 7, 2026
55 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/copilot-to-local-release-1.128 branch July 7, 2026 03:31
benvillalobos added a commit that referenced this pull request Jul 7, 2026
benvillalobos added a commit that referenced this pull request Jul 7, 2026
This reverts commit d97c4e5.
kycutler pushed a commit that referenced this pull request Jul 7, 2026
…#324826)

* cherry-pick b802a62

* signing commit

* Fix test

* Revert PR #324669

* Revert "Revert PR #324669"

This reverts commit d97c4e5.

* Preserve explicit local chat session branch

* Remove IStorageService

---------

Co-authored-by: Don Jayamanne <don.jayamanne@outlook.com>
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.

5 participants