continue icon indicating copy to clipboard operation
continue copied to clipboard

Add per-tab model persistence and selection functionality

Open ferenci84 opened this issue 2 weeks ago • 1 comments
trafficstars

Description

Persist agent/mode/model per session (not per tab), and load them when switching tabs. This replaces the previous per‑tab persistence so that a session’s settings travel with it, survive IDE restarts, and are consistent across views.

Original PR (for tabs only): https://github.com/continuedev/continue/pull/7617

Discussion: https://github.com/continuedev/continue/discussions/7986

Key changes:

  • Session persistence:
    • Added optional fields to the session payload: mode and chatModelTitle.
    • Persisted to disk in ~/.continue/sessions/<sessionId>.json alongside history/title/workspaceDirectory.
  • Save/Load wiring:
    • When saving a session, the GUI includes mode and the selected chat chatModelTitle.
    • When loading a session, the GUI:
      • Restores session.mode into Redux.
      • Restores the selected chat model from session.chatModelTitle (when available).
  • Tabs:
    • Removed per‑tab model and mode fields and their reducers (setTabModel, setTabMode).
    • Switching tabs now relies on the session’s persisted data; no more model/mode mirroring to tabs.
  • Types and plumbing:
    • Extended Session type (core) with mode? and chatModelTitle?.
    • Updated Core history manager to write/read the new fields when present.

Why

  • Keeps a conversation’s configuration together and makes it resilient to reloads.
  • Eliminates flicker or divergence from tab-local model/mode.
  • Paves the way for persisting additional session-level UI state when needed.

Backward compatibility

  • Existing session files load normally (new fields are optional).
  • Tabs continue to work; they just no longer store model/mode.

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-general-review or @continue-detailed-review

Checklist

  • [X] I've read the contributing guide
  • [X] The relevant docs, if any, have been updated or created
  • [X] The relevant tests, if any, have been updated or created

Screen recording or screenshot

[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Summary by cubic

Persist session-level chat mode and selected chat model. Switching tabs and loading sessions restore the session’s saved mode and model; new sessions start with the current selection.

  • New Features
    • Added optional mode and chatModelTitle to Session and persisted them to disk.
    • Loading a session sets Redux mode and updates the selected chat model.
    • Saving a session writes mode and the selected chat model title.

Written for commit ea6e871db56dadc53b007c70e2b5fdc52332704a. Summary will update automatically on new commits.

ferenci84 avatar Nov 09 '25 11:11 ferenci84

@ferenci84 looks like it's still per-tab as opposed to per session, possible PR is on the wrong branch?

@RomneyDa I just didn't push the latest commit. Corrected now.

ferenci84 avatar Nov 10 '25 21:11 ferenci84

Great, will take a look!

RomneyDa avatar Nov 19 '25 00:11 RomneyDa

@ferenci84 I took forever to follow up on this so I went ahead and touched up. Appreciate the contribution!

RomneyDa avatar Nov 19 '25 00:11 RomneyDa

:tada: This PR is included in version 1.5.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

sestinj avatar Nov 19 '25 04:11 sestinj

:tada: This PR is included in version 1.31.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

sestinj avatar Nov 19 '25 22:11 sestinj

:tada: This PR is included in version 1.35.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

sestinj avatar Nov 20 '25 21:11 sestinj

:tada: This PR is included in version 1.6.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

sestinj avatar Nov 20 '25 21:11 sestinj