fix(web): apply sticky model selection when reusing draft threads#1277
fix(web): apply sticky model selection when reusing draft threads#1277JoeEverest wants to merge 1 commit intopingdotgg:mainfrom
Conversation
|
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 CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.Add a .trivyignore file to your project to customize which findings Trivy reports. |
There was a problem hiding this comment.
Pull request overview
Ensures the user’s sticky model/provider and model options are applied consistently when starting a “New Thread”, including when the app reuses an existing persisted draft thread (common due to localStorage-backed drafts).
Changes:
- Added an
applyStickyModel(threadId)helper withinuseHandleNewThreadto centralize sticky model/provider/options application. - Applied sticky model/provider/options to the two draft-reuse paths (stored project draft and “already on a draft for this project”), not just the brand-new draft creation path.
- Removed duplicated sticky-application logic from the new-thread creation path in favor of the helper.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@JoeEverest tell your agent to rebase and force push (making this pr just one commit) |
…reads Only brand-new threads had the sticky model/provider applied. When an existing draft thread was found for the project (the common case), the model and provider were left as null, causing a fallback to GPT 5.4. When reusing a draft that already has a user-set model, preserve the user's explicit choice instead of overwriting it with the sticky model. Closes pingdotgg#1276 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c7a7d97 to
50de946
Compare
What Changed
When creating a new thread, the sticky model/provider/options are now applied in all three code paths in
useHandleNewThread, not just when creating a brand-new thread.Extracted an
applyStickyModelhelper inside the callback to avoid duplicating the logic across paths.Why
Only Path C (brand-new thread creation) applied the user's sticky model selection. Paths A and B — which reuse existing draft threads — skipped it entirely. Since draft threads are persisted in localStorage and survive app restarts, clicking "New Thread" almost always hits Path A, finding a stale draft with
provider: nullandmodel: null. This causesChatView.tsxto fall back to the default provider ("codex") and model ("gpt-5.4"), resetting the user's selection.Path A (line 57): Existing draft found for project via
getDraftThreadByProjectId()→ navigated to it without applying sticky model.Path B (line 79): Current route is already a draft for this project → reused it without applying sticky model.
Path C (line 95): Brand new thread → was the only path that applied sticky model correctly.
before.mov
after.mov
Closes #1276
Checklist
Note
Apply sticky model selection when reusing existing draft threads
When reusing an existing draft thread (stored project draft or active draft for the current route), sticky model/provider settings are now applied if the draft has no model already set. A new helper
applyStickyModel(threadId, draftModel?)inuseHandleNewThread.tsencapsulates this logic. Behavior for brand-new threads is unchanged.Macroscope summarized 50de946.