mirror of
https://github.com/cline/cline.git
synced 2026-09-19 10:13:34 +08:00
* feat: add auto-recovery for corrupted task history state Add automatic reconstruction of task history when JSON parsing fails. Changes: - Modified `reconstructTaskHistory()` to return reconstruction result or null - Enhanced `readTaskHistoryFromState()` with automatic corruption recovery - Added recursive reconstruction attempt with loop prevention flag - Wrapped JSON parsing in try-catch to handle corruption gracefully When task history state file is corrupted, the system now automatically attempts to reconstruct history from existing task folders, providing better resilience against file corruption issues. * feat: Add telemetry tracking for extension storage errors Replace console.error logging with structured telemetry capture for extension storage operations. This change: - Adds a new EXTENSION_STORAGE_ERROR telemetry event type to track storage-related failures - Implements captureExtensionStorageError method with error message truncation to prevent excessive data - Replaces three console.error calls in readTaskHistoryFromState with telemetry events This improves error monitoring and provides better insights into extension storage failures while maintaining data efficiency through message truncation. * fix: improve type safety and error handling in task history Add explicit return type to reconstructTaskHistory() function and refactor error handling in readTaskHistoryFromState() with nested try-catch blocks to better distinguish between file read errors and JSON parse errors. This improves error recovery and makes error tracking more precise through separate telemetry calls. * add param to reconstructTaskHistory for manually called action --------- Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>