Skip to content

Preserve session target when using Send to New Chat#295185

Merged
meganrogge merged 5 commits intomainfrom
copilot/fix-session-target-reset
Feb 17, 2026
Merged

Preserve session target when using Send to New Chat#295185
meganrogge merged 5 commits intomainfrom
copilot/fix-session-target-reset

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

  • Analyze the issue: "Create new session" tip resets Session Target to Local
  • Identify root cause: SendToNewChatAction always calls widget.clear() which creates a local session
  • Initial fix: Add session type preservation to SendToNewChatAction
  • Refactor: Extract shared clearChatSessionPreservingType helper used by both SendToNewChatAction and runNewChatAction to avoid code duplication (per reviewer feedback)
Original prompt

This section details on the original issue you should resolve

<issue_title>Create new session tip resets Session Target to Local</issue_title>
<issue_description>
Steps to Reproduce:

  1. See tip to Create new session (I forget the exact words)
  2. Change Session Target from Local to Claude (or Background or Cloud)
  3. Click the link in the tip
  4. 🐛 Session Target goes back to Local
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

When clicking the "Send to New Chat" tip or using the Ctrl+Shift+Enter
shortcut, the Session Target (e.g., Claude, Background, Cloud) was
resetting to Local because widget.clear() always creates a new local
session.

Now the SendToNewChatAction checks the current session type and, for
non-local sessions in the sidebar, calls view.loadSession() with a new
resource of the same type instead of widget.clear(). This follows the
same pattern already used by the New Chat action (chatNewActions.ts).

Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix session target reset when creating new session Preserve session target when using Send to New Chat Feb 13, 2026
Copilot AI requested a review from meganrogge February 13, 2026 15:15
@meganrogge
Copy link
Collaborator

@copilot should we share code between this and the newChatAction so it's not redundant?

Extracted the session-type-preservation logic into a shared
clearChatSessionPreservingType function in chatActions.ts, used by
both SendToNewChatAction and runNewChatAction to avoid duplication.

Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot should we share code between this and the newChatAction so it's not redundant?

Extracted the shared logic into clearChatSessionPreservingType in chatActions.ts, now used by both SendToNewChatAction and runNewChatAction. Also removed the now-unused getResourceForNewChatSession from chatNewActions.ts. See 838c485.

@meganrogge meganrogge marked this pull request as ready for review February 17, 2026 19:52
Copilot AI review requested due to automatic review settings February 17, 2026 19:52
@meganrogge meganrogge enabled auto-merge (squash) February 17, 2026 19:54
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes an issue where the "Send to New Chat" action and the "Create new session" tip were resetting the Session Target to Local instead of preserving the user's selected session type (e.g., Claude, Cloud, Background).

Changes:

  • Extracted a shared helper function clearChatSessionPreservingType() to avoid code duplication between SendToNewChatAction and runNewChatAction
  • Updated both actions to use the new helper, ensuring session type is preserved when creating new chat sessions
  • Removed the now-unused getResourceForNewChatSession() helper from chatNewActions.ts

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/vs/workbench/contrib/chat/browser/actions/chatActions.ts Added the new shared clearChatSessionPreservingType() helper function and necessary imports
src/vs/workbench/contrib/chat/browser/actions/chatNewActions.ts Removed duplicated logic and unused helper, now uses shared clearChatSessionPreservingType()
src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts Updated SendToNewChatAction to use shared clearChatSessionPreservingType() helper

@meganrogge meganrogge merged commit d914404 into main Feb 17, 2026
24 checks passed
@meganrogge meganrogge deleted the copilot/fix-session-target-reset branch February 17, 2026 20:08
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.

Create new session tip resets Session Target to Local

3 participants