Skip to content

fix(web): let new threads honor the project's default model - #7551

Closed
KyeMoon123 wants to merge 1 commit into
pingdotgg:mainfrom
KyeMoon123:fix/new-thread-respect-project-default-model
Closed

fix(web): let new threads honor the project's default model#7551
KyeMoon123 wants to merge 1 commit into
pingdotgg:mainfrom
KyeMoon123:fix/new-thread-respect-project-default-model

Conversation

@KyeMoon123

@KyeMoon123 KyeMoon123 commented Aug 19, 2026

Copy link
Copy Markdown

Summary

  • The project setting "New threads in this project start with this model. Applies to every checkout in this group." (ProjectSettingsPanel.tsx, writes project.defaultModelSelection) was effectively never applied once any thread anywhere had picked a model.
  • New threads are seeded via applyStickyState(draftId) in useHandleNewThread.ts, which pulls from a global, provider-keyed "last used model" (stickyModelSelectionByProvider in composerDraftStore.ts) — not scoped to project or thread. The project default was only ever consulted as a last-resort fallback that's effectively dead once the sticky map is populated (i.e. after the user's very first thread ever).
  • This fix applies project.defaultModelSelection whenever there's no carryModelSelection (i.e. no thread/draft currently being viewed to intentionally carry a selection from), across all three new-thread code paths in the hook:
    • Minting a genuinely fresh draft.
    • Reusing a stored-but-empty draft for the project.
    • Reusing the empty draft that's already open.

Test plan

  • pnpm run typecheck (apps/web) — passes
  • pnpm run lint -- apps/web/src/hooks/useHandleNewThread.ts — passes
  • Manual: set a project's default model in Settings, start several threads elsewhere with a different model selected, then create a new thread in that project (via each of: fresh draft, an existing empty draft for the project, and the currently-open empty draft) — each should open with the configured default instead of the last-used model.

Note

Fix new threads to honor the project's default model selection

In useHandleNewThread.ts, when creating or reusing an empty draft without a carried model selection, the handler now applies project.defaultModelSelection with replaceOptions: true to the target draft. This covers three cases: reusing an existing empty draft for a project remap, staying on the current route's empty draft during a context update, and creating a brand new draft.

Risk: The project default overrides any previously stored selection or sticky state on empty drafts.

Macroscope summarized 75b13e3.


Note

Low Risk
Behavior change is limited to new/reused empty draft initialization in one hook; no auth, persistence, or server API changes.

Overview
New threads in a project now honor the configured default model when the user isn’t carrying a selection from the thread they’re viewing.

useHandleNewThread already seeds drafts from global sticky “last used model” state and only overrides that when carryModelSelection is present. This change adds the same kind of override for project.defaultModelSelection in three paths: resurrecting an empty stored draft, reusing the empty draft already open for that project, and minting a brand-new draft after applyStickyState. In each case it runs only when there is no carried selection, and uses setModelSelection with replaceOptions: true so the project default is a full snapshot (not merged with stale draft options).

Precedence is unchanged for carry-over: if the user is viewing a thread/draft with a model, that selection still wins over both sticky state and the project default.

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

@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: 6862b58b-201c-42ec-b618-c51be28cb548

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

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 19, 2026

@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 4dab31b. Configure here.

Comment thread apps/web/src/hooks/useHandleNewThread.ts
@macroscopeapp

macroscopeapp Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 75b13e3

Macroscope's review found this PR approvable — This is a focused bug fix that adds fallback logic to honor project default model selections in new threads. The changes are additive, well-commented, and follow existing patterns in the file. The scope is limited to model selection defaults in thread creation.

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

@KyeMoon123
KyeMoon123 force-pushed the fix/new-thread-respect-project-default-model branch from 4dab31b to ef011be Compare August 19, 2026 13:52
Comment thread apps/web/src/hooks/useHandleNewThread.ts
New threads were seeded from the global "sticky" last-used model
(applyStickyState) and only fell back to the project's configured
defaultModelSelection when no sticky value existed at all — which in
practice only happens on a user's very first thread ever. As a result,
the project setting "New threads in this project start with this
model" was effectively never applied once any thread anywhere had
already picked a model.

Apply the project default whenever there's no carried selection from a
currently-viewed thread/draft to take priority instead, across all
three new-thread paths: minting a genuinely fresh draft, reusing a
stored-but-empty draft, and reusing the empty draft already open.
@KyeMoon123
KyeMoon123 force-pushed the fix/new-thread-respect-project-default-model branch from ef011be to 75b13e3 Compare August 19, 2026 14:00
@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Aug 19, 2026
@t3dotgg

t3dotgg commented Aug 27, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-5.6 Sol responding on behalf of Theo

We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.

Closing this narrower project-default fix because it still lets a carried model override the project default. #7515, #6593, and #6011 cover the precedence choice more directly and remain open. Keep the fresh and reused draft cases in the selected implementation.

If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed. If GitHub does not let you reopen it, leave a comment here and we'll take another look.

@t3dotgg t3dotgg closed this Aug 27, 2026
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:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants