Skip to content

fix(desktop): seed new sessions from Settings profile default model - #55635

Closed
fkhb90 wants to merge 1 commit into
NousResearch:mainfrom
fkhb90:fix/desktop-default-model-revert
Closed

fix(desktop): seed new sessions from Settings profile default model#55635
fkhb90 wants to merge 1 commit into
NousResearch:mainfrom
fkhb90:fix/desktop-default-model-revert

Conversation

@fkhb90

@fkhb90 fkhb90 commented Jun 30, 2026

Copy link
Copy Markdown

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-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.

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)

  1. Open Hermes Desktop with the default profile set to e.g. openai-codex / gpt-5.5
  2. Open a different conversation, switch its model to minimax-m3
  3. Return to the composer and click 新工作階段
  4. Expected: new draft shows openai-codex / gpt-5.5
  5. Actual: new draft shows minimax-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

File Role
store/session.ts Add $freshDraftUsesProfileDefault atom + setter. True only for the visible New Session draft path.
use-session-actions/index.ts In startFreshSessionDraft, set the flag, seed $currentModel/$currentProvider from the profile default, and clear the localStorage override keys.
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. Without this guard, 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.
use-model-controls.ts 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.

Verification

  • npm run typecheck — exit 0
  • npm run lint — exit 0
  • npm run test:ui — passing (including the updated tests in this PR)
  • End-to-end on Windows: npm run pack into release/win-unpacked, restart
    Hermes Desktop, open a minimax-m3 session, return to the composer,
    click 新工作階段 → new draft shows openai-codex / gpt-5.5 and stays
    there 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.

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.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) labels Jun 30, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

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 $draftModelOverridePending flag on session.create; this PR adds a $freshDraftUsesProfileDefault atom and additionally ignores stale runtime metadata in use-session-state-cache.ts. Related, not a duplicate — a maintainer should pick one. Same area as feature #50013 and fix PRs #48946/#50198.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

@fkhb90 fkhb90 closed this Jul 1, 2026
@fkhb90
fkhb90 deleted the fix/desktop-default-model-revert branch July 28, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants