-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Problem
The current task history persistence mechanism stores all history items directly in VSCode's globalState, which is causing several critical issues:
-
VSCode Warnings: The extension triggers VSCode warnings about excessive globalState usage:
WARN [mainThreadStorage] large extension state detected (extensionId: RooVeterinaryInc.roo-cline, global: true): 6173.2822265625kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead. -
Extension Crashes and UI Issues: Users experience various issues that may be related to memory management and globalState limitations:
- Complete extension crashes or grey/white screens
- Memory leaks consuming all available RAM
- Possible globalState race conditions between VS Code instances leading to hangs, crashes, and VS Code instability
-
Performance Degradation: Even before crashing, the extension suffers from performance issues due to loading and processing large amounts of history data at once.
-
globalState Thrashing: The current implementation loads and replaces the entire array of task history items in globalState every time a single task is created or modified. This causes:
- Excessive memory usage as the entire array is loaded into memory
- Significant performance overhead for each task operation
- Potential race conditions when multiple operations attempt to modify the array simultaneously
- Increased risk of data corruption if a write operation is interrupted
- Unnecessary network/disk I/O as the entire state is serialized and persisted repeatedly
-
Scale Problem: A busy developer can accumulate tens of thousands of tasks over the course of a year. At this scale, the globalState approach becomes completely unsustainable:
- The size of the globalState can grow to many megabytes
- Loading and processing this amount of data becomes increasingly slow
- The likelihood of crashes and performance issues increases dramatically
- VSCode's globalState was never designed to handle this volume of data
Possibly Related Issues
Proposed Solution
Implement a file-based storage system for task history:
- Store individual history items as JSON files in a directory structure organized by year and month.
- Use globalState only for monthly indexes to enable efficient lookups.
- Modify the frontend to fetch history data incrementally by month rather than all at once.
This approach will:
- Eliminate VSCode warnings about excessive globalState usage
- Prevent extension crashes due to memory limitations
- Improve performance by loading history data in smaller chunks
- Avoid race conditions between VS Code instances by using the filesystem for storage
- Eliminate globalState thrashing by operating on individual files instead of the entire history array
- Scale efficiently to handle tens of thousands of tasks accumulated over time
Metadata
Metadata
Assignees
Labels
Type
Projects
Status