Skip to content

fix(web): new threads honor the project default model - #7515

Open
eggfriedrice24 wants to merge 3 commits into
pingdotgg:mainfrom
eggfriedrice24:fix/new-thread-honors-project-default
Open

fix(web): new threads honor the project default model#7515
eggfriedrice24 wants to merge 3 commits into
pingdotgg:mainfrom
eggfriedrice24:fix/new-thread-honors-project-default

Conversation

@eggfriedrice24

@eggfriedrice24 eggfriedrice24 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #5796

New threads on web/desktop seeded the composer from the global sticky last-used selection and the viewed thread, so a project's configured default model, including which provider instance (subscription), was ignored when switching projects.

Fix: useNewThreadHandler resolves project.defaultModelSelection ?? carryModelSelection and applies it in all three draft seed paths. A configured project default beats sticky and carry; projects without one keep current behavior; explicit composer picks still win.

Related: #6011 has the same web change bundled with a mobile rework; #6593 covers extra edge cases at (persisted flag, render-time overrides). This is the minimal web-only version. Supersedes #7511 (opened by mistake, closed).

Validation: composerDraftStore tests (79 pass), web lint/typecheck clean, integrated pass with two Claude instances and opposite project pins: new threads land on the target project's pin in both directions, even with sticky and carry pointing at the other instance.

Built with Claude Fable 5 through Claude Code in T3 Code.


Note

Medium Risk
Changes composer model initialization across every new-thread code path; wrong priority could mis-route provider subscriptions, but scope is limited to draft seeding in one hook.

Overview
New-thread seeding in useHandleNewThread now resolves modelSelectionOverride as project.defaultModelSelection ?? carryModelSelection, so a project’s configured default model (including provider instance) wins over the globally sticky pick and the model carried from the thread you were viewing.

That override is applied on all three draft paths—reusing an empty stored draft, reusing the current empty draft for the same logical project, and minting a fresh draft after applyStickyState—via setModelSelection with replaceOptions: true. Projects without a default keep the previous sticky + carry behavior; composer-visible picks still feed carryModelSelection when no pin is set.

Reviewed by Cursor Bugbot for commit cf79aa6. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix useNewThreadHandler to use project default model for new threads

  • New threads now initialize model selection from the project's defaultModelSelection when set; otherwise they fall back to the carried model selection
  • Introduces modelSelectionOverride in useHandleNewThread.ts, replacing all setModelSelection calls that previously used carryModelSelection
  • When reusing the viewed draft as the new-thread destination, the model selection is reset with replaceOptions: true using the same override
  • Behavioral Change: new threads now prefer the project's pinned model over the carried selection; env/branch/worktree resolution is unchanged

Macroscope summarized cf79aa6.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

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 Plus

Run ID: bf9faa14-e712-43e5-ac08-6a8430ae369f

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

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 19, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR changes runtime behavior for model selection in new threads, making project default models take precedence over carried models from previously viewed threads. This is a user-facing behavior change that warrants human verification of the intended prioritization logic.

No code changes detected at cf79aa6. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 119ffac. Configure here.

// The selection is a complete snapshot of the pinned or viewed
// model state: absent options mean "no options", not "keep the
// stale draft's options".
setModelSelection(emptyStoredDraftThread.draftId, modelSelectionOverride, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pin skipped on open empty draft

Medium Severity

modelSelectionOverride is only written on the empty-stored path when workspaceContext is set. An already-open empty draft with no explicit workspace options leaves that context null, so a new-thread request does not apply the project pin. The viewed-draft reuse path does apply it, but that path is skipped whenever the stored empty draft is the one on screen — the usual sidebar or hotkey new-thread case while sitting on that draft.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 119ffac. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

True, and intentional: this keeps the path's pre-existing semantics. When the request lands on the draft already on screen with no explicit workspace options, the handler leaves the draft alone entirely (the same guard skipped the carry write before this PR). The user may have just picked a model in that composer, and without an explicit-pick marker (#6593's approach) a reseed would clobber it. The remap path applies the pin because there the draft is being reassigned to the project. A stale draft heals on any new-thread request issued from outside it.

@eggfriedrice24

Copy link
Copy Markdown
Contributor Author

Hi @juliusmarminge @maria-rcks, sorry for the direct tag, I know you are both busy. This one is hitting our team's workflow pretty hard: we switch between subscriptions often, and new threads not honoring the project default model and subscription means everyone has to reselect them constantly. The branch is now up to date with main. Would really appreciate a look when you get a chance, and happy to adjust anything in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 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.

[Bug]: Project default model is ignored for new threads when another model was selected in a different project

1 participant