Skip to content

Conversation

@ferenci84
Copy link
Contributor

@ferenci84 ferenci84 commented Nov 9, 2025

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): #7617

Discussion: #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

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • 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 4b330de. Summary will update automatically on new commits.

@ferenci84 ferenci84 requested a review from a team as a code owner November 9, 2025 11:29
@ferenci84 ferenci84 requested review from RomneyDa and removed request for a team November 9, 2025 11:29
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 9, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="gui/src/redux/slices/tabsSlice.ts">

<violation number="1" location="gui/src/redux/slices/tabsSlice.ts:46">
This PR&#39;s implementation contradicts its stated architectural goal. It re-introduces per-tab state management for model and mode (in `tabsSlice.ts`) instead of removing it, and the logic in `TabBar.tsx` incorrectly uses this tab-level state as the source of truth, overriding the intended session-level persistence.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

);
},
// Set the model title for a specific tab
setTabModel: (
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 9, 2025

Choose a reason for hiding this comment

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

This PR's implementation contradicts its stated architectural goal. It re-introduces per-tab state management for model and mode (in tabsSlice.ts) instead of removing it, and the logic in TabBar.tsx incorrectly uses this tab-level state as the source of truth, overriding the intended session-level persistence.

Prompt for AI agents
Address the following comment on gui/src/redux/slices/tabsSlice.ts at line 46:

<comment>This PR&#39;s implementation contradicts its stated architectural goal. It re-introduces per-tab state management for model and mode (in `tabsSlice.ts`) instead of removing it, and the logic in `TabBar.tsx` incorrectly uses this tab-level state as the source of truth, overriding the intended session-level persistence.</comment>

<file context>
@@ -37,6 +42,26 @@ export const tabsSlice = createSlice({
       );
     },
+    // Set the model title for a specific tab
+    setTabModel: (
+      state,
+      action: PayloadAction&lt;{ id: string; modelTitle: string }&gt;,
</file context>

✅ Addressed in a3b5ee8

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

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

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Nov 10, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Nov 10, 2025
@ferenci84
Copy link
Contributor Author

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

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Nov 10, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 6 files

@RomneyDa
Copy link
Collaborator

Great, will take a look!

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

Clean implementation!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 19, 2025
Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

Noticed the same logic is duplicated, could we move it to the newSession action instead?

@dosubot dosubot bot removed the lgtm This PR has been approved by a maintainer label Nov 19, 2025
@RomneyDa
Copy link
Collaborator

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

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

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants