fix(desktop): seed new sessions from Settings profile default model - #55635
Closed
fkhb90 wants to merge 1 commit into
Closed
fix(desktop): seed new sessions from Settings profile default model#55635fkhb90 wants to merge 1 commit into
fkhb90 wants to merge 1 commit into
Conversation
Clicking `新工作階段` (New Session) used to inherit the composer model/provider from the most recently focused conversation, so a session that was opened on `minimax-m3` would silently drag the next new session off the user's `openai-codex / gpt-5.5` profile default. Only an explicit picker choice or restarting the app reset it. The Settings panel's chosen default was effectively decorative in the common flow. The composer model is sticky UI state by design (preserves the user's deliberate picker choice across send/receive), but 'New Session' is the one path that should NOT inherit a focused conversation's last-known model. Fix that path only, leave explicit picker choices sticky. Changes: - store/session.ts: add `$freshDraftUsesProfileDefault` atom + setter. True only for the visible New Session draft path. The picker clearing the flag is what restores normal sticky behavior. - use-session-actions/index.ts: in `startFreshSessionDraft`, set the flag and seed `$currentModel`/$currentProvider from the profile default. Also clears the localStorage override keys, matching the behavior the call site previously required. - use-session-state-cache.ts: when the flag is on and no session is active, ignore stale runtime metadata that an old focused session may still emit during the React-effect gap before the cache hook's refs update. Without this, the old session's session.info could overwrite the freshly seeded profile default. - desktop-controller.tsx: pass `forceFromProfileDefault=true` to `refreshCurrentModel` on the visible New Session path so the composer reads from Settings → Model rather than the sticky state. - use-model-controls.ts: minor — also clear the override on the initial draft when no focused session is active, so the composer/profile-default split is consistent across both entry points. - use-session-actions.test.tsx: cover the new flag handling and the pre-send localStorage reset, including the stale-runtime-metadata guard in the cache hook. Verified end-to-end on Windows: build + pack into `release/win-unpacked`, restart Hermes Desktop, open a minimax-m3 session, return to the composer, click 新工作階段 → the new draft shows openai-codex / gpt-5.5 (the profile default) and stays there across subsequent new-session clicks until the picker is used.
Collaborator
Competing fix for the same Desktop new-session model-inheritance bug as #55630 (filed minutes earlier, Fixes #54906). Same goal, different mechanism: #55630 uses a |
23 tasks
tonydwb
reviewed
Jun 30, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
Fixes desktop model seeding to use Settings profile default model for new sessions instead of stale composer/session overrides.
✅ Looks Good
- Clean implementation: refreshCurrentModel(true) forces reseed from profile default
- Good test coverage with new tests for fresh draft behavior
- Well-scoped fix for desktop model selection
- Follows existing pattern for profile swaps
Reviewed by Hermes Agent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Clicking 「新工作階段」 (New Session) used to inherit the composer
model/provider from the most recently focused conversation, so a session
that was opened on
minimax-m3would silently drag the next new sessionoff the user's
openai-codex / gpt-5.5profile default. Only an explicitpicker choice or restarting the app reset it. The Settings panel's chosen
default was effectively decorative in the common flow.
Why now
The composer model is sticky UI state by design (preserves the user's
deliberate picker choice across send/receive), but 'New Session' is the
one path that should NOT inherit a focused conversation's last-known
model. This PR fixes that path only and leaves explicit picker choices
sticky.
Reproduction (before the fix)
openai-codex / gpt-5.5minimax-m3openai-codex / gpt-5.5minimax-m3(sticky from the previously focused session). The Settings default is ignored.Reproduction (after the fix)
Steps 1–5, but step 5 now matches the expectation. A deliberate picker
choice in step 2 is preserved across subsequent send/receive (sticky
behavior unchanged); only the New Session path now seeds from the
profile default.
Changes
store/session.ts$freshDraftUsesProfileDefaultatom + setter. True only for the visible New Session draft path.use-session-actions/index.tsstartFreshSessionDraft, set the flag, seed$currentModel/$currentProviderfrom the profile default, and clear the localStorage override keys.use-session-state-cache.tssession.infocould overwrite the freshly seeded profile default.desktop-controller.tsxforceFromProfileDefault=truetorefreshCurrentModelon the visible New Session path.use-model-controls.tsuse-session-actions.test.tsxVerification
npm run typecheck— exit 0npm run lint— exit 0npm run test:ui— passing (including the updated tests in this PR)npm run packintorelease/win-unpacked, restartHermes Desktop, open a
minimax-m3session, return to the composer,click 新工作階段 → new draft shows
openai-codex / gpt-5.5and staysthere across subsequent new-session clicks until the picker is used.
Risk
Low. The change is confined to the New Session entry path. Existing
sticky-composer behavior (user makes a deliberate picker choice) is
preserved; only the New Session initial seed changes. A deliberately
chosen model is sticky; an inherited one is no longer.