fix(web): apply sticky model when reusing existing draft thread#1291
fix(web): apply sticky model when reusing existing draft thread#1291murataslan1 wants to merge 3 commits intopingdotgg:mainfrom
Conversation
The Claude Agent SDK does not load filesystem settings by default. Without settingSources, Skills, slash commands, and CLAUDE.md memory files are silently ignored. Fixes pingdotgg#1283
When creating a new thread, if a stored draft thread already existed for the project, the sticky model was not applied to it. This caused the model picker to show the default model (GPT 5.4) instead of the user's last selected model. Apply stickyModel and stickyModelOptions to the draft thread in all code paths, not just when creating a brand new thread. Fixes pingdotgg#1276
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can enable review details to help with troubleshooting, context usage and more.Enable the |
There was a problem hiding this comment.
Pull request overview
Fixes the web “New Thread” flow so that when an existing project draft thread is reused, it is updated to the user’s sticky model selection instead of reverting to the default model (e.g., GPT 5.4).
Changes:
- Apply
stickyModelandstickyModelOptionswhen reusing a stored draft thread inuseHandleNewThread. - Set
settingSources: ["user", "project"]for Claude Agent SDK query options in the server Claude adapter.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/web/src/hooks/useHandleNewThread.ts | Updates the stored-draft reuse path to also apply sticky model + options before navigating/reusing. |
| apps/server/src/provider/Layers/ClaudeAdapter.ts | Adds Claude Agent SDK settingSources to query options (behavioral change to session startup). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| env: process.env, | ||
| settingSources: ["user", "project"], | ||
| ...(input.cwd ? { additionalDirectories: [input.cwd] } : {}), |
There was a problem hiding this comment.
This PR is labeled/-described as a web-only fix for sticky model selection, but this change alters server-side Claude Agent session startup behavior by explicitly setting settingSources. Please either (a) document in the PR description why this server behavior change is required for the web sticky-model fix, including expected impact, or (b) move it to a separate PR to avoid shipping unrelated runtime behavior changes together.
| if (stickyModel) { | ||
| setProvider(storedDraftThread.threadId, inferProviderForModel(stickyModel)); | ||
| setModel(storedDraftThread.threadId, stickyModel); | ||
| } | ||
| if (Object.keys(stickyModelOptions).length > 0) { | ||
| setModelOptions(storedDraftThread.threadId, stickyModelOptions); | ||
| } |
There was a problem hiding this comment.
This adds sticky model/modelOptions application when reusing a stored draft thread, but the other reuse path (when latestActiveDraftThread exists for the same project and you return early around lines 86–100) still doesn’t apply stickyModel/stickyModelOptions. If the project->draft mapping is missing but the user is currently on a draft thread, clicking “New Thread” can still leave the draft on an outdated/default model. Consider applying the same sticky-model update in that early-return branch (or factor the sticky application into a shared helper).
|
Also see #1277 |
Address review feedback: the second reuse path (when latestActiveDraftThread exists for the same project) also needs stickyModel/stickyModelOptions applied, otherwise clicking "New Thread" while on an existing draft can leave it on an outdated model.
|
Addressed the feedback:
|
|
Are you a bot? |
|
Nope, just using Claude Code as my coding assistant. |
Summary
Fixes the model selection resetting to GPT 5.4 when creating a new thread.
Root Cause
handleNewThread()inuseHandleNewThread.tshas 3 code paths:When a user clicks "New Thread" and a draft already exists for that project, path 1 was taken — navigating to the old draft without updating its model to match the user's last selection.
Fix
Apply
stickyModelandstickyModelOptionsto the draft thread in the stored draft path (path 1), matching the behavior already present in path 3.Test plan
Fixes #1276
Note
Apply sticky model when reusing an existing draft thread
When
handleNewThreadreuses a stored or active draft thread, it now applies the composer's sticky model preferences. IfstickyModelis set, it callssetProviderandsetModelon the thread; ifstickyModelOptionsis non-empty, it callssetModelOptions. Previously these preferences were only applied to newly created threads.Macroscope summarized 21f3e9b.