Skip to content

Conversation

uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Sep 24, 2025

Description

Remove session reducer's history item from redux's persistent storage which was stored in vscode's session storage (having cases exceeding 5mb limit).

closes CON-3773

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

Removed persisting chat history in Redux to VS Code session storage to avoid hitting the 5 MB limit and prevent errors on large sessions. Closes CON-3773.

  • Bug Fixes

    • Stop persisting session.history and remove its migration so history is no longer saved or rehydrated.
  • Refactors

    • Remove unused redux-logger import and setup from the store.

@uinstinct uinstinct requested a review from a team as a code owner September 24, 2025 16:17
@uinstinct uinstinct requested review from RomneyDa and removed request for a team September 24, 2025 16:17
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 24, 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.

@uinstinct when I tried this earlier it caused failure to load last session, do we need to add loading of last session on startup from JSON?

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Sep 24, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Sep 25, 2025
@uinstinct
Copy link
Contributor Author

@uinstinct when I tried this earlier it caused failure to load last session, do we need to add loading of last session on startup from JSON?

I see. There is a slight delay on the first load.
Added a loading indicator!

feat.mp4

@uinstinct uinstinct requested a review from RomneyDa September 25, 2025 12:27
@RomneyDa
Copy link
Collaborator

RomneyDa commented Sep 25, 2025

@uinstinct I mean on startup it won't load the last session like it currently does. The last session button would operate as before

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.

See above comments

@uinstinct
Copy link
Contributor Author

feat.mp4

implemented!

@uinstinct uinstinct requested a review from RomneyDa September 26, 2025 06:31
export function setupStore(options: { ideMessenger?: IIdeMessenger }) {
const ideMessenger = options.ideMessenger ?? new IdeMessenger();

const logger = createLogger({
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be used if you uncomment the .concat(logger) below. For debugging

async (_, { extra, dispatch, getState }) => {
let lastSessionId = getState().session.lastSessionId;

const lastSessionResult = await extra.ideMessenger.request("history/list", {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would just used persisted lastSessionId still rather than listing history. If there's noLast sessionId we start a new session

Copy link
Collaborator

Choose a reason for hiding this comment

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

That being said might just comment it out since we will want some version of this soon for per-workspace sessions!

}, []);

useEffect(() => {
void dispatch(loadLastSession());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is pretty critical loading could we add some retry logic and error handling? Maybe retry with exponential backoff or a few times or similar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we need to retry for redux dispatch? because loadLastSession has error catching

Copy link
Collaborator

@RomneyDa RomneyDa Oct 6, 2025

Choose a reason for hiding this comment

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

I mean, retry the loading of the session, since the dispatch won't fail, if loadLastSession catches an error for this initial load (maybe pass a boolean or unwrap dispatch) then retry once or twice

Copy link
Collaborator

Choose a reason for hiding this comment

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

@uinstinct alternatively we could loadLastSession after initial config load, as a way to detect that core is up and running (will always be with vs code but not necessarily with jetbrains). I.e. remove the use effect and add load last session into the various things triggered on initial config load

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented!

RomneyDa
RomneyDa previously approved these changes Oct 8, 2025
}, []);

useEffect(() => {
void dispatch(loadLastSession());
Copy link
Collaborator

Choose a reason for hiding this comment

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

@uinstinct alternatively we could loadLastSession after initial config load, as a way to detect that core is up and running (will always be with vs code but not necessarily with jetbrains). I.e. remove the use effect and add load last session into the various things triggered on initial config load

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 8, 2025
@RomneyDa RomneyDa merged commit c167c4c into continuedev:main Oct 9, 2025
51 of 54 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Oct 9, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2025
@uinstinct uinstinct deleted the session-history-storage branch October 10, 2025 03:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants