Repository navigation
sessions: track preferred session type when no explicit user pick - #321141
Merged
Sandeep Somavarapu (sandy081) merged 4 commits intoJun 12, 2026
Merged
Conversation
The session type picker now distinguishes an explicit user pick from the active session's type. The stored preference is written only when the user explicitly picks a non-default type, and is cleared when the user re-selects the default (first) type. New chat creation reads the user pick when present, otherwise falls back to the preferred (first) session type for the folder and keeps tracking it as the folder's session-type list changes. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines how the Agents window selects a session type for new chats by separating an explicit user pick from the folder’s preferred default (first) session type, and updating draft-session recreation behavior to track late provider/session-type changes.
Changes:
- Update
SessionTypePickerto persist a session-type preference only on explicit user selection, exposegetUserPickedSessionType(), and compute a livegetPreferredSessionType(folderUri)as the folder’s first available type. - Update
NewChatWidgetdraft creation to prefer the user’s explicit pick when servable; otherwise fall back to the preferred (first) type, and recreate drafts when preferred changes (when there is no explicit pick). - Add unit tests covering preferred-type tracking, persistence across reload, and default re-selection semantics.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/chat/browser/sessionTypePicker.ts | Separates stored explicit pick from displayed active-session type; adds preferred-type computation and default re-selection storage behavior. |
| src/vs/sessions/contrib/chat/browser/newChatWidget.ts | Resolves draft session type via explicit pick vs preferred default; adjusts provider-change recreation rules accordingly. |
| src/vs/sessions/contrib/chat/test/browser/sessionTypePicker.test.ts | Adds coverage for preferred-type tracking and explicit-pick persistence/clearing behaviors. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 2
Alexandru Dima (alexdima)
previously approved these changes
Jun 12, 2026
- Keep the original storage key (sessions.lastSelectedSessionType) to avoid resetting existing users' persisted preference. - Persist the explicit selection regardless of whether the visible pick changed (it may reflect the active session): picking the default clears the stored preference, any other pick stores it; only fire onDidSelectSessionType when the visible pick actually changes. Co-authored-by: Copilot <[email protected]>
Benjamin Christopher Simmonds (benibenj)
approved these changes
Jun 12, 2026
Sandeep Somavarapu (sandy081)
deleted the
sandy081/session-type-default-pref
branch
June 12, 2026 15:08
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Reworks how the Agents window decides which session type a new chat uses, so that the picker distinguishes an explicit user pick from the preferred (first) session type for the folder.
Picker (
sessionTypePicker.ts)getUserPickedSessionType()returns the explicit pick (orundefinedif the user never picked / re-selected the default).getPreferredSessionType(folderUri)returns the first entry in the folder's live session-type list, recomputed so it follows provider changes.New chat widget (
newChatWidget.ts)Why
Previously the stored "last session type" could be silently overwritten just by observing an active session, and a new chat would not follow the preferred default as providers register lazily.
Notes for reviewers
sessionTypePicker.test.tscovering: preferred follows session-type changes, user pick persists across reload, observing a session doesn't overwrite the pick, and re-selecting the default clears the stored pick.Co-authored-by: Copilot [email protected]