Skip to content

fix(web): apply sticky model selection when reusing draft threads#1277

Open
JoeEverest wants to merge 1 commit intopingdotgg:mainfrom
JoeEverest:fix/sticky-model-on-draft-threads
Open

fix(web): apply sticky model selection when reusing draft threads#1277
JoeEverest wants to merge 1 commit intopingdotgg:mainfrom
JoeEverest:fix/sticky-model-on-draft-threads

Conversation

@JoeEverest
Copy link
Contributor

@JoeEverest JoeEverest commented Mar 21, 2026

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 applyStickyModel helper 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: null and model: null. This causes ChatView.tsx to 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 After
before.mov
after.mov

Closes #1276

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

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?) in useHandleNewThread.ts encapsulates this logic. Behavior for brand-new threads is unchanged.

Macroscope summarized 50de946.

Copilot AI review requested due to automatic review settings March 21, 2026 15:15
@coderabbitai
Copy link

coderabbitai bot commented Mar 21, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: aad93ef0-7506-464e-bb41-a1af3c3fcbd6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 21, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 within useHandleNewThread to 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@maria-rcks
Copy link
Collaborator

@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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model selection resets to GPT 5.4 when creating a new thread

3 participants