Skip to content

Feature Request: Restore Last Chat Session on Application Crash/Unexpected Shutdown #4123

@Jarrodsz

Description

@Jarrodsz

Crash

Is your feature request related to a problem? Please describe.

Although Roo Code stores chat history, if VS Code crashes or is unexpectedly terminated, all open Roo chat panes within that VS Code window reload as empty/new sessions upon restart. Users must then manually find and reopen their previous conversations for each pane, losing the immediate context of their multi-pane workspace.
Use code with caution.
Markdown

Describe the solution you'd like

Implement a system where Roo Code remembers which chat sessions were active in its specific panes within a VS Code window. Upon VS Code restarting after a crash, Roo Code should automatically attempt to reload the last active chat history into each corresponding Roo chat pane.

Proposed Workflow:

  1. Pane State Tracking:

    • Each active Roo chat pane instance within a VS Code window should have its "current chat session ID" (or a similar identifier pointing to its history) persisted. This could leverage VS Code's extension state persistence mechanisms (e.g., Memento API for workspace state).
    • This state should be updated whenever a chat is opened/switched in a pane or as new messages come in (to ensure the latest state is captured).
  2. Detection on VS Code/Extension Activation:

    • When the Roo Code extension activates (especially after a VS Code restart that might have been a crash), it checks its persisted state for previously active panes and their associated chat session IDs for that specific VS Code window/workspace.
  3. Automatic UI Restoration:

    • For each identified previously active Roo chat pane:
      • Roo Code attempts to re-initialize or find the corresponding UI pane.
      • It then automatically loads the chat history associated with the persisted chat session ID into that specific pane's UI.
      • The scroll position or the view of the last few messages should ideally be restored if possible.
  4. Handling Panes That Can't Be Restored:

    • If a persisted pane state refers to a chat history that no longer exists or a pane cannot be recreated, Roo Code should handle this gracefully (e.g., open an empty pane, log an internal error, or show a minimal notification in that pane).
      Use code with caution.
      Markdown

Describe alternatives you've considered

  • Manual Reopening: Current behavior, which is inefficient and disrupts workflow, especially with multiple active Roo chat panes.
  • Relying solely on VS Code's generic webview/editor restoration: This may not be specific enough to map Roo's distinct chat sessions to their correct panes accurately without Roo's explicit management.
    Use code with caution.
    Markdown

Benefits

  • Seamless Workspace Continuity: Users can immediately resume their work in all their Roo chat panes after a VS Code crash without manual intervention.
  • Context Preservation: Maintains the context of multiple ongoing conversations across different panes.
  • Increased Productivity: Eliminates the time and effort needed to manually restore the chat UI state.
  • Improved User Experience: Makes Roo Code feel more integrated and resilient within the VS Code environment.
    Use code with caution.
    Markdown

Additional context

  • This feature relies on the existing chat history storage mechanism. The focus is on restoring the UI presentation of those histories in their respective panes.
  • Consider how to uniquely identify Roo chat panes within a VS Code window, especially if users can have multiple instances open.
  • The state should ideally be scoped to the VS Code workspace or window to handle multiple VS Code windows correctly.
  • A subtle notification like "Previous chat sessions restored" could be shown on first load after restoration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - Needs ScopingValid, but needs effort estimate or design input before work can start.feature requestFeature request, not a bug

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions