Skip to content

fix(desktop): use profile model for plain new chats - #55630

Closed
rayjun wants to merge 1 commit into
NousResearch:mainfrom
rayjun:fix/desktop-new-chat-profile-model
Closed

rayjun wants to merge 1 commit into
NousResearch:mainfrom
rayjun:fix/desktop-new-chat-profile-model

Conversation

@rayjun

@rayjun rayjun commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes Desktop/TUI new-chat model inheritance so a plain new conversation uses the active profile's model.default instead of accidentally carrying over the previous session's runtime model.

The desktop footer can mirror the active session's model. Before this change, session.create always sent that mirrored model as a per-session override, so a brand-new chat could ignore the selected profile's configured default. This change only sends a model override when the user explicitly picked a model while no runtime session was active; that draft override is consumed once.

Related Issue

Fixes #54906

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • apps/desktop/src/store/session.ts
    • Adds a transient $draftModelOverridePending flag for explicit no-session model picks.
  • apps/desktop/src/app/session/hooks/use-model-controls.ts
    • Marks no-session picker choices as pending draft model overrides.
    • Clears the pending flag when the composer is reseeded from profile/global model info.
  • apps/desktop/src/app/session/hooks/use-session-actions/index.ts
    • Sends model / provider on session.create only when a pending draft model override exists.
    • Consumes the draft override after session creation starts.
  • apps/desktop/src/app/session/hooks/use-model-controls.test.tsx
    • Covers draft-override flag behavior and profile-default reseeding.
  • apps/desktop/src/app/session/hooks/use-session-actions.test.tsx
    • Covers that a previous session model is not sent to plain new chats.
    • Covers that an explicit no-session picker choice is still sent once.

How to Test

  1. Run targeted UI tests:
    cd apps/desktop
    npm run test:ui -- src/app/session/hooks/use-model-controls.test.tsx src/app/session/hooks/use-session-actions.test.tsx
  2. Run targeted lint:
    cd apps/desktop
    npx eslint src/store/session.ts src/app/session/hooks/use-model-controls.ts src/app/session/hooks/use-session-actions/index.ts src/app/session/hooks/use-model-controls.test.tsx src/app/session/hooks/use-session-actions.test.tsx
  3. Run desktop typecheck:
    cd apps/desktop
    npm run typecheck

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Ubuntu 24.04 / desktop unit test environment

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

> hermes@0.17.0 test:ui
> vitest run --environment jsdom src/app/session/hooks/use-model-controls.test.tsx src/app/session/hooks/use-session-actions.test.tsx

✓ src/app/session/hooks/use-session-actions.test.tsx (15 tests)
✓ src/app/session/hooks/use-model-controls.test.tsx (5 tests)

Test Files  2 passed (2)
Tests       20 passed (20)
> hermes@0.17.0 typecheck
> tsc -p . --noEmit

@rayjun
rayjun force-pushed the fix/desktop-new-chat-profile-model branch from f3f6991 to c4e99e9 Compare June 30, 2026 12:10
@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
Contributor

This was generated by AI during triage.

Competing fix for the same Desktop new-chat model-inheritance bug as #55635 (filed minutes later). Same goal, different mechanism: this PR adds a $draftModelOverridePending flag and only sends a model override on session.create; #55635 uses a $freshDraftUsesProfileDefault atom and ignores stale runtime metadata in use-session-state-cache.ts. Related, not a duplicate — this is the earlier entrant; a maintainer should pick one. Fixes #54906; same area as feature #50013.

@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 selection for plain new chats to use profile default instead of stale composer overrides. Adds draftModelOverridePending state.

✅ Looks Good

  • Clean implementation: draftModelOverridePending flag tracks deliberate user picks
  • Good test coverage with updated tests for new behavior
  • Well-scoped fix for desktop model selection
  • Follows existing pattern for model controls

Reviewed by Hermes Agent

@rayjun
rayjun force-pushed the fix/desktop-new-chat-profile-model branch from c4e99e9 to 65c10af Compare July 4, 2026 06:21

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the focused tests and narrow Desktop implementation. The proposed behavior conflicts with an explicit current Desktop contract.

Problems

  • apps/desktop/src/app/session/hooks/use-session-actions/index.ts:172-183 gates the model override, while current main deliberately sends the sticky composer model on each new session.create (apps/desktop/src/app/session/hooks/use-session-actions/index.ts:208-225).
  • Commit cb6b4127e795e55bdd7ae4fe35a0ff3cd9f53736 introduced that behavior specifically so picker choices follow across Cmd/Ctrl+N and restarts. The user guide states the same contract at website/docs/user-guide/desktop.md:61.

Suggested changes

  • Please obtain a maintainer product-direction decision before salvaging this behavior change. If that direction changes, update the documented sticky-picker contract and its Desktop/backend tests together.

Automated hermes-sweeper review.

// default (that lives in Settings → Model).
const uiModel = $currentModel.get().trim()
const uiProvider = $currentProvider.get().trim()
const useDraftModelOverride = $draftModelOverridePending.get()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This gate reverses the current sticky-composer contract: current main deliberately includes the displayed picker model on every new session.create so selections follow across Cmd/Ctrl+N. That behavior was introduced in cb6b4127e795 and is documented at website/docs/user-guide/desktop.md:61; please obtain a maintainer decision before changing it.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform area/profiles Multi-profile isolation, HERMES_HOME scoping labels Jul 15, 2026
@rayjun

rayjun commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing because current main now has an explicit sticky composer-model contract: model selections intentionally persist across new chats and restarts, and the Desktop guide documents that behavior. This PR implements the opposite product behavior, so rebasing it would not be a mechanical bug fix and the latest sweeper review rates salvageability as none. If maintainers decide to change the sticky-model contract, this can be reopened or re-scoped together with the documentation and Desktop/backend contract tests.

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

Labels

area/profiles Multi-profile isolation, HERMES_HOME scoping comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: New conversation ignores profile model.default and inherits previous session's --model

4 participants