Keep each chat session on its own model#1736
Open
iyernaveenr wants to merge 1 commit into
Open
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>
d6e3e48 to
f8c9824
Compare
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.