Skip to content

Preserve session target when using Send to New Chat#295185

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-session-target-reset
Draft

Preserve session target when using Send to New Chat#295185
Copilot wants to merge 2 commits intomainfrom
copilot/fix-session-target-reset

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

Clicking the "Send to New Chat" tip (or Ctrl+Shift+Enter) while in a non-local session (Claude, Cloud, Background) resets the Session Target back to Local. This happens because SendToNewChatAction unconditionally calls widget.clear(), which always creates a new local session.

The fix mirrors the existing pattern in runNewChatAction (chatNewActions.ts): check the current session type from the resource URI scheme, and for non-local sidebar sessions, use view.loadSession() with a new resource of the same type instead of widget.clear().

// Before: always creates a local session
await widget.clear();

// After: preserves session type for non-local sessions
const currentResource = widget.viewModel?.model.sessionResource;
const currentSessionType = currentResource ? getChatSessionType(currentResource) : localChatSessionType;
if (isIChatViewViewContext(widget.viewContext) && currentSessionType !== localChatSessionType) {
    const newResource = URI.from({ scheme: currentSessionType, path: `/untitled-${generateUuid()}` });
    const view = await viewsService.openView(ChatViewId) as ChatViewPane;
    await view.loadSession(newResource);
} else {
    await widget.clear();
}
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
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

2 participants