sessions: fix model picker desyncing from the session - #330560
Merged
roblourens merged 2 commits intoAug 13, 2026
Conversation
Reverts the ChatView session-type delegate wiring from #329889, which desynchronized the model picker from the viewed session. `sessionTypePickerDelegate` means "the user picks the session type here" — it exists for the welcome view and the automations dialog, which have no chat model of their own. ChatInputPart listens to that delegate's `onDidChangeActiveSessionProvider` and reconciles the model and mode for the newly picked type via `revalidateModelForSessionType()`. ChatView's delegate instead fired on every chat navigation, from `_loadChat` and before the widget rebinds. So each navigation re-applied the remembered per-session-type model while the input was still bound to the *outgoing* chat, writing that model into the outgoing chat's persisted input state. The corruption was silent until an explicit model pick made the remembered model differ from the session's, after which opening an Opus 5 session showed (and persisted) gpt-5.6-sol. Restores `_updateWidgetLockState` so the widget still locks to the contributed chat session type when the model loads. Note this brings back the picker blink on session switch that #329889 was fixing; that needs a solution which does not route through the explicit-pick pathway. SESSIONS.md records why the delegate must not be reintroduced here. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Reverts incorrect session-type delegation that could overwrite persisted chat model selections during navigation.
Changes:
- Removes
ChatViewsession-type delegate wiring. - Restores model-derived widget lock state.
- Updates documentation and removes obsolete delegate tests.
Show a summary per file
| File | Description |
|---|---|
src/vs/sessions/SESSIONS.md |
Documents why ChatView must not use the picker delegate. |
src/vs/sessions/contrib/chat/browser/chatView.ts |
Removes delegate wiring and restores widget locking. |
src/vs/sessions/contrib/chat/test/browser/chatView.test.ts |
Removes tests for the deleted delegate. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Balanced
…icker-sync-issue-investigation # Conflicts: # src/vs/sessions/SESSIONS.md
roblourens
marked this pull request as ready for review
August 12, 2026 23:32
roblourens
enabled auto-merge (squash)
August 12, 2026 23:32
Bhavya U (bhavyaus)
approved these changes
Aug 13, 2026
roblourens
deleted the
roblou/agents/model-picker-sync-issue-investigation
branch
August 13, 2026 01:49
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.
Reverts the
ChatViewsession-type delegate wiring from #329889, which desynchronized the model picker from the viewed session. Resuming an Opus 5 session would show — and then persist —gpt-5.6-sol.Root cause
sessionTypePickerDelegatemeans "the user picks the session type here". It exists for the welcome view and the automations dialog, which have no chat model of their own.ChatInputPartlistens to that delegate'sonDidChangeActiveSessionProviderand reconciles the model and mode for the newly picked type:ChatView's delegate instead fired on every chat navigation, from_loadChatand before the widget rebinds:So each navigation re-applied the remembered per-session-type model while the input was still bound to the outgoing chat.
_applyModel→runtime.applyModel→_syncInputStateToModel()therefore wrote that model into the outgoing chat's persisted input state.The corruption was silent while the remembered model happened to match, and became visible the moment an explicit pick made them differ.
Evidence
From an Agents window log bundle,
[ChatModelSelection]diagnostics show the exact sequence. Note every affected switch was between chats of the same type (agent-host-copilotcli→agent-host-copilotcli), where a session-type announcement is meaningless:Confirmed by replaying the production call sequence against the real
ChatInputModelSelectionController: restoring a conversation to Opus 5, thenrevalidateForSessionType(() => initialize('gpt-5.6-sol'))while bound to the outgoing conversation flips both the picker and the outgoing conversation's stored model togpt-5.6-sol.What changed
ChatViewSessionTypeDelegate/getChatViewSessionTypeand stopped passingsessionTypePickerDelegateto the Agents-windowChatWidget._updateWidgetLockState(and theIChatSessionsServiceinjection it needs) so the widget still locks to the contributed chat session type when the model loads.SESSIONS.mdrecords why the delegate must not be reintroduced here.The two incidental hunks from #329889 are left in place:
getVisibleOptionGroupsModeAndUpdateContextKeysusinggetEffectiveSessionType(now falls back to the session resource for the Agents window, i.e. the pre-#329889 behavior) and the target picker's label re-render on delegate change (inert without aChatViewdelegate, still correct for the welcome view and automations dialog).Reviewer notes
git diff 0b8b8c6f3f5^ -- chatView.tsfiltered for delegate/lock-state/session-type shows zero differences, so the file's behavior matches the pre-regression version exactly.Validation
npm run typecheck-client— cleannpm run hygiene— cleaneslinton changed files — cleanSessions - Chat View,ChatInputModelSelectionController,SessionTypePickerActionItem(Written by Copilot)