Keep each chat session on its own model#1736
Merged
4pmtong merged 6 commits intoJul 16, 2026
Merged
Conversation
Persist the model a Project runs with in the Project's metadata and reuse it for every later run, so switching sessions or changing the global default no longer changes an existing conversation's model. The captured selection is also patched into the server-side project metadata, surviving app restarts and space re-syncs. The in-session composer's model dropdown now shows the session's own model and lets the user change it for that session only; the global default picker is unchanged. If a pinned provider was removed, the run falls back to the default model with a warning. Signed-off-by: Naveen R. Iyer <iyernaveenr@gmail.com>
iyernaveenr
force-pushed
the
naveen_r_iyer/fix-per-session-model-restore
branch
from
July 5, 2026 00:38
d6e3e48 to
f8c9824
Compare
Contributor
|
Testing passed and the implementation works as described: each Project/session keeps its own model, and changing the model from the BottomBox after a run finishes applies to the next run without changing other Projects or the global default. Thanks for your contribution! @4pmtong, could you please provide an additional review? I would also like a product/backend discussion on the intended behavior here: should an existing Project allow its saved model to be updated between runs so that each new run can switch to a different model? Please also review the backend metadata persistence and update flow before merging. |
Resolve a conflict in the session model-resolution path: keep the per-session provider lookup and drop a debug log that was removed upstream. No functional change to the feature. Signed-off-by: Naveen R. Iyer <iyernaveenr@gmail.com>
4pmtong
approved these changes
Jul 16, 2026
4pmtong
left a comment
Collaborator
There was a problem hiding this comment.
Look good to me, Thanks @iyernaveenr for contribution
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.
Problem
Switching between chat sessions always shows (and sends with) the current global model, even when a session was started with a different model. There is no per-session model: the composer only ever reflects the global setting, and a follow-up in an old conversation silently runs on whatever the global model happens to be.
Root cause
The model is resolved from the global
authStoreon every send (startTask), and the in-session composer's model indicator is derived from the same global state, so nothing stores or restores a per-session model. Sessions are durable at the Project level (each send creates a fresh task), so the model has to live on the Project.Fix
Persist the model a Project runs with in the Project's metadata (
metadata.modelSelection) and reuse it for every later run:projectStore: newsetProjectModel/getProjectModel. The selection is kept in the runtime store, mirrored into the persisted space meta, and also PATCHed into the server-side project metadata (shallow-merged), so it survives app restarts and space re-syncs from the server.startTask: when the Project has a stored selection, resolve the model from it -- custom/local providers are matched by their provider id (falling back to the default provider with a warning toast if the pinned one was removed), cloud models by the stored cloud model id, codex by the stored type. The resolved selection is re-captured after every run. The global cloud selection is no longer mutated when a per-project selection is in effect.Notes
Testing
tscpasses; the full test suite shows no regressions vsmain(identical failure set); new store tests pass.