Skip to content

fix(app): keep selected model across new sessions#17190

Open
anduimagui wants to merge 2 commits intoanomalyco:devfrom
anduimagui:opencode/playful-island
Open

fix(app): keep selected model across new sessions#17190
anduimagui wants to merge 2 commits intoanomalyco:devfrom
anduimagui:opencode/playful-island

Conversation

@anduimagui
Copy link

@anduimagui anduimagui commented Mar 12, 2026

Issue for this PR

Closes #4930

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Desktop currently restores model and agent state for existing sessions, but starting a new session in the same project can still reset the selected model back to the agent default. That means a manual model choice is not sticky across later new sessions.

This change stores the app's selected model in workspace-scoped persistence and updates the new-session reset path to only restore agent defaults when there is no current model selection to keep. Existing session restore behavior stays the same, while new sessions in the same project keep the selected model.

Related context: #12582 fixed CLI fallback to recent models, but it did not change the desktop app's new-session behavior.

How did you verify your code works?

I added a unit test covering the new-session reset path so it does not overwrite an existing selected model.

I verified locally with:

  • bun test --preload ./happydom.ts ./src/pages/session/session-model-helpers.test.ts
  • bun typecheck

Screenshots / recordings

Not included. This changes state persistence behavior rather than visible UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 12, 2026
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Found a potentially related PR:

#14682: fix(tui): retain model and agent selection when switching sessions

This PR appears related as it addresses retaining model and agent selection, but it's specifically for the TUI (text user interface), while PR #17190 is for the desktop app. Worth checking if there's any shared logic or if they're addressing the same underlying issue from different interfaces.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 12, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Retain current model and agent selection when switching sessions

1 participant