This repository was archived by the owner on May 15, 2026. It is now read-only.

feat: Implement task history scanner and recovery tools - #5546

Closed
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner
Closed

feat: Implement task history scanner and recovery tools#5546
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner

Conversation

@KJ7LNW

@KJ7LNWKJ7LNW commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

Note to Reviewer

This is a PR series, so the line numbers shown by Github are exaggerated. The commit series clearly marks where each PR begins using lines that say NOTICE: PR ____ STARTS HERE

The commits tell a clean story, it will be easier to understand what is happening here by looking at each commit individually under "Commits" than by looking at all of the files that were changed.

Dependencies

This pull request implements a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues.

Actual diff without tests or langs:

]$gitdiff-w--statgithub/refactor-use-files-for-history..github/refactor-use-files-for-history-scanner--':(exclude)**/__tests__/**'':(exclude)**/i18n/**'// new task scanner and rebuild implementationsrc/core/task-persistence/taskScanner.ts|594++++++++++++++++++++webview-ui/src/components/settings/HistoryIndexTools.tsx|770++++++++++++++++++++++++++// new message handlers for that purpose src/core/webview/webviewMessageHandler.ts|129+++++// minor plumbingpackages/types/src/history.ts|94++++src/core/webview/ClineProvider.ts|2+-src/shared/ExtensionMessage.ts|4+-src/shared/WebviewMessage.ts|9+-webview-ui/src/components/settings/SettingsView.tsx|6+8fileschanged,1605insertions(+),3deletions(-)

Context

This PR addresses issue #5545 by providing tools to recover tasks that were lost due to global state race conditions. While issue #5544 prevents future task loss, this PR focuses on recovering tasks that were already lost before that fix.

Implementation

  • Added a new task history scanner that can identify valid, orphaned, and missing tasks
  • Implemented a task reconstruction system that can recover lost tasks from UI message history
  • Created a mutex pattern to ensure history operations are mutually exclusive
  • Added bidirectional sync capabilities between file-based history and legacy globalState
  • Developed a comprehensive UI for managing and repairing task history

History Index Tools

image

Missing/Orphaned Task Preview

image

Orphaned Task Recovery

image

UI Index Scan Logs

image

UI Index Rebuild Logs

image

After Recovery

image

How to Test

  1. Open the Settings panel and navigate to the History section
  2. Use the "Scan Task History" button to identify any inconsistencies
  3. Review the scan results to see valid, orphaned, and missing tasks
  4. Use the repair options to reconstruct and reindex lost tasks

Fixes#5545

@KJ7LNW
KJ7LNW requested review from cte, jr and mrubens as code ownersJuly 10, 2025 02:32
@dosubotdosubotBot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request UI/UX UI/UX related or focused labels Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as draft July 10, 2025 02:33
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@hannesrudolphhannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as ready for review July 10, 2025 03:38
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@daniel-lxsdaniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code RoadmapJul 10, 2025
@hannesrudolphhannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 10, 2025
@hannesrudolphhannesrudolph moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code RoadmapJul 10, 2025
@daniel-lxs

Copy link
Copy Markdown
Member

Hey @KJ7LNW,Thanks for the work on this! Do you think we should consider simplifying the UI and options a bit? Maybe a single button to restore tasks under the "About Roo Code" section or somewhere similar that just restores tasks for the current workspace?

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

@daniel-lxsdaniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code RoadmapJul 10, 2025
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

I had the same thought about complexity for that interface, it can certainly be simpler. These options were mostly used for my testing, and end users probably just need a big "fix it" button.

What if I leave the check boxes to what they should default as, and just move them into the collapsed advanced section?

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@daniel-lxs I am moving this into draft, but the dependent pull requests can still be reviewed and merged before this one is ready.

Eric Wheeler added 20 commits July 11, 2025 15:06
…ions
- Added HistorySearchOptions interface to packages/types
- Updated WebviewMessage to use historySearchOptions field instead of individual fields
- Added historyItems message type to ExtensionMessage
- Implemented getHistoryItems handler in webviewMessageHandler
- Refactored getHistoryItemsForSearch to accept HistorySearchOptions parameter
- Completely replaced client-side filtering with server-side filtering
- Removed dependency on Fzf for client-side search
- Added loading state to history components with loading spinner
- Updated HistoryPreview to use limit parameter and respect loading state
- Updated tests to account for the new loading state
- Set explicit limits for history items in ChatView (10) and HistoryPreview (3)
This refactoring improves performance by moving filtering to the server side,
enhances type safety with the dedicated HistorySearchOptions type, reduces
duplication in the interface definitions, and improves the user experience
with loading indicators.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: improve history search sorting and filtering
- Created dedicated HistorySortOption type in shared types package
- Modified API to take year and month as direct parameters
- Added helper functions to reduce code duplication:
- _getTasksByWorkspace to extract tasks from month data
- _fastSortFilterTasks for efficient pre-filtering and sorting
- Ensured consistent sorting across all functions
- Optimized filtering to happen before file reads
- Added support for custom sort order in getAvailableHistoryMonths
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Move fuzzy search from frontend to backend using fzf library
- Create dedicated taskHistorySearch module with configurable parameters
- Add match position tracking for proper highlighting in UI
- Implement debounced search in frontend to prevent flickering
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: maintain sort order during search
When a search string is present, the sort order specified by the user wasn't
being respected. This change ensures that:
- Non-relevance sorts (newest, oldest, etc.) maintain their order when searching
- The 'mostRelevant' sort option continues to use fuzzy search order
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implemented automatic refresh of the task history list when tasks are deleted:
- Added taskDeletedConfirmation message type to WebviewMessage and ExtensionMessage
- Modified webviewMessageHandler to send confirmation after task deletion
- Updated useTaskSearch hook to listen for deletion confirmation and refresh the list
- Implemented non-flickering refresh that maintains current search parameters
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Created SpinnerOverlay component to darken the view during deletion
- Added state to track deletion in progress in HistoryView
- Updated DeleteTaskDialog and BatchDeleteTaskDialog to trigger the overlay
- Added event listener to hide the overlay when deletion completes
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add request ID tracking to useTaskSearch hook to ensure each component
only processes responses to its own search requests. This prevents the
issue where multiple components using the hook would all receive updates
when a search response comes back, regardless of which component initiated
the search.
- Add global serial counter to generate unique request IDs
- Add component-isolated ref to track current request ID
- Modify message handler to only process matching responses
- Pass request ID back in webviewMessageHandler response
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed taskHistory field and all its references from the codebase as part
of migrating to file-based storage.
- Removed taskHistory from GlobalSettings schema
- Removed import of historyItemSchema
- Removed taskHistory from ExtensionState interface
- Cleared PASS_THROUGH_STATE_KEYS array in ContextProxy
- Updated ClineProvider to use file-based API instead of global state
- Updated UI components to work without taskHistory prop
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed redundant useTaskSearch call from ChatView since HistoryPreview
already makes its own call to fetch the tasks it needs to display.
This eliminates an unnecessary API call on application startup and
simplifies the component by removing conditional rendering based on task count.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Remove unnecessary loading and returning of entire task history array.
The return value was never used by any caller, so we can make this an O(1)
operation instead of O(n) by simply saving the single item.
This change significantly improves performance when updating task history,
which happens frequently during task execution.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Allows you to filter tasks not just by all and current, but also by any
historic workspace directory that exists in existing HistoryItem metadata
- Added persistent workspace index with metadata (path, name, missing status, timestamp)
- Created a rich workspace selector UI with filtering and grouping capabilities
- Added visual indicators for missing workspaces (strikethrough)
- Improved loading states and feedback during workspace changes and searches
- Added special workspace paths handling ("all", "current", "unknown")
- Standardized empty/undefined workspace paths to "unknown" for legacy items that do not have workspace stored in their metadata
- Optimized batch processing for better performance
This enhancement provides users with a more intuitive and powerful way to navigate their task history across multiple workspaces.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added a limit filter dropdown to the history view that allows users to control
how many results are displayed. The filter:
- Defaults to 50 items
- Offers options for 50, 100, 200, 500, 1000 items or all results
- Shows loading spinner when changing limits
- Integrates with existing workspace and sort filters
- Maintains consistent search options across operations
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This change modifies the copy button in task history to retrieve the task content from the backend storage using getHistoryItem before copying it to the clipboard. This ensures the most up-to-date content is copied.
Fixes: #3648
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a structured upgrade system that manages the task history migration process:
- Create a dedicated upgrade UI that blocks normal app usage until migration completes
- Separate migration check from migration execution for better control flow
- Add progress logging during migration to provide user feedback
- Remove automatic migration during extension activation
- Add new message types for upgrade status and completion
This change improves the user experience during task history migration by providing
visual feedback and ensuring the app is in a consistent state before allowing normal usage.
The upgrade system is designed to be extensible for future structural upgrades beyond
task history migration.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Add tests for cross-workspace functionality
- Verify items can be found in all workspaces where they existed
- Ensure workspace property reflects the latest workspace
- Add tests for helper functions and edge cases
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Removed pass-through state tests from ContextProxy that no longer apply
- Updated ClineProvider tests to use file-based history instead of global state
- Modified ChatTextArea tests to use useTaskSearch hook instead of taskHistory prop
- Completely rewrote useTaskSearch tests to use message-based architecture
- Updated other tests to remove taskHistory references from mock states
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
test: Fix ClineProvider test by mocking extension context and taskHistory
This commit fixes the failing test 'correctly identifies subtask scenario for issue #4602' by:
1. Adding necessary Vitest imports
2. Mocking getExtensionContext to return a mock context with globalStorageUri
3. Mocking taskHistory module to prevent file system operations during tests
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added missing translations across all 17 supported locales:
- upgrade.* keys in common.json for task history index upgrade UI
- workspace.unknown, workspace.available, workspace.recent, workspace.filterPlaceholder in history.json
- limit.* keys and noItemsFound in history.json for pagination controls
All translations now complete with proper localization for:
- Catalan, German, Spanish, French, Hindi, Indonesian, Italian
- Japanese, Korean, Dutch, Polish, Portuguese (Brazil)
- Russian, Turkish, Vietnamese, Chinese (Simplified/Traditional)
Fixes missing UI text that would appear in English fallback
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues:
- Add new HistoryScanResults and HistoryRebuildOptions interfaces
- Refactor reindexHistoryItems into modular components:
- scanTaskHistory: Identifies valid, orphaned, and missing tasks
- rebuildIndexes: Rebuilds indexes with configurable options
- reconstructTask: Recovers orphaned tasks from UI messages
- Create new HistoryIndexTools UI component with:
- Task history scanning capabilities
- Configurable rebuild options (merge/replace modes)
- Task preview and inspection tools
- Real-time operation logging
- Improve error handling and provide detailed logging
- Update message handlers and type definitions
- Add comprehensive translations for the new UI
This change helps users diagnose and fix task history inconsistencies between global state and filesystem, preventing "lost" tasks and improving history reliability.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: prevent ReDoS vulnerability in log message regex
Replace non-greedy wildcard pattern (.*?) with a more specific character class [^\]]*
to avoid potential catastrophic backtracking on malicious input.
This addresses a security vulnerability where the regex could run slow on
strings starting with '[]' and containing many repetitions of '\t'.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: replace regex with string indexes in logMessage
Replace regex pattern with string index operations in logMessage function to
avoid potential ReDoS (Regular Expression Denial of Service) vulnerabilities.
The change uses indexOf and substring instead of regex matching, which is
more efficient and safer for processing log messages with tags.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: implement mutual exclusion for history operations
Created a mutex pattern to ensure history operations are mutually exclusive.
This prevents concurrent execution of reindexHistoryItems and search operations,
maintaining data consistency during indexing.
Extracted common mutex logic into a reusable _withMutex helper function.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
feat: add bidirectional sync with legacy globalState
Adds capability to synchronize tasks between the new file-based history system and legacy VSCode globalState storage:
- Renamed mergeGlobal to mergeFromGlobal for clarity
- Added new mergeToGlobal option to update globalState with file index data
- Added tracking of tasks that exist only in file indexes via tasksOnlyInTaskHistoryIndexes
- Added developer UI controls in advanced section for managing globalState sync
- Updated tests and documentation to reflect new bidirectional capabilities
This feature enables backward compatibility testing with older versions of Roo Code by ensuring tasks created in the new storage format are also available in the legacy format.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: make rebuildIndexes private by renaming to _rebuildIndexes
This change makes the rebuildIndexes function private by adding an underscore prefix
to its name, following the project's convention for private functions. All references
to this function have been updated accordingly in both the implementation and test files.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add translations for task history reindexing features across all supported languages:
- Add backend translations for history reindex success/failure messages
- Add frontend translations for the history index tools UI
- Update settings and common translation files for all locales
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Simplifies the task history recovery interface by moving all recovery and rebuild options into a single collapsed 'Advanced' section. This addresses feedback that the previous UI was too complex for users who just need to quickly restore tasks.
The main 'Rebuild' and 'Rescan' action buttons remain directly visible, while all configuration checkboxes and mode selections are now neatly tucked away, available on-demand, and default to sensible values for a simple 'fix it' experience.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

All configuration checkboxes and mode selections are now neatly tucked away, and default to sensible values for a simple 'fix it' experience:

image

@KJ7LNW
KJ7LNW marked this pull request as ready for review July 11, 2025 23:51
@KJ7LNWKJ7LNW moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code RoadmapJul 11, 2025
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@KJ7LNWKJ7LNW closed this Jul 12, 2025
@github-project-automationgithub-project-automationBot moved this from PR [Needs Prelim Review] to Done in Roo Code RoadmapJul 12, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

EnhancementNew feature or requestPR - Needs Preliminary Reviewsize:XXLThis PR changes 1000+ lines, ignoring generated files.UI/UXUI/UX related or focused

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

No way to recover tasks lost due to global state race conditions

3 participants

@KJ7LNW@daniel-lxs@hannesrudolph
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

feat: Implement task history scanner and recovery tools - #5546

Closed
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner
Closed

feat: Implement task history scanner and recovery tools#5546
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner

Conversation

@KJ7LNW

@KJ7LNWKJ7LNW commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

Note to Reviewer

This is a PR series, so the line numbers shown by Github are exaggerated. The commit series clearly marks where each PR begins using lines that say NOTICE: PR ____ STARTS HERE

The commits tell a clean story, it will be easier to understand what is happening here by looking at each commit individually under "Commits" than by looking at all of the files that were changed.

Dependencies

This pull request implements a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues.

Actual diff without tests or langs:

]$gitdiff-w--statgithub/refactor-use-files-for-history..github/refactor-use-files-for-history-scanner--':(exclude)**/__tests__/**'':(exclude)**/i18n/**'// new task scanner and rebuild implementationsrc/core/task-persistence/taskScanner.ts|594++++++++++++++++++++webview-ui/src/components/settings/HistoryIndexTools.tsx|770++++++++++++++++++++++++++// new message handlers for that purpose src/core/webview/webviewMessageHandler.ts|129+++++// minor plumbingpackages/types/src/history.ts|94++++src/core/webview/ClineProvider.ts|2+-src/shared/ExtensionMessage.ts|4+-src/shared/WebviewMessage.ts|9+-webview-ui/src/components/settings/SettingsView.tsx|6+8fileschanged,1605insertions(+),3deletions(-)

Context

This PR addresses issue #5545 by providing tools to recover tasks that were lost due to global state race conditions. While issue #5544 prevents future task loss, this PR focuses on recovering tasks that were already lost before that fix.

Implementation

  • Added a new task history scanner that can identify valid, orphaned, and missing tasks
  • Implemented a task reconstruction system that can recover lost tasks from UI message history
  • Created a mutex pattern to ensure history operations are mutually exclusive
  • Added bidirectional sync capabilities between file-based history and legacy globalState
  • Developed a comprehensive UI for managing and repairing task history

History Index Tools

image

Missing/Orphaned Task Preview

image

Orphaned Task Recovery

image

UI Index Scan Logs

image

UI Index Rebuild Logs

image

After Recovery

image

How to Test

  1. Open the Settings panel and navigate to the History section
  2. Use the "Scan Task History" button to identify any inconsistencies
  3. Review the scan results to see valid, orphaned, and missing tasks
  4. Use the repair options to reconstruct and reindex lost tasks

Fixes#5545

@KJ7LNW
KJ7LNW requested review from cte, jr and mrubens as code ownersJuly 10, 2025 02:32
@dosubotdosubotBot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request UI/UX UI/UX related or focused labels Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as draft July 10, 2025 02:33
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@hannesrudolphhannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as ready for review July 10, 2025 03:38
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@daniel-lxsdaniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code RoadmapJul 10, 2025
@hannesrudolphhannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 10, 2025
@hannesrudolphhannesrudolph moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code RoadmapJul 10, 2025
@daniel-lxs

Copy link
Copy Markdown
Member

Hey @KJ7LNW,Thanks for the work on this! Do you think we should consider simplifying the UI and options a bit? Maybe a single button to restore tasks under the "About Roo Code" section or somewhere similar that just restores tasks for the current workspace?

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

@daniel-lxsdaniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code RoadmapJul 10, 2025
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

I had the same thought about complexity for that interface, it can certainly be simpler. These options were mostly used for my testing, and end users probably just need a big "fix it" button.

What if I leave the check boxes to what they should default as, and just move them into the collapsed advanced section?

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@daniel-lxs I am moving this into draft, but the dependent pull requests can still be reviewed and merged before this one is ready.

Eric Wheeler added 20 commits July 11, 2025 15:06
…ions
- Added HistorySearchOptions interface to packages/types
- Updated WebviewMessage to use historySearchOptions field instead of individual fields
- Added historyItems message type to ExtensionMessage
- Implemented getHistoryItems handler in webviewMessageHandler
- Refactored getHistoryItemsForSearch to accept HistorySearchOptions parameter
- Completely replaced client-side filtering with server-side filtering
- Removed dependency on Fzf for client-side search
- Added loading state to history components with loading spinner
- Updated HistoryPreview to use limit parameter and respect loading state
- Updated tests to account for the new loading state
- Set explicit limits for history items in ChatView (10) and HistoryPreview (3)
This refactoring improves performance by moving filtering to the server side,
enhances type safety with the dedicated HistorySearchOptions type, reduces
duplication in the interface definitions, and improves the user experience
with loading indicators.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: improve history search sorting and filtering
- Created dedicated HistorySortOption type in shared types package
- Modified API to take year and month as direct parameters
- Added helper functions to reduce code duplication:
- _getTasksByWorkspace to extract tasks from month data
- _fastSortFilterTasks for efficient pre-filtering and sorting
- Ensured consistent sorting across all functions
- Optimized filtering to happen before file reads
- Added support for custom sort order in getAvailableHistoryMonths
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Move fuzzy search from frontend to backend using fzf library
- Create dedicated taskHistorySearch module with configurable parameters
- Add match position tracking for proper highlighting in UI
- Implement debounced search in frontend to prevent flickering
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: maintain sort order during search
When a search string is present, the sort order specified by the user wasn't
being respected. This change ensures that:
- Non-relevance sorts (newest, oldest, etc.) maintain their order when searching
- The 'mostRelevant' sort option continues to use fuzzy search order
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implemented automatic refresh of the task history list when tasks are deleted:
- Added taskDeletedConfirmation message type to WebviewMessage and ExtensionMessage
- Modified webviewMessageHandler to send confirmation after task deletion
- Updated useTaskSearch hook to listen for deletion confirmation and refresh the list
- Implemented non-flickering refresh that maintains current search parameters
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Created SpinnerOverlay component to darken the view during deletion
- Added state to track deletion in progress in HistoryView
- Updated DeleteTaskDialog and BatchDeleteTaskDialog to trigger the overlay
- Added event listener to hide the overlay when deletion completes
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add request ID tracking to useTaskSearch hook to ensure each component
only processes responses to its own search requests. This prevents the
issue where multiple components using the hook would all receive updates
when a search response comes back, regardless of which component initiated
the search.
- Add global serial counter to generate unique request IDs
- Add component-isolated ref to track current request ID
- Modify message handler to only process matching responses
- Pass request ID back in webviewMessageHandler response
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed taskHistory field and all its references from the codebase as part
of migrating to file-based storage.
- Removed taskHistory from GlobalSettings schema
- Removed import of historyItemSchema
- Removed taskHistory from ExtensionState interface
- Cleared PASS_THROUGH_STATE_KEYS array in ContextProxy
- Updated ClineProvider to use file-based API instead of global state
- Updated UI components to work without taskHistory prop
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed redundant useTaskSearch call from ChatView since HistoryPreview
already makes its own call to fetch the tasks it needs to display.
This eliminates an unnecessary API call on application startup and
simplifies the component by removing conditional rendering based on task count.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Remove unnecessary loading and returning of entire task history array.
The return value was never used by any caller, so we can make this an O(1)
operation instead of O(n) by simply saving the single item.
This change significantly improves performance when updating task history,
which happens frequently during task execution.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Allows you to filter tasks not just by all and current, but also by any
historic workspace directory that exists in existing HistoryItem metadata
- Added persistent workspace index with metadata (path, name, missing status, timestamp)
- Created a rich workspace selector UI with filtering and grouping capabilities
- Added visual indicators for missing workspaces (strikethrough)
- Improved loading states and feedback during workspace changes and searches
- Added special workspace paths handling ("all", "current", "unknown")
- Standardized empty/undefined workspace paths to "unknown" for legacy items that do not have workspace stored in their metadata
- Optimized batch processing for better performance
This enhancement provides users with a more intuitive and powerful way to navigate their task history across multiple workspaces.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added a limit filter dropdown to the history view that allows users to control
how many results are displayed. The filter:
- Defaults to 50 items
- Offers options for 50, 100, 200, 500, 1000 items or all results
- Shows loading spinner when changing limits
- Integrates with existing workspace and sort filters
- Maintains consistent search options across operations
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This change modifies the copy button in task history to retrieve the task content from the backend storage using getHistoryItem before copying it to the clipboard. This ensures the most up-to-date content is copied.
Fixes: #3648
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a structured upgrade system that manages the task history migration process:
- Create a dedicated upgrade UI that blocks normal app usage until migration completes
- Separate migration check from migration execution for better control flow
- Add progress logging during migration to provide user feedback
- Remove automatic migration during extension activation
- Add new message types for upgrade status and completion
This change improves the user experience during task history migration by providing
visual feedback and ensuring the app is in a consistent state before allowing normal usage.
The upgrade system is designed to be extensible for future structural upgrades beyond
task history migration.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Add tests for cross-workspace functionality
- Verify items can be found in all workspaces where they existed
- Ensure workspace property reflects the latest workspace
- Add tests for helper functions and edge cases
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Removed pass-through state tests from ContextProxy that no longer apply
- Updated ClineProvider tests to use file-based history instead of global state
- Modified ChatTextArea tests to use useTaskSearch hook instead of taskHistory prop
- Completely rewrote useTaskSearch tests to use message-based architecture
- Updated other tests to remove taskHistory references from mock states
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
test: Fix ClineProvider test by mocking extension context and taskHistory
This commit fixes the failing test 'correctly identifies subtask scenario for issue #4602' by:
1. Adding necessary Vitest imports
2. Mocking getExtensionContext to return a mock context with globalStorageUri
3. Mocking taskHistory module to prevent file system operations during tests
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added missing translations across all 17 supported locales:
- upgrade.* keys in common.json for task history index upgrade UI
- workspace.unknown, workspace.available, workspace.recent, workspace.filterPlaceholder in history.json
- limit.* keys and noItemsFound in history.json for pagination controls
All translations now complete with proper localization for:
- Catalan, German, Spanish, French, Hindi, Indonesian, Italian
- Japanese, Korean, Dutch, Polish, Portuguese (Brazil)
- Russian, Turkish, Vietnamese, Chinese (Simplified/Traditional)
Fixes missing UI text that would appear in English fallback
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues:
- Add new HistoryScanResults and HistoryRebuildOptions interfaces
- Refactor reindexHistoryItems into modular components:
- scanTaskHistory: Identifies valid, orphaned, and missing tasks
- rebuildIndexes: Rebuilds indexes with configurable options
- reconstructTask: Recovers orphaned tasks from UI messages
- Create new HistoryIndexTools UI component with:
- Task history scanning capabilities
- Configurable rebuild options (merge/replace modes)
- Task preview and inspection tools
- Real-time operation logging
- Improve error handling and provide detailed logging
- Update message handlers and type definitions
- Add comprehensive translations for the new UI
This change helps users diagnose and fix task history inconsistencies between global state and filesystem, preventing "lost" tasks and improving history reliability.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: prevent ReDoS vulnerability in log message regex
Replace non-greedy wildcard pattern (.*?) with a more specific character class [^\]]*
to avoid potential catastrophic backtracking on malicious input.
This addresses a security vulnerability where the regex could run slow on
strings starting with '[]' and containing many repetitions of '\t'.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: replace regex with string indexes in logMessage
Replace regex pattern with string index operations in logMessage function to
avoid potential ReDoS (Regular Expression Denial of Service) vulnerabilities.
The change uses indexOf and substring instead of regex matching, which is
more efficient and safer for processing log messages with tags.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: implement mutual exclusion for history operations
Created a mutex pattern to ensure history operations are mutually exclusive.
This prevents concurrent execution of reindexHistoryItems and search operations,
maintaining data consistency during indexing.
Extracted common mutex logic into a reusable _withMutex helper function.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
feat: add bidirectional sync with legacy globalState
Adds capability to synchronize tasks between the new file-based history system and legacy VSCode globalState storage:
- Renamed mergeGlobal to mergeFromGlobal for clarity
- Added new mergeToGlobal option to update globalState with file index data
- Added tracking of tasks that exist only in file indexes via tasksOnlyInTaskHistoryIndexes
- Added developer UI controls in advanced section for managing globalState sync
- Updated tests and documentation to reflect new bidirectional capabilities
This feature enables backward compatibility testing with older versions of Roo Code by ensuring tasks created in the new storage format are also available in the legacy format.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: make rebuildIndexes private by renaming to _rebuildIndexes
This change makes the rebuildIndexes function private by adding an underscore prefix
to its name, following the project's convention for private functions. All references
to this function have been updated accordingly in both the implementation and test files.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add translations for task history reindexing features across all supported languages:
- Add backend translations for history reindex success/failure messages
- Add frontend translations for the history index tools UI
- Update settings and common translation files for all locales
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Simplifies the task history recovery interface by moving all recovery and rebuild options into a single collapsed 'Advanced' section. This addresses feedback that the previous UI was too complex for users who just need to quickly restore tasks.
The main 'Rebuild' and 'Rescan' action buttons remain directly visible, while all configuration checkboxes and mode selections are now neatly tucked away, available on-demand, and default to sensible values for a simple 'fix it' experience.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

All configuration checkboxes and mode selections are now neatly tucked away, and default to sensible values for a simple 'fix it' experience:

image

@KJ7LNW
KJ7LNW marked this pull request as ready for review July 11, 2025 23:51
@KJ7LNWKJ7LNW moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code RoadmapJul 11, 2025
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@KJ7LNWKJ7LNW closed this Jul 12, 2025
@github-project-automationgithub-project-automationBot moved this from PR [Needs Prelim Review] to Done in Roo Code RoadmapJul 12, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

EnhancementNew feature or requestPR - Needs Preliminary Reviewsize:XXLThis PR changes 1000+ lines, ignoring generated files.UI/UXUI/UX related or focused

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

No way to recover tasks lost due to global state race conditions

3 participants

@KJ7LNW@daniel-lxs@hannesrudolph
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

feat: Implement task history scanner and recovery tools - #5546

Closed
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner
Closed

feat: Implement task history scanner and recovery tools#5546
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner

Conversation

@KJ7LNW

@KJ7LNWKJ7LNW commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

Note to Reviewer

This is a PR series, so the line numbers shown by Github are exaggerated. The commit series clearly marks where each PR begins using lines that say NOTICE: PR ____ STARTS HERE

The commits tell a clean story, it will be easier to understand what is happening here by looking at each commit individually under "Commits" than by looking at all of the files that were changed.

Dependencies

This pull request implements a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues.

Actual diff without tests or langs:

]$gitdiff-w--statgithub/refactor-use-files-for-history..github/refactor-use-files-for-history-scanner--':(exclude)**/__tests__/**'':(exclude)**/i18n/**'// new task scanner and rebuild implementationsrc/core/task-persistence/taskScanner.ts|594++++++++++++++++++++webview-ui/src/components/settings/HistoryIndexTools.tsx|770++++++++++++++++++++++++++// new message handlers for that purpose src/core/webview/webviewMessageHandler.ts|129+++++// minor plumbingpackages/types/src/history.ts|94++++src/core/webview/ClineProvider.ts|2+-src/shared/ExtensionMessage.ts|4+-src/shared/WebviewMessage.ts|9+-webview-ui/src/components/settings/SettingsView.tsx|6+8fileschanged,1605insertions(+),3deletions(-)

Context

This PR addresses issue #5545 by providing tools to recover tasks that were lost due to global state race conditions. While issue #5544 prevents future task loss, this PR focuses on recovering tasks that were already lost before that fix.

Implementation

  • Added a new task history scanner that can identify valid, orphaned, and missing tasks
  • Implemented a task reconstruction system that can recover lost tasks from UI message history
  • Created a mutex pattern to ensure history operations are mutually exclusive
  • Added bidirectional sync capabilities between file-based history and legacy globalState
  • Developed a comprehensive UI for managing and repairing task history

History Index Tools

image

Missing/Orphaned Task Preview

image

Orphaned Task Recovery

image

UI Index Scan Logs

image

UI Index Rebuild Logs

image

After Recovery

image

How to Test

  1. Open the Settings panel and navigate to the History section
  2. Use the "Scan Task History" button to identify any inconsistencies
  3. Review the scan results to see valid, orphaned, and missing tasks
  4. Use the repair options to reconstruct and reindex lost tasks

Fixes#5545

@KJ7LNW
KJ7LNW requested review from cte, jr and mrubens as code ownersJuly 10, 2025 02:32
@dosubotdosubotBot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request UI/UX UI/UX related or focused labels Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as draft July 10, 2025 02:33
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@hannesrudolphhannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as ready for review July 10, 2025 03:38
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@daniel-lxsdaniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code RoadmapJul 10, 2025
@hannesrudolphhannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 10, 2025
@hannesrudolphhannesrudolph moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code RoadmapJul 10, 2025
@daniel-lxs

Copy link
Copy Markdown
Member

Hey @KJ7LNW,Thanks for the work on this! Do you think we should consider simplifying the UI and options a bit? Maybe a single button to restore tasks under the "About Roo Code" section or somewhere similar that just restores tasks for the current workspace?

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

@daniel-lxsdaniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code RoadmapJul 10, 2025
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

I had the same thought about complexity for that interface, it can certainly be simpler. These options were mostly used for my testing, and end users probably just need a big "fix it" button.

What if I leave the check boxes to what they should default as, and just move them into the collapsed advanced section?

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@daniel-lxs I am moving this into draft, but the dependent pull requests can still be reviewed and merged before this one is ready.

Eric Wheeler added 20 commits July 11, 2025 15:06
…ions
- Added HistorySearchOptions interface to packages/types
- Updated WebviewMessage to use historySearchOptions field instead of individual fields
- Added historyItems message type to ExtensionMessage
- Implemented getHistoryItems handler in webviewMessageHandler
- Refactored getHistoryItemsForSearch to accept HistorySearchOptions parameter
- Completely replaced client-side filtering with server-side filtering
- Removed dependency on Fzf for client-side search
- Added loading state to history components with loading spinner
- Updated HistoryPreview to use limit parameter and respect loading state
- Updated tests to account for the new loading state
- Set explicit limits for history items in ChatView (10) and HistoryPreview (3)
This refactoring improves performance by moving filtering to the server side,
enhances type safety with the dedicated HistorySearchOptions type, reduces
duplication in the interface definitions, and improves the user experience
with loading indicators.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: improve history search sorting and filtering
- Created dedicated HistorySortOption type in shared types package
- Modified API to take year and month as direct parameters
- Added helper functions to reduce code duplication:
- _getTasksByWorkspace to extract tasks from month data
- _fastSortFilterTasks for efficient pre-filtering and sorting
- Ensured consistent sorting across all functions
- Optimized filtering to happen before file reads
- Added support for custom sort order in getAvailableHistoryMonths
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Move fuzzy search from frontend to backend using fzf library
- Create dedicated taskHistorySearch module with configurable parameters
- Add match position tracking for proper highlighting in UI
- Implement debounced search in frontend to prevent flickering
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: maintain sort order during search
When a search string is present, the sort order specified by the user wasn't
being respected. This change ensures that:
- Non-relevance sorts (newest, oldest, etc.) maintain their order when searching
- The 'mostRelevant' sort option continues to use fuzzy search order
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implemented automatic refresh of the task history list when tasks are deleted:
- Added taskDeletedConfirmation message type to WebviewMessage and ExtensionMessage
- Modified webviewMessageHandler to send confirmation after task deletion
- Updated useTaskSearch hook to listen for deletion confirmation and refresh the list
- Implemented non-flickering refresh that maintains current search parameters
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Created SpinnerOverlay component to darken the view during deletion
- Added state to track deletion in progress in HistoryView
- Updated DeleteTaskDialog and BatchDeleteTaskDialog to trigger the overlay
- Added event listener to hide the overlay when deletion completes
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add request ID tracking to useTaskSearch hook to ensure each component
only processes responses to its own search requests. This prevents the
issue where multiple components using the hook would all receive updates
when a search response comes back, regardless of which component initiated
the search.
- Add global serial counter to generate unique request IDs
- Add component-isolated ref to track current request ID
- Modify message handler to only process matching responses
- Pass request ID back in webviewMessageHandler response
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed taskHistory field and all its references from the codebase as part
of migrating to file-based storage.
- Removed taskHistory from GlobalSettings schema
- Removed import of historyItemSchema
- Removed taskHistory from ExtensionState interface
- Cleared PASS_THROUGH_STATE_KEYS array in ContextProxy
- Updated ClineProvider to use file-based API instead of global state
- Updated UI components to work without taskHistory prop
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed redundant useTaskSearch call from ChatView since HistoryPreview
already makes its own call to fetch the tasks it needs to display.
This eliminates an unnecessary API call on application startup and
simplifies the component by removing conditional rendering based on task count.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Remove unnecessary loading and returning of entire task history array.
The return value was never used by any caller, so we can make this an O(1)
operation instead of O(n) by simply saving the single item.
This change significantly improves performance when updating task history,
which happens frequently during task execution.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Allows you to filter tasks not just by all and current, but also by any
historic workspace directory that exists in existing HistoryItem metadata
- Added persistent workspace index with metadata (path, name, missing status, timestamp)
- Created a rich workspace selector UI with filtering and grouping capabilities
- Added visual indicators for missing workspaces (strikethrough)
- Improved loading states and feedback during workspace changes and searches
- Added special workspace paths handling ("all", "current", "unknown")
- Standardized empty/undefined workspace paths to "unknown" for legacy items that do not have workspace stored in their metadata
- Optimized batch processing for better performance
This enhancement provides users with a more intuitive and powerful way to navigate their task history across multiple workspaces.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added a limit filter dropdown to the history view that allows users to control
how many results are displayed. The filter:
- Defaults to 50 items
- Offers options for 50, 100, 200, 500, 1000 items or all results
- Shows loading spinner when changing limits
- Integrates with existing workspace and sort filters
- Maintains consistent search options across operations
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This change modifies the copy button in task history to retrieve the task content from the backend storage using getHistoryItem before copying it to the clipboard. This ensures the most up-to-date content is copied.
Fixes: #3648
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a structured upgrade system that manages the task history migration process:
- Create a dedicated upgrade UI that blocks normal app usage until migration completes
- Separate migration check from migration execution for better control flow
- Add progress logging during migration to provide user feedback
- Remove automatic migration during extension activation
- Add new message types for upgrade status and completion
This change improves the user experience during task history migration by providing
visual feedback and ensuring the app is in a consistent state before allowing normal usage.
The upgrade system is designed to be extensible for future structural upgrades beyond
task history migration.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Add tests for cross-workspace functionality
- Verify items can be found in all workspaces where they existed
- Ensure workspace property reflects the latest workspace
- Add tests for helper functions and edge cases
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Removed pass-through state tests from ContextProxy that no longer apply
- Updated ClineProvider tests to use file-based history instead of global state
- Modified ChatTextArea tests to use useTaskSearch hook instead of taskHistory prop
- Completely rewrote useTaskSearch tests to use message-based architecture
- Updated other tests to remove taskHistory references from mock states
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
test: Fix ClineProvider test by mocking extension context and taskHistory
This commit fixes the failing test 'correctly identifies subtask scenario for issue #4602' by:
1. Adding necessary Vitest imports
2. Mocking getExtensionContext to return a mock context with globalStorageUri
3. Mocking taskHistory module to prevent file system operations during tests
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added missing translations across all 17 supported locales:
- upgrade.* keys in common.json for task history index upgrade UI
- workspace.unknown, workspace.available, workspace.recent, workspace.filterPlaceholder in history.json
- limit.* keys and noItemsFound in history.json for pagination controls
All translations now complete with proper localization for:
- Catalan, German, Spanish, French, Hindi, Indonesian, Italian
- Japanese, Korean, Dutch, Polish, Portuguese (Brazil)
- Russian, Turkish, Vietnamese, Chinese (Simplified/Traditional)
Fixes missing UI text that would appear in English fallback
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues:
- Add new HistoryScanResults and HistoryRebuildOptions interfaces
- Refactor reindexHistoryItems into modular components:
- scanTaskHistory: Identifies valid, orphaned, and missing tasks
- rebuildIndexes: Rebuilds indexes with configurable options
- reconstructTask: Recovers orphaned tasks from UI messages
- Create new HistoryIndexTools UI component with:
- Task history scanning capabilities
- Configurable rebuild options (merge/replace modes)
- Task preview and inspection tools
- Real-time operation logging
- Improve error handling and provide detailed logging
- Update message handlers and type definitions
- Add comprehensive translations for the new UI
This change helps users diagnose and fix task history inconsistencies between global state and filesystem, preventing "lost" tasks and improving history reliability.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: prevent ReDoS vulnerability in log message regex
Replace non-greedy wildcard pattern (.*?) with a more specific character class [^\]]*
to avoid potential catastrophic backtracking on malicious input.
This addresses a security vulnerability where the regex could run slow on
strings starting with '[]' and containing many repetitions of '\t'.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: replace regex with string indexes in logMessage
Replace regex pattern with string index operations in logMessage function to
avoid potential ReDoS (Regular Expression Denial of Service) vulnerabilities.
The change uses indexOf and substring instead of regex matching, which is
more efficient and safer for processing log messages with tags.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: implement mutual exclusion for history operations
Created a mutex pattern to ensure history operations are mutually exclusive.
This prevents concurrent execution of reindexHistoryItems and search operations,
maintaining data consistency during indexing.
Extracted common mutex logic into a reusable _withMutex helper function.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
feat: add bidirectional sync with legacy globalState
Adds capability to synchronize tasks between the new file-based history system and legacy VSCode globalState storage:
- Renamed mergeGlobal to mergeFromGlobal for clarity
- Added new mergeToGlobal option to update globalState with file index data
- Added tracking of tasks that exist only in file indexes via tasksOnlyInTaskHistoryIndexes
- Added developer UI controls in advanced section for managing globalState sync
- Updated tests and documentation to reflect new bidirectional capabilities
This feature enables backward compatibility testing with older versions of Roo Code by ensuring tasks created in the new storage format are also available in the legacy format.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: make rebuildIndexes private by renaming to _rebuildIndexes
This change makes the rebuildIndexes function private by adding an underscore prefix
to its name, following the project's convention for private functions. All references
to this function have been updated accordingly in both the implementation and test files.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add translations for task history reindexing features across all supported languages:
- Add backend translations for history reindex success/failure messages
- Add frontend translations for the history index tools UI
- Update settings and common translation files for all locales
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Simplifies the task history recovery interface by moving all recovery and rebuild options into a single collapsed 'Advanced' section. This addresses feedback that the previous UI was too complex for users who just need to quickly restore tasks.
The main 'Rebuild' and 'Rescan' action buttons remain directly visible, while all configuration checkboxes and mode selections are now neatly tucked away, available on-demand, and default to sensible values for a simple 'fix it' experience.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

All configuration checkboxes and mode selections are now neatly tucked away, and default to sensible values for a simple 'fix it' experience:

image

@KJ7LNW
KJ7LNW marked this pull request as ready for review July 11, 2025 23:51
@KJ7LNWKJ7LNW moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code RoadmapJul 11, 2025
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@KJ7LNWKJ7LNW closed this Jul 12, 2025
@github-project-automationgithub-project-automationBot moved this from PR [Needs Prelim Review] to Done in Roo Code RoadmapJul 12, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

EnhancementNew feature or requestPR - Needs Preliminary Reviewsize:XXLThis PR changes 1000+ lines, ignoring generated files.UI/UXUI/UX related or focused

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

No way to recover tasks lost due to global state race conditions

3 participants

@KJ7LNW@daniel-lxs@hannesrudolph
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

feat: Implement task history scanner and recovery tools - #5546

Closed
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner
Closed

feat: Implement task history scanner and recovery tools#5546
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner

Conversation

@KJ7LNW

@KJ7LNWKJ7LNW commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

Note to Reviewer

This is a PR series, so the line numbers shown by Github are exaggerated. The commit series clearly marks where each PR begins using lines that say NOTICE: PR ____ STARTS HERE

The commits tell a clean story, it will be easier to understand what is happening here by looking at each commit individually under "Commits" than by looking at all of the files that were changed.

Dependencies

This pull request implements a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues.

Actual diff without tests or langs:

]$gitdiff-w--statgithub/refactor-use-files-for-history..github/refactor-use-files-for-history-scanner--':(exclude)**/__tests__/**'':(exclude)**/i18n/**'// new task scanner and rebuild implementationsrc/core/task-persistence/taskScanner.ts|594++++++++++++++++++++webview-ui/src/components/settings/HistoryIndexTools.tsx|770++++++++++++++++++++++++++// new message handlers for that purpose src/core/webview/webviewMessageHandler.ts|129+++++// minor plumbingpackages/types/src/history.ts|94++++src/core/webview/ClineProvider.ts|2+-src/shared/ExtensionMessage.ts|4+-src/shared/WebviewMessage.ts|9+-webview-ui/src/components/settings/SettingsView.tsx|6+8fileschanged,1605insertions(+),3deletions(-)

Context

This PR addresses issue #5545 by providing tools to recover tasks that were lost due to global state race conditions. While issue #5544 prevents future task loss, this PR focuses on recovering tasks that were already lost before that fix.

Implementation

  • Added a new task history scanner that can identify valid, orphaned, and missing tasks
  • Implemented a task reconstruction system that can recover lost tasks from UI message history
  • Created a mutex pattern to ensure history operations are mutually exclusive
  • Added bidirectional sync capabilities between file-based history and legacy globalState
  • Developed a comprehensive UI for managing and repairing task history

History Index Tools

image

Missing/Orphaned Task Preview

image

Orphaned Task Recovery

image

UI Index Scan Logs

image

UI Index Rebuild Logs

image

After Recovery

image

How to Test

  1. Open the Settings panel and navigate to the History section
  2. Use the "Scan Task History" button to identify any inconsistencies
  3. Review the scan results to see valid, orphaned, and missing tasks
  4. Use the repair options to reconstruct and reindex lost tasks

Fixes#5545

@KJ7LNW
KJ7LNW requested review from cte, jr and mrubens as code ownersJuly 10, 2025 02:32
@dosubotdosubotBot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request UI/UX UI/UX related or focused labels Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as draft July 10, 2025 02:33
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@hannesrudolphhannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as ready for review July 10, 2025 03:38
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@daniel-lxsdaniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code RoadmapJul 10, 2025
@hannesrudolphhannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 10, 2025
@hannesrudolphhannesrudolph moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code RoadmapJul 10, 2025
@daniel-lxs

Copy link
Copy Markdown
Member

Hey @KJ7LNW,Thanks for the work on this! Do you think we should consider simplifying the UI and options a bit? Maybe a single button to restore tasks under the "About Roo Code" section or somewhere similar that just restores tasks for the current workspace?

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

@daniel-lxsdaniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code RoadmapJul 10, 2025
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

I had the same thought about complexity for that interface, it can certainly be simpler. These options were mostly used for my testing, and end users probably just need a big "fix it" button.

What if I leave the check boxes to what they should default as, and just move them into the collapsed advanced section?

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@daniel-lxs I am moving this into draft, but the dependent pull requests can still be reviewed and merged before this one is ready.

Eric Wheeler added 20 commits July 11, 2025 15:06
…ions
- Added HistorySearchOptions interface to packages/types
- Updated WebviewMessage to use historySearchOptions field instead of individual fields
- Added historyItems message type to ExtensionMessage
- Implemented getHistoryItems handler in webviewMessageHandler
- Refactored getHistoryItemsForSearch to accept HistorySearchOptions parameter
- Completely replaced client-side filtering with server-side filtering
- Removed dependency on Fzf for client-side search
- Added loading state to history components with loading spinner
- Updated HistoryPreview to use limit parameter and respect loading state
- Updated tests to account for the new loading state
- Set explicit limits for history items in ChatView (10) and HistoryPreview (3)
This refactoring improves performance by moving filtering to the server side,
enhances type safety with the dedicated HistorySearchOptions type, reduces
duplication in the interface definitions, and improves the user experience
with loading indicators.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: improve history search sorting and filtering
- Created dedicated HistorySortOption type in shared types package
- Modified API to take year and month as direct parameters
- Added helper functions to reduce code duplication:
- _getTasksByWorkspace to extract tasks from month data
- _fastSortFilterTasks for efficient pre-filtering and sorting
- Ensured consistent sorting across all functions
- Optimized filtering to happen before file reads
- Added support for custom sort order in getAvailableHistoryMonths
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Move fuzzy search from frontend to backend using fzf library
- Create dedicated taskHistorySearch module with configurable parameters
- Add match position tracking for proper highlighting in UI
- Implement debounced search in frontend to prevent flickering
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: maintain sort order during search
When a search string is present, the sort order specified by the user wasn't
being respected. This change ensures that:
- Non-relevance sorts (newest, oldest, etc.) maintain their order when searching
- The 'mostRelevant' sort option continues to use fuzzy search order
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implemented automatic refresh of the task history list when tasks are deleted:
- Added taskDeletedConfirmation message type to WebviewMessage and ExtensionMessage
- Modified webviewMessageHandler to send confirmation after task deletion
- Updated useTaskSearch hook to listen for deletion confirmation and refresh the list
- Implemented non-flickering refresh that maintains current search parameters
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Created SpinnerOverlay component to darken the view during deletion
- Added state to track deletion in progress in HistoryView
- Updated DeleteTaskDialog and BatchDeleteTaskDialog to trigger the overlay
- Added event listener to hide the overlay when deletion completes
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add request ID tracking to useTaskSearch hook to ensure each component
only processes responses to its own search requests. This prevents the
issue where multiple components using the hook would all receive updates
when a search response comes back, regardless of which component initiated
the search.
- Add global serial counter to generate unique request IDs
- Add component-isolated ref to track current request ID
- Modify message handler to only process matching responses
- Pass request ID back in webviewMessageHandler response
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed taskHistory field and all its references from the codebase as part
of migrating to file-based storage.
- Removed taskHistory from GlobalSettings schema
- Removed import of historyItemSchema
- Removed taskHistory from ExtensionState interface
- Cleared PASS_THROUGH_STATE_KEYS array in ContextProxy
- Updated ClineProvider to use file-based API instead of global state
- Updated UI components to work without taskHistory prop
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed redundant useTaskSearch call from ChatView since HistoryPreview
already makes its own call to fetch the tasks it needs to display.
This eliminates an unnecessary API call on application startup and
simplifies the component by removing conditional rendering based on task count.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Remove unnecessary loading and returning of entire task history array.
The return value was never used by any caller, so we can make this an O(1)
operation instead of O(n) by simply saving the single item.
This change significantly improves performance when updating task history,
which happens frequently during task execution.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Allows you to filter tasks not just by all and current, but also by any
historic workspace directory that exists in existing HistoryItem metadata
- Added persistent workspace index with metadata (path, name, missing status, timestamp)
- Created a rich workspace selector UI with filtering and grouping capabilities
- Added visual indicators for missing workspaces (strikethrough)
- Improved loading states and feedback during workspace changes and searches
- Added special workspace paths handling ("all", "current", "unknown")
- Standardized empty/undefined workspace paths to "unknown" for legacy items that do not have workspace stored in their metadata
- Optimized batch processing for better performance
This enhancement provides users with a more intuitive and powerful way to navigate their task history across multiple workspaces.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added a limit filter dropdown to the history view that allows users to control
how many results are displayed. The filter:
- Defaults to 50 items
- Offers options for 50, 100, 200, 500, 1000 items or all results
- Shows loading spinner when changing limits
- Integrates with existing workspace and sort filters
- Maintains consistent search options across operations
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This change modifies the copy button in task history to retrieve the task content from the backend storage using getHistoryItem before copying it to the clipboard. This ensures the most up-to-date content is copied.
Fixes: #3648
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a structured upgrade system that manages the task history migration process:
- Create a dedicated upgrade UI that blocks normal app usage until migration completes
- Separate migration check from migration execution for better control flow
- Add progress logging during migration to provide user feedback
- Remove automatic migration during extension activation
- Add new message types for upgrade status and completion
This change improves the user experience during task history migration by providing
visual feedback and ensuring the app is in a consistent state before allowing normal usage.
The upgrade system is designed to be extensible for future structural upgrades beyond
task history migration.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Add tests for cross-workspace functionality
- Verify items can be found in all workspaces where they existed
- Ensure workspace property reflects the latest workspace
- Add tests for helper functions and edge cases
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Removed pass-through state tests from ContextProxy that no longer apply
- Updated ClineProvider tests to use file-based history instead of global state
- Modified ChatTextArea tests to use useTaskSearch hook instead of taskHistory prop
- Completely rewrote useTaskSearch tests to use message-based architecture
- Updated other tests to remove taskHistory references from mock states
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
test: Fix ClineProvider test by mocking extension context and taskHistory
This commit fixes the failing test 'correctly identifies subtask scenario for issue #4602' by:
1. Adding necessary Vitest imports
2. Mocking getExtensionContext to return a mock context with globalStorageUri
3. Mocking taskHistory module to prevent file system operations during tests
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added missing translations across all 17 supported locales:
- upgrade.* keys in common.json for task history index upgrade UI
- workspace.unknown, workspace.available, workspace.recent, workspace.filterPlaceholder in history.json
- limit.* keys and noItemsFound in history.json for pagination controls
All translations now complete with proper localization for:
- Catalan, German, Spanish, French, Hindi, Indonesian, Italian
- Japanese, Korean, Dutch, Polish, Portuguese (Brazil)
- Russian, Turkish, Vietnamese, Chinese (Simplified/Traditional)
Fixes missing UI text that would appear in English fallback
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues:
- Add new HistoryScanResults and HistoryRebuildOptions interfaces
- Refactor reindexHistoryItems into modular components:
- scanTaskHistory: Identifies valid, orphaned, and missing tasks
- rebuildIndexes: Rebuilds indexes with configurable options
- reconstructTask: Recovers orphaned tasks from UI messages
- Create new HistoryIndexTools UI component with:
- Task history scanning capabilities
- Configurable rebuild options (merge/replace modes)
- Task preview and inspection tools
- Real-time operation logging
- Improve error handling and provide detailed logging
- Update message handlers and type definitions
- Add comprehensive translations for the new UI
This change helps users diagnose and fix task history inconsistencies between global state and filesystem, preventing "lost" tasks and improving history reliability.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: prevent ReDoS vulnerability in log message regex
Replace non-greedy wildcard pattern (.*?) with a more specific character class [^\]]*
to avoid potential catastrophic backtracking on malicious input.
This addresses a security vulnerability where the regex could run slow on
strings starting with '[]' and containing many repetitions of '\t'.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: replace regex with string indexes in logMessage
Replace regex pattern with string index operations in logMessage function to
avoid potential ReDoS (Regular Expression Denial of Service) vulnerabilities.
The change uses indexOf and substring instead of regex matching, which is
more efficient and safer for processing log messages with tags.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: implement mutual exclusion for history operations
Created a mutex pattern to ensure history operations are mutually exclusive.
This prevents concurrent execution of reindexHistoryItems and search operations,
maintaining data consistency during indexing.
Extracted common mutex logic into a reusable _withMutex helper function.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
feat: add bidirectional sync with legacy globalState
Adds capability to synchronize tasks between the new file-based history system and legacy VSCode globalState storage:
- Renamed mergeGlobal to mergeFromGlobal for clarity
- Added new mergeToGlobal option to update globalState with file index data
- Added tracking of tasks that exist only in file indexes via tasksOnlyInTaskHistoryIndexes
- Added developer UI controls in advanced section for managing globalState sync
- Updated tests and documentation to reflect new bidirectional capabilities
This feature enables backward compatibility testing with older versions of Roo Code by ensuring tasks created in the new storage format are also available in the legacy format.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: make rebuildIndexes private by renaming to _rebuildIndexes
This change makes the rebuildIndexes function private by adding an underscore prefix
to its name, following the project's convention for private functions. All references
to this function have been updated accordingly in both the implementation and test files.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add translations for task history reindexing features across all supported languages:
- Add backend translations for history reindex success/failure messages
- Add frontend translations for the history index tools UI
- Update settings and common translation files for all locales
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Simplifies the task history recovery interface by moving all recovery and rebuild options into a single collapsed 'Advanced' section. This addresses feedback that the previous UI was too complex for users who just need to quickly restore tasks.
The main 'Rebuild' and 'Rescan' action buttons remain directly visible, while all configuration checkboxes and mode selections are now neatly tucked away, available on-demand, and default to sensible values for a simple 'fix it' experience.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

All configuration checkboxes and mode selections are now neatly tucked away, and default to sensible values for a simple 'fix it' experience:

image

@KJ7LNW
KJ7LNW marked this pull request as ready for review July 11, 2025 23:51
@KJ7LNWKJ7LNW moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code RoadmapJul 11, 2025
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@KJ7LNWKJ7LNW closed this Jul 12, 2025
@github-project-automationgithub-project-automationBot moved this from PR [Needs Prelim Review] to Done in Roo Code RoadmapJul 12, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

EnhancementNew feature or requestPR - Needs Preliminary Reviewsize:XXLThis PR changes 1000+ lines, ignoring generated files.UI/UXUI/UX related or focused

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

No way to recover tasks lost due to global state race conditions

3 participants

@KJ7LNW@daniel-lxs@hannesrudolph
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

feat: Implement task history scanner and recovery tools - #5546

Closed
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner
Closed

feat: Implement task history scanner and recovery tools#5546
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner

Conversation

@KJ7LNW

@KJ7LNWKJ7LNW commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

Note to Reviewer

This is a PR series, so the line numbers shown by Github are exaggerated. The commit series clearly marks where each PR begins using lines that say NOTICE: PR ____ STARTS HERE

The commits tell a clean story, it will be easier to understand what is happening here by looking at each commit individually under "Commits" than by looking at all of the files that were changed.

Dependencies

This pull request implements a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues.

Actual diff without tests or langs:

]$gitdiff-w--statgithub/refactor-use-files-for-history..github/refactor-use-files-for-history-scanner--':(exclude)**/__tests__/**'':(exclude)**/i18n/**'// new task scanner and rebuild implementationsrc/core/task-persistence/taskScanner.ts|594++++++++++++++++++++webview-ui/src/components/settings/HistoryIndexTools.tsx|770++++++++++++++++++++++++++// new message handlers for that purpose src/core/webview/webviewMessageHandler.ts|129+++++// minor plumbingpackages/types/src/history.ts|94++++src/core/webview/ClineProvider.ts|2+-src/shared/ExtensionMessage.ts|4+-src/shared/WebviewMessage.ts|9+-webview-ui/src/components/settings/SettingsView.tsx|6+8fileschanged,1605insertions(+),3deletions(-)

Context

This PR addresses issue #5545 by providing tools to recover tasks that were lost due to global state race conditions. While issue #5544 prevents future task loss, this PR focuses on recovering tasks that were already lost before that fix.

Implementation

  • Added a new task history scanner that can identify valid, orphaned, and missing tasks
  • Implemented a task reconstruction system that can recover lost tasks from UI message history
  • Created a mutex pattern to ensure history operations are mutually exclusive
  • Added bidirectional sync capabilities between file-based history and legacy globalState
  • Developed a comprehensive UI for managing and repairing task history

History Index Tools

image

Missing/Orphaned Task Preview

image

Orphaned Task Recovery

image

UI Index Scan Logs

image

UI Index Rebuild Logs

image

After Recovery

image

How to Test

  1. Open the Settings panel and navigate to the History section
  2. Use the "Scan Task History" button to identify any inconsistencies
  3. Review the scan results to see valid, orphaned, and missing tasks
  4. Use the repair options to reconstruct and reindex lost tasks

Fixes#5545

@KJ7LNW
KJ7LNW requested review from cte, jr and mrubens as code ownersJuly 10, 2025 02:32
@dosubotdosubotBot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request UI/UX UI/UX related or focused labels Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as draft July 10, 2025 02:33
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@hannesrudolphhannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as ready for review July 10, 2025 03:38
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@daniel-lxsdaniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code RoadmapJul 10, 2025
@hannesrudolphhannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 10, 2025
@hannesrudolphhannesrudolph moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code RoadmapJul 10, 2025
@daniel-lxs

Copy link
Copy Markdown
Member

Hey @KJ7LNW,Thanks for the work on this! Do you think we should consider simplifying the UI and options a bit? Maybe a single button to restore tasks under the "About Roo Code" section or somewhere similar that just restores tasks for the current workspace?

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

@daniel-lxsdaniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code RoadmapJul 10, 2025
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

I had the same thought about complexity for that interface, it can certainly be simpler. These options were mostly used for my testing, and end users probably just need a big "fix it" button.

What if I leave the check boxes to what they should default as, and just move them into the collapsed advanced section?

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@daniel-lxs I am moving this into draft, but the dependent pull requests can still be reviewed and merged before this one is ready.

Eric Wheeler added 20 commits July 11, 2025 15:06
…ions
- Added HistorySearchOptions interface to packages/types
- Updated WebviewMessage to use historySearchOptions field instead of individual fields
- Added historyItems message type to ExtensionMessage
- Implemented getHistoryItems handler in webviewMessageHandler
- Refactored getHistoryItemsForSearch to accept HistorySearchOptions parameter
- Completely replaced client-side filtering with server-side filtering
- Removed dependency on Fzf for client-side search
- Added loading state to history components with loading spinner
- Updated HistoryPreview to use limit parameter and respect loading state
- Updated tests to account for the new loading state
- Set explicit limits for history items in ChatView (10) and HistoryPreview (3)
This refactoring improves performance by moving filtering to the server side,
enhances type safety with the dedicated HistorySearchOptions type, reduces
duplication in the interface definitions, and improves the user experience
with loading indicators.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: improve history search sorting and filtering
- Created dedicated HistorySortOption type in shared types package
- Modified API to take year and month as direct parameters
- Added helper functions to reduce code duplication:
- _getTasksByWorkspace to extract tasks from month data
- _fastSortFilterTasks for efficient pre-filtering and sorting
- Ensured consistent sorting across all functions
- Optimized filtering to happen before file reads
- Added support for custom sort order in getAvailableHistoryMonths
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Move fuzzy search from frontend to backend using fzf library
- Create dedicated taskHistorySearch module with configurable parameters
- Add match position tracking for proper highlighting in UI
- Implement debounced search in frontend to prevent flickering
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: maintain sort order during search
When a search string is present, the sort order specified by the user wasn't
being respected. This change ensures that:
- Non-relevance sorts (newest, oldest, etc.) maintain their order when searching
- The 'mostRelevant' sort option continues to use fuzzy search order
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implemented automatic refresh of the task history list when tasks are deleted:
- Added taskDeletedConfirmation message type to WebviewMessage and ExtensionMessage
- Modified webviewMessageHandler to send confirmation after task deletion
- Updated useTaskSearch hook to listen for deletion confirmation and refresh the list
- Implemented non-flickering refresh that maintains current search parameters
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Created SpinnerOverlay component to darken the view during deletion
- Added state to track deletion in progress in HistoryView
- Updated DeleteTaskDialog and BatchDeleteTaskDialog to trigger the overlay
- Added event listener to hide the overlay when deletion completes
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add request ID tracking to useTaskSearch hook to ensure each component
only processes responses to its own search requests. This prevents the
issue where multiple components using the hook would all receive updates
when a search response comes back, regardless of which component initiated
the search.
- Add global serial counter to generate unique request IDs
- Add component-isolated ref to track current request ID
- Modify message handler to only process matching responses
- Pass request ID back in webviewMessageHandler response
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed taskHistory field and all its references from the codebase as part
of migrating to file-based storage.
- Removed taskHistory from GlobalSettings schema
- Removed import of historyItemSchema
- Removed taskHistory from ExtensionState interface
- Cleared PASS_THROUGH_STATE_KEYS array in ContextProxy
- Updated ClineProvider to use file-based API instead of global state
- Updated UI components to work without taskHistory prop
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed redundant useTaskSearch call from ChatView since HistoryPreview
already makes its own call to fetch the tasks it needs to display.
This eliminates an unnecessary API call on application startup and
simplifies the component by removing conditional rendering based on task count.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Remove unnecessary loading and returning of entire task history array.
The return value was never used by any caller, so we can make this an O(1)
operation instead of O(n) by simply saving the single item.
This change significantly improves performance when updating task history,
which happens frequently during task execution.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Allows you to filter tasks not just by all and current, but also by any
historic workspace directory that exists in existing HistoryItem metadata
- Added persistent workspace index with metadata (path, name, missing status, timestamp)
- Created a rich workspace selector UI with filtering and grouping capabilities
- Added visual indicators for missing workspaces (strikethrough)
- Improved loading states and feedback during workspace changes and searches
- Added special workspace paths handling ("all", "current", "unknown")
- Standardized empty/undefined workspace paths to "unknown" for legacy items that do not have workspace stored in their metadata
- Optimized batch processing for better performance
This enhancement provides users with a more intuitive and powerful way to navigate their task history across multiple workspaces.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added a limit filter dropdown to the history view that allows users to control
how many results are displayed. The filter:
- Defaults to 50 items
- Offers options for 50, 100, 200, 500, 1000 items or all results
- Shows loading spinner when changing limits
- Integrates with existing workspace and sort filters
- Maintains consistent search options across operations
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This change modifies the copy button in task history to retrieve the task content from the backend storage using getHistoryItem before copying it to the clipboard. This ensures the most up-to-date content is copied.
Fixes: #3648
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a structured upgrade system that manages the task history migration process:
- Create a dedicated upgrade UI that blocks normal app usage until migration completes
- Separate migration check from migration execution for better control flow
- Add progress logging during migration to provide user feedback
- Remove automatic migration during extension activation
- Add new message types for upgrade status and completion
This change improves the user experience during task history migration by providing
visual feedback and ensuring the app is in a consistent state before allowing normal usage.
The upgrade system is designed to be extensible for future structural upgrades beyond
task history migration.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Add tests for cross-workspace functionality
- Verify items can be found in all workspaces where they existed
- Ensure workspace property reflects the latest workspace
- Add tests for helper functions and edge cases
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Removed pass-through state tests from ContextProxy that no longer apply
- Updated ClineProvider tests to use file-based history instead of global state
- Modified ChatTextArea tests to use useTaskSearch hook instead of taskHistory prop
- Completely rewrote useTaskSearch tests to use message-based architecture
- Updated other tests to remove taskHistory references from mock states
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
test: Fix ClineProvider test by mocking extension context and taskHistory
This commit fixes the failing test 'correctly identifies subtask scenario for issue #4602' by:
1. Adding necessary Vitest imports
2. Mocking getExtensionContext to return a mock context with globalStorageUri
3. Mocking taskHistory module to prevent file system operations during tests
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added missing translations across all 17 supported locales:
- upgrade.* keys in common.json for task history index upgrade UI
- workspace.unknown, workspace.available, workspace.recent, workspace.filterPlaceholder in history.json
- limit.* keys and noItemsFound in history.json for pagination controls
All translations now complete with proper localization for:
- Catalan, German, Spanish, French, Hindi, Indonesian, Italian
- Japanese, Korean, Dutch, Polish, Portuguese (Brazil)
- Russian, Turkish, Vietnamese, Chinese (Simplified/Traditional)
Fixes missing UI text that would appear in English fallback
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues:
- Add new HistoryScanResults and HistoryRebuildOptions interfaces
- Refactor reindexHistoryItems into modular components:
- scanTaskHistory: Identifies valid, orphaned, and missing tasks
- rebuildIndexes: Rebuilds indexes with configurable options
- reconstructTask: Recovers orphaned tasks from UI messages
- Create new HistoryIndexTools UI component with:
- Task history scanning capabilities
- Configurable rebuild options (merge/replace modes)
- Task preview and inspection tools
- Real-time operation logging
- Improve error handling and provide detailed logging
- Update message handlers and type definitions
- Add comprehensive translations for the new UI
This change helps users diagnose and fix task history inconsistencies between global state and filesystem, preventing "lost" tasks and improving history reliability.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: prevent ReDoS vulnerability in log message regex
Replace non-greedy wildcard pattern (.*?) with a more specific character class [^\]]*
to avoid potential catastrophic backtracking on malicious input.
This addresses a security vulnerability where the regex could run slow on
strings starting with '[]' and containing many repetitions of '\t'.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: replace regex with string indexes in logMessage
Replace regex pattern with string index operations in logMessage function to
avoid potential ReDoS (Regular Expression Denial of Service) vulnerabilities.
The change uses indexOf and substring instead of regex matching, which is
more efficient and safer for processing log messages with tags.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: implement mutual exclusion for history operations
Created a mutex pattern to ensure history operations are mutually exclusive.
This prevents concurrent execution of reindexHistoryItems and search operations,
maintaining data consistency during indexing.
Extracted common mutex logic into a reusable _withMutex helper function.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
feat: add bidirectional sync with legacy globalState
Adds capability to synchronize tasks between the new file-based history system and legacy VSCode globalState storage:
- Renamed mergeGlobal to mergeFromGlobal for clarity
- Added new mergeToGlobal option to update globalState with file index data
- Added tracking of tasks that exist only in file indexes via tasksOnlyInTaskHistoryIndexes
- Added developer UI controls in advanced section for managing globalState sync
- Updated tests and documentation to reflect new bidirectional capabilities
This feature enables backward compatibility testing with older versions of Roo Code by ensuring tasks created in the new storage format are also available in the legacy format.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: make rebuildIndexes private by renaming to _rebuildIndexes
This change makes the rebuildIndexes function private by adding an underscore prefix
to its name, following the project's convention for private functions. All references
to this function have been updated accordingly in both the implementation and test files.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add translations for task history reindexing features across all supported languages:
- Add backend translations for history reindex success/failure messages
- Add frontend translations for the history index tools UI
- Update settings and common translation files for all locales
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Simplifies the task history recovery interface by moving all recovery and rebuild options into a single collapsed 'Advanced' section. This addresses feedback that the previous UI was too complex for users who just need to quickly restore tasks.
The main 'Rebuild' and 'Rescan' action buttons remain directly visible, while all configuration checkboxes and mode selections are now neatly tucked away, available on-demand, and default to sensible values for a simple 'fix it' experience.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

All configuration checkboxes and mode selections are now neatly tucked away, and default to sensible values for a simple 'fix it' experience:

image

@KJ7LNW
KJ7LNW marked this pull request as ready for review July 11, 2025 23:51
@KJ7LNWKJ7LNW moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code RoadmapJul 11, 2025
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@KJ7LNWKJ7LNW closed this Jul 12, 2025
@github-project-automationgithub-project-automationBot moved this from PR [Needs Prelim Review] to Done in Roo Code RoadmapJul 12, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

EnhancementNew feature or requestPR - Needs Preliminary Reviewsize:XXLThis PR changes 1000+ lines, ignoring generated files.UI/UXUI/UX related or focused

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

No way to recover tasks lost due to global state race conditions

3 participants

@KJ7LNW@daniel-lxs@hannesrudolph
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

feat: Implement task history scanner and recovery tools - #5546

Closed
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner
Closed

feat: Implement task history scanner and recovery tools#5546
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner

Conversation

@KJ7LNW

@KJ7LNWKJ7LNW commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

Note to Reviewer

This is a PR series, so the line numbers shown by Github are exaggerated. The commit series clearly marks where each PR begins using lines that say NOTICE: PR ____ STARTS HERE

The commits tell a clean story, it will be easier to understand what is happening here by looking at each commit individually under "Commits" than by looking at all of the files that were changed.

Dependencies

This pull request implements a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues.

Actual diff without tests or langs:

]$gitdiff-w--statgithub/refactor-use-files-for-history..github/refactor-use-files-for-history-scanner--':(exclude)**/__tests__/**'':(exclude)**/i18n/**'// new task scanner and rebuild implementationsrc/core/task-persistence/taskScanner.ts|594++++++++++++++++++++webview-ui/src/components/settings/HistoryIndexTools.tsx|770++++++++++++++++++++++++++// new message handlers for that purpose src/core/webview/webviewMessageHandler.ts|129+++++// minor plumbingpackages/types/src/history.ts|94++++src/core/webview/ClineProvider.ts|2+-src/shared/ExtensionMessage.ts|4+-src/shared/WebviewMessage.ts|9+-webview-ui/src/components/settings/SettingsView.tsx|6+8fileschanged,1605insertions(+),3deletions(-)

Context

This PR addresses issue #5545 by providing tools to recover tasks that were lost due to global state race conditions. While issue #5544 prevents future task loss, this PR focuses on recovering tasks that were already lost before that fix.

Implementation

  • Added a new task history scanner that can identify valid, orphaned, and missing tasks
  • Implemented a task reconstruction system that can recover lost tasks from UI message history
  • Created a mutex pattern to ensure history operations are mutually exclusive
  • Added bidirectional sync capabilities between file-based history and legacy globalState
  • Developed a comprehensive UI for managing and repairing task history

History Index Tools

image

Missing/Orphaned Task Preview

image

Orphaned Task Recovery

image

UI Index Scan Logs

image

UI Index Rebuild Logs

image

After Recovery

image

How to Test

  1. Open the Settings panel and navigate to the History section
  2. Use the "Scan Task History" button to identify any inconsistencies
  3. Review the scan results to see valid, orphaned, and missing tasks
  4. Use the repair options to reconstruct and reindex lost tasks

Fixes#5545

@KJ7LNW
KJ7LNW requested review from cte, jr and mrubens as code ownersJuly 10, 2025 02:32
@dosubotdosubotBot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request UI/UX UI/UX related or focused labels Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as draft July 10, 2025 02:33
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@hannesrudolphhannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as ready for review July 10, 2025 03:38
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@daniel-lxsdaniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code RoadmapJul 10, 2025
@hannesrudolphhannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 10, 2025
@hannesrudolphhannesrudolph moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code RoadmapJul 10, 2025
@daniel-lxs

Copy link
Copy Markdown
Member

Hey @KJ7LNW,Thanks for the work on this! Do you think we should consider simplifying the UI and options a bit? Maybe a single button to restore tasks under the "About Roo Code" section or somewhere similar that just restores tasks for the current workspace?

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

@daniel-lxsdaniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code RoadmapJul 10, 2025
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

I had the same thought about complexity for that interface, it can certainly be simpler. These options were mostly used for my testing, and end users probably just need a big "fix it" button.

What if I leave the check boxes to what they should default as, and just move them into the collapsed advanced section?

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@daniel-lxs I am moving this into draft, but the dependent pull requests can still be reviewed and merged before this one is ready.

Eric Wheeler added 20 commits July 11, 2025 15:06
…ions
- Added HistorySearchOptions interface to packages/types
- Updated WebviewMessage to use historySearchOptions field instead of individual fields
- Added historyItems message type to ExtensionMessage
- Implemented getHistoryItems handler in webviewMessageHandler
- Refactored getHistoryItemsForSearch to accept HistorySearchOptions parameter
- Completely replaced client-side filtering with server-side filtering
- Removed dependency on Fzf for client-side search
- Added loading state to history components with loading spinner
- Updated HistoryPreview to use limit parameter and respect loading state
- Updated tests to account for the new loading state
- Set explicit limits for history items in ChatView (10) and HistoryPreview (3)
This refactoring improves performance by moving filtering to the server side,
enhances type safety with the dedicated HistorySearchOptions type, reduces
duplication in the interface definitions, and improves the user experience
with loading indicators.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: improve history search sorting and filtering
- Created dedicated HistorySortOption type in shared types package
- Modified API to take year and month as direct parameters
- Added helper functions to reduce code duplication:
- _getTasksByWorkspace to extract tasks from month data
- _fastSortFilterTasks for efficient pre-filtering and sorting
- Ensured consistent sorting across all functions
- Optimized filtering to happen before file reads
- Added support for custom sort order in getAvailableHistoryMonths
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Move fuzzy search from frontend to backend using fzf library
- Create dedicated taskHistorySearch module with configurable parameters
- Add match position tracking for proper highlighting in UI
- Implement debounced search in frontend to prevent flickering
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: maintain sort order during search
When a search string is present, the sort order specified by the user wasn't
being respected. This change ensures that:
- Non-relevance sorts (newest, oldest, etc.) maintain their order when searching
- The 'mostRelevant' sort option continues to use fuzzy search order
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implemented automatic refresh of the task history list when tasks are deleted:
- Added taskDeletedConfirmation message type to WebviewMessage and ExtensionMessage
- Modified webviewMessageHandler to send confirmation after task deletion
- Updated useTaskSearch hook to listen for deletion confirmation and refresh the list
- Implemented non-flickering refresh that maintains current search parameters
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Created SpinnerOverlay component to darken the view during deletion
- Added state to track deletion in progress in HistoryView
- Updated DeleteTaskDialog and BatchDeleteTaskDialog to trigger the overlay
- Added event listener to hide the overlay when deletion completes
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add request ID tracking to useTaskSearch hook to ensure each component
only processes responses to its own search requests. This prevents the
issue where multiple components using the hook would all receive updates
when a search response comes back, regardless of which component initiated
the search.
- Add global serial counter to generate unique request IDs
- Add component-isolated ref to track current request ID
- Modify message handler to only process matching responses
- Pass request ID back in webviewMessageHandler response
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed taskHistory field and all its references from the codebase as part
of migrating to file-based storage.
- Removed taskHistory from GlobalSettings schema
- Removed import of historyItemSchema
- Removed taskHistory from ExtensionState interface
- Cleared PASS_THROUGH_STATE_KEYS array in ContextProxy
- Updated ClineProvider to use file-based API instead of global state
- Updated UI components to work without taskHistory prop
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed redundant useTaskSearch call from ChatView since HistoryPreview
already makes its own call to fetch the tasks it needs to display.
This eliminates an unnecessary API call on application startup and
simplifies the component by removing conditional rendering based on task count.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Remove unnecessary loading and returning of entire task history array.
The return value was never used by any caller, so we can make this an O(1)
operation instead of O(n) by simply saving the single item.
This change significantly improves performance when updating task history,
which happens frequently during task execution.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Allows you to filter tasks not just by all and current, but also by any
historic workspace directory that exists in existing HistoryItem metadata
- Added persistent workspace index with metadata (path, name, missing status, timestamp)
- Created a rich workspace selector UI with filtering and grouping capabilities
- Added visual indicators for missing workspaces (strikethrough)
- Improved loading states and feedback during workspace changes and searches
- Added special workspace paths handling ("all", "current", "unknown")
- Standardized empty/undefined workspace paths to "unknown" for legacy items that do not have workspace stored in their metadata
- Optimized batch processing for better performance
This enhancement provides users with a more intuitive and powerful way to navigate their task history across multiple workspaces.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added a limit filter dropdown to the history view that allows users to control
how many results are displayed. The filter:
- Defaults to 50 items
- Offers options for 50, 100, 200, 500, 1000 items or all results
- Shows loading spinner when changing limits
- Integrates with existing workspace and sort filters
- Maintains consistent search options across operations
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This change modifies the copy button in task history to retrieve the task content from the backend storage using getHistoryItem before copying it to the clipboard. This ensures the most up-to-date content is copied.
Fixes: #3648
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a structured upgrade system that manages the task history migration process:
- Create a dedicated upgrade UI that blocks normal app usage until migration completes
- Separate migration check from migration execution for better control flow
- Add progress logging during migration to provide user feedback
- Remove automatic migration during extension activation
- Add new message types for upgrade status and completion
This change improves the user experience during task history migration by providing
visual feedback and ensuring the app is in a consistent state before allowing normal usage.
The upgrade system is designed to be extensible for future structural upgrades beyond
task history migration.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Add tests for cross-workspace functionality
- Verify items can be found in all workspaces where they existed
- Ensure workspace property reflects the latest workspace
- Add tests for helper functions and edge cases
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Removed pass-through state tests from ContextProxy that no longer apply
- Updated ClineProvider tests to use file-based history instead of global state
- Modified ChatTextArea tests to use useTaskSearch hook instead of taskHistory prop
- Completely rewrote useTaskSearch tests to use message-based architecture
- Updated other tests to remove taskHistory references from mock states
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
test: Fix ClineProvider test by mocking extension context and taskHistory
This commit fixes the failing test 'correctly identifies subtask scenario for issue #4602' by:
1. Adding necessary Vitest imports
2. Mocking getExtensionContext to return a mock context with globalStorageUri
3. Mocking taskHistory module to prevent file system operations during tests
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added missing translations across all 17 supported locales:
- upgrade.* keys in common.json for task history index upgrade UI
- workspace.unknown, workspace.available, workspace.recent, workspace.filterPlaceholder in history.json
- limit.* keys and noItemsFound in history.json for pagination controls
All translations now complete with proper localization for:
- Catalan, German, Spanish, French, Hindi, Indonesian, Italian
- Japanese, Korean, Dutch, Polish, Portuguese (Brazil)
- Russian, Turkish, Vietnamese, Chinese (Simplified/Traditional)
Fixes missing UI text that would appear in English fallback
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues:
- Add new HistoryScanResults and HistoryRebuildOptions interfaces
- Refactor reindexHistoryItems into modular components:
- scanTaskHistory: Identifies valid, orphaned, and missing tasks
- rebuildIndexes: Rebuilds indexes with configurable options
- reconstructTask: Recovers orphaned tasks from UI messages
- Create new HistoryIndexTools UI component with:
- Task history scanning capabilities
- Configurable rebuild options (merge/replace modes)
- Task preview and inspection tools
- Real-time operation logging
- Improve error handling and provide detailed logging
- Update message handlers and type definitions
- Add comprehensive translations for the new UI
This change helps users diagnose and fix task history inconsistencies between global state and filesystem, preventing "lost" tasks and improving history reliability.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: prevent ReDoS vulnerability in log message regex
Replace non-greedy wildcard pattern (.*?) with a more specific character class [^\]]*
to avoid potential catastrophic backtracking on malicious input.
This addresses a security vulnerability where the regex could run slow on
strings starting with '[]' and containing many repetitions of '\t'.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: replace regex with string indexes in logMessage
Replace regex pattern with string index operations in logMessage function to
avoid potential ReDoS (Regular Expression Denial of Service) vulnerabilities.
The change uses indexOf and substring instead of regex matching, which is
more efficient and safer for processing log messages with tags.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: implement mutual exclusion for history operations
Created a mutex pattern to ensure history operations are mutually exclusive.
This prevents concurrent execution of reindexHistoryItems and search operations,
maintaining data consistency during indexing.
Extracted common mutex logic into a reusable _withMutex helper function.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
feat: add bidirectional sync with legacy globalState
Adds capability to synchronize tasks between the new file-based history system and legacy VSCode globalState storage:
- Renamed mergeGlobal to mergeFromGlobal for clarity
- Added new mergeToGlobal option to update globalState with file index data
- Added tracking of tasks that exist only in file indexes via tasksOnlyInTaskHistoryIndexes
- Added developer UI controls in advanced section for managing globalState sync
- Updated tests and documentation to reflect new bidirectional capabilities
This feature enables backward compatibility testing with older versions of Roo Code by ensuring tasks created in the new storage format are also available in the legacy format.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: make rebuildIndexes private by renaming to _rebuildIndexes
This change makes the rebuildIndexes function private by adding an underscore prefix
to its name, following the project's convention for private functions. All references
to this function have been updated accordingly in both the implementation and test files.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add translations for task history reindexing features across all supported languages:
- Add backend translations for history reindex success/failure messages
- Add frontend translations for the history index tools UI
- Update settings and common translation files for all locales
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Simplifies the task history recovery interface by moving all recovery and rebuild options into a single collapsed 'Advanced' section. This addresses feedback that the previous UI was too complex for users who just need to quickly restore tasks.
The main 'Rebuild' and 'Rescan' action buttons remain directly visible, while all configuration checkboxes and mode selections are now neatly tucked away, available on-demand, and default to sensible values for a simple 'fix it' experience.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

All configuration checkboxes and mode selections are now neatly tucked away, and default to sensible values for a simple 'fix it' experience:

image

@KJ7LNW
KJ7LNW marked this pull request as ready for review July 11, 2025 23:51
@KJ7LNWKJ7LNW moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code RoadmapJul 11, 2025
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@KJ7LNWKJ7LNW closed this Jul 12, 2025
@github-project-automationgithub-project-automationBot moved this from PR [Needs Prelim Review] to Done in Roo Code RoadmapJul 12, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

EnhancementNew feature or requestPR - Needs Preliminary Reviewsize:XXLThis PR changes 1000+ lines, ignoring generated files.UI/UXUI/UX related or focused

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

No way to recover tasks lost due to global state race conditions

3 participants

@KJ7LNW@daniel-lxs@hannesrudolph
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

feat: Implement task history scanner and recovery tools - #5546

Closed
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner
Closed

feat: Implement task history scanner and recovery tools#5546
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner

Conversation

@KJ7LNW

@KJ7LNWKJ7LNW commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

Note to Reviewer

This is a PR series, so the line numbers shown by Github are exaggerated. The commit series clearly marks where each PR begins using lines that say NOTICE: PR ____ STARTS HERE

The commits tell a clean story, it will be easier to understand what is happening here by looking at each commit individually under "Commits" than by looking at all of the files that were changed.

Dependencies

This pull request implements a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues.

Actual diff without tests or langs:

]$gitdiff-w--statgithub/refactor-use-files-for-history..github/refactor-use-files-for-history-scanner--':(exclude)**/__tests__/**'':(exclude)**/i18n/**'// new task scanner and rebuild implementationsrc/core/task-persistence/taskScanner.ts|594++++++++++++++++++++webview-ui/src/components/settings/HistoryIndexTools.tsx|770++++++++++++++++++++++++++// new message handlers for that purpose src/core/webview/webviewMessageHandler.ts|129+++++// minor plumbingpackages/types/src/history.ts|94++++src/core/webview/ClineProvider.ts|2+-src/shared/ExtensionMessage.ts|4+-src/shared/WebviewMessage.ts|9+-webview-ui/src/components/settings/SettingsView.tsx|6+8fileschanged,1605insertions(+),3deletions(-)

Context

This PR addresses issue #5545 by providing tools to recover tasks that were lost due to global state race conditions. While issue #5544 prevents future task loss, this PR focuses on recovering tasks that were already lost before that fix.

Implementation

  • Added a new task history scanner that can identify valid, orphaned, and missing tasks
  • Implemented a task reconstruction system that can recover lost tasks from UI message history
  • Created a mutex pattern to ensure history operations are mutually exclusive
  • Added bidirectional sync capabilities between file-based history and legacy globalState
  • Developed a comprehensive UI for managing and repairing task history

History Index Tools

image

Missing/Orphaned Task Preview

image

Orphaned Task Recovery

image

UI Index Scan Logs

image

UI Index Rebuild Logs

image

After Recovery

image

How to Test

  1. Open the Settings panel and navigate to the History section
  2. Use the "Scan Task History" button to identify any inconsistencies
  3. Review the scan results to see valid, orphaned, and missing tasks
  4. Use the repair options to reconstruct and reindex lost tasks

Fixes#5545

@KJ7LNW
KJ7LNW requested review from cte, jr and mrubens as code ownersJuly 10, 2025 02:32
@dosubotdosubotBot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request UI/UX UI/UX related or focused labels Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as draft July 10, 2025 02:33
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@hannesrudolphhannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as ready for review July 10, 2025 03:38
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@daniel-lxsdaniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code RoadmapJul 10, 2025
@hannesrudolphhannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 10, 2025
@hannesrudolphhannesrudolph moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code RoadmapJul 10, 2025
@daniel-lxs

Copy link
Copy Markdown
Member

Hey @KJ7LNW,Thanks for the work on this! Do you think we should consider simplifying the UI and options a bit? Maybe a single button to restore tasks under the "About Roo Code" section or somewhere similar that just restores tasks for the current workspace?

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

@daniel-lxsdaniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code RoadmapJul 10, 2025
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

I had the same thought about complexity for that interface, it can certainly be simpler. These options were mostly used for my testing, and end users probably just need a big "fix it" button.

What if I leave the check boxes to what they should default as, and just move them into the collapsed advanced section?

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@daniel-lxs I am moving this into draft, but the dependent pull requests can still be reviewed and merged before this one is ready.

Eric Wheeler added 20 commits July 11, 2025 15:06
…ions
- Added HistorySearchOptions interface to packages/types
- Updated WebviewMessage to use historySearchOptions field instead of individual fields
- Added historyItems message type to ExtensionMessage
- Implemented getHistoryItems handler in webviewMessageHandler
- Refactored getHistoryItemsForSearch to accept HistorySearchOptions parameter
- Completely replaced client-side filtering with server-side filtering
- Removed dependency on Fzf for client-side search
- Added loading state to history components with loading spinner
- Updated HistoryPreview to use limit parameter and respect loading state
- Updated tests to account for the new loading state
- Set explicit limits for history items in ChatView (10) and HistoryPreview (3)
This refactoring improves performance by moving filtering to the server side,
enhances type safety with the dedicated HistorySearchOptions type, reduces
duplication in the interface definitions, and improves the user experience
with loading indicators.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: improve history search sorting and filtering
- Created dedicated HistorySortOption type in shared types package
- Modified API to take year and month as direct parameters
- Added helper functions to reduce code duplication:
- _getTasksByWorkspace to extract tasks from month data
- _fastSortFilterTasks for efficient pre-filtering and sorting
- Ensured consistent sorting across all functions
- Optimized filtering to happen before file reads
- Added support for custom sort order in getAvailableHistoryMonths
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Move fuzzy search from frontend to backend using fzf library
- Create dedicated taskHistorySearch module with configurable parameters
- Add match position tracking for proper highlighting in UI
- Implement debounced search in frontend to prevent flickering
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: maintain sort order during search
When a search string is present, the sort order specified by the user wasn't
being respected. This change ensures that:
- Non-relevance sorts (newest, oldest, etc.) maintain their order when searching
- The 'mostRelevant' sort option continues to use fuzzy search order
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implemented automatic refresh of the task history list when tasks are deleted:
- Added taskDeletedConfirmation message type to WebviewMessage and ExtensionMessage
- Modified webviewMessageHandler to send confirmation after task deletion
- Updated useTaskSearch hook to listen for deletion confirmation and refresh the list
- Implemented non-flickering refresh that maintains current search parameters
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Created SpinnerOverlay component to darken the view during deletion
- Added state to track deletion in progress in HistoryView
- Updated DeleteTaskDialog and BatchDeleteTaskDialog to trigger the overlay
- Added event listener to hide the overlay when deletion completes
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add request ID tracking to useTaskSearch hook to ensure each component
only processes responses to its own search requests. This prevents the
issue where multiple components using the hook would all receive updates
when a search response comes back, regardless of which component initiated
the search.
- Add global serial counter to generate unique request IDs
- Add component-isolated ref to track current request ID
- Modify message handler to only process matching responses
- Pass request ID back in webviewMessageHandler response
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed taskHistory field and all its references from the codebase as part
of migrating to file-based storage.
- Removed taskHistory from GlobalSettings schema
- Removed import of historyItemSchema
- Removed taskHistory from ExtensionState interface
- Cleared PASS_THROUGH_STATE_KEYS array in ContextProxy
- Updated ClineProvider to use file-based API instead of global state
- Updated UI components to work without taskHistory prop
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed redundant useTaskSearch call from ChatView since HistoryPreview
already makes its own call to fetch the tasks it needs to display.
This eliminates an unnecessary API call on application startup and
simplifies the component by removing conditional rendering based on task count.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Remove unnecessary loading and returning of entire task history array.
The return value was never used by any caller, so we can make this an O(1)
operation instead of O(n) by simply saving the single item.
This change significantly improves performance when updating task history,
which happens frequently during task execution.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Allows you to filter tasks not just by all and current, but also by any
historic workspace directory that exists in existing HistoryItem metadata
- Added persistent workspace index with metadata (path, name, missing status, timestamp)
- Created a rich workspace selector UI with filtering and grouping capabilities
- Added visual indicators for missing workspaces (strikethrough)
- Improved loading states and feedback during workspace changes and searches
- Added special workspace paths handling ("all", "current", "unknown")
- Standardized empty/undefined workspace paths to "unknown" for legacy items that do not have workspace stored in their metadata
- Optimized batch processing for better performance
This enhancement provides users with a more intuitive and powerful way to navigate their task history across multiple workspaces.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added a limit filter dropdown to the history view that allows users to control
how many results are displayed. The filter:
- Defaults to 50 items
- Offers options for 50, 100, 200, 500, 1000 items or all results
- Shows loading spinner when changing limits
- Integrates with existing workspace and sort filters
- Maintains consistent search options across operations
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This change modifies the copy button in task history to retrieve the task content from the backend storage using getHistoryItem before copying it to the clipboard. This ensures the most up-to-date content is copied.
Fixes: #3648
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a structured upgrade system that manages the task history migration process:
- Create a dedicated upgrade UI that blocks normal app usage until migration completes
- Separate migration check from migration execution for better control flow
- Add progress logging during migration to provide user feedback
- Remove automatic migration during extension activation
- Add new message types for upgrade status and completion
This change improves the user experience during task history migration by providing
visual feedback and ensuring the app is in a consistent state before allowing normal usage.
The upgrade system is designed to be extensible for future structural upgrades beyond
task history migration.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Add tests for cross-workspace functionality
- Verify items can be found in all workspaces where they existed
- Ensure workspace property reflects the latest workspace
- Add tests for helper functions and edge cases
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Removed pass-through state tests from ContextProxy that no longer apply
- Updated ClineProvider tests to use file-based history instead of global state
- Modified ChatTextArea tests to use useTaskSearch hook instead of taskHistory prop
- Completely rewrote useTaskSearch tests to use message-based architecture
- Updated other tests to remove taskHistory references from mock states
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
test: Fix ClineProvider test by mocking extension context and taskHistory
This commit fixes the failing test 'correctly identifies subtask scenario for issue #4602' by:
1. Adding necessary Vitest imports
2. Mocking getExtensionContext to return a mock context with globalStorageUri
3. Mocking taskHistory module to prevent file system operations during tests
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added missing translations across all 17 supported locales:
- upgrade.* keys in common.json for task history index upgrade UI
- workspace.unknown, workspace.available, workspace.recent, workspace.filterPlaceholder in history.json
- limit.* keys and noItemsFound in history.json for pagination controls
All translations now complete with proper localization for:
- Catalan, German, Spanish, French, Hindi, Indonesian, Italian
- Japanese, Korean, Dutch, Polish, Portuguese (Brazil)
- Russian, Turkish, Vietnamese, Chinese (Simplified/Traditional)
Fixes missing UI text that would appear in English fallback
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues:
- Add new HistoryScanResults and HistoryRebuildOptions interfaces
- Refactor reindexHistoryItems into modular components:
- scanTaskHistory: Identifies valid, orphaned, and missing tasks
- rebuildIndexes: Rebuilds indexes with configurable options
- reconstructTask: Recovers orphaned tasks from UI messages
- Create new HistoryIndexTools UI component with:
- Task history scanning capabilities
- Configurable rebuild options (merge/replace modes)
- Task preview and inspection tools
- Real-time operation logging
- Improve error handling and provide detailed logging
- Update message handlers and type definitions
- Add comprehensive translations for the new UI
This change helps users diagnose and fix task history inconsistencies between global state and filesystem, preventing "lost" tasks and improving history reliability.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: prevent ReDoS vulnerability in log message regex
Replace non-greedy wildcard pattern (.*?) with a more specific character class [^\]]*
to avoid potential catastrophic backtracking on malicious input.
This addresses a security vulnerability where the regex could run slow on
strings starting with '[]' and containing many repetitions of '\t'.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: replace regex with string indexes in logMessage
Replace regex pattern with string index operations in logMessage function to
avoid potential ReDoS (Regular Expression Denial of Service) vulnerabilities.
The change uses indexOf and substring instead of regex matching, which is
more efficient and safer for processing log messages with tags.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: implement mutual exclusion for history operations
Created a mutex pattern to ensure history operations are mutually exclusive.
This prevents concurrent execution of reindexHistoryItems and search operations,
maintaining data consistency during indexing.
Extracted common mutex logic into a reusable _withMutex helper function.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
feat: add bidirectional sync with legacy globalState
Adds capability to synchronize tasks between the new file-based history system and legacy VSCode globalState storage:
- Renamed mergeGlobal to mergeFromGlobal for clarity
- Added new mergeToGlobal option to update globalState with file index data
- Added tracking of tasks that exist only in file indexes via tasksOnlyInTaskHistoryIndexes
- Added developer UI controls in advanced section for managing globalState sync
- Updated tests and documentation to reflect new bidirectional capabilities
This feature enables backward compatibility testing with older versions of Roo Code by ensuring tasks created in the new storage format are also available in the legacy format.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: make rebuildIndexes private by renaming to _rebuildIndexes
This change makes the rebuildIndexes function private by adding an underscore prefix
to its name, following the project's convention for private functions. All references
to this function have been updated accordingly in both the implementation and test files.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add translations for task history reindexing features across all supported languages:
- Add backend translations for history reindex success/failure messages
- Add frontend translations for the history index tools UI
- Update settings and common translation files for all locales
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Simplifies the task history recovery interface by moving all recovery and rebuild options into a single collapsed 'Advanced' section. This addresses feedback that the previous UI was too complex for users who just need to quickly restore tasks.
The main 'Rebuild' and 'Rescan' action buttons remain directly visible, while all configuration checkboxes and mode selections are now neatly tucked away, available on-demand, and default to sensible values for a simple 'fix it' experience.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

All configuration checkboxes and mode selections are now neatly tucked away, and default to sensible values for a simple 'fix it' experience:

image

@KJ7LNW
KJ7LNW marked this pull request as ready for review July 11, 2025 23:51
@KJ7LNWKJ7LNW moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code RoadmapJul 11, 2025
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@KJ7LNWKJ7LNW closed this Jul 12, 2025
@github-project-automationgithub-project-automationBot moved this from PR [Needs Prelim Review] to Done in Roo Code RoadmapJul 12, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

EnhancementNew feature or requestPR - Needs Preliminary Reviewsize:XXLThis PR changes 1000+ lines, ignoring generated files.UI/UXUI/UX related or focused

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

No way to recover tasks lost due to global state race conditions

3 participants

@KJ7LNW@daniel-lxs@hannesrudolph
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

feat: Implement task history scanner and recovery tools - #5546

Closed
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner
Closed

feat: Implement task history scanner and recovery tools#5546
KJ7LNW wants to merge 41 commits into
RooCodeInc:mainfrom
KJ7LNW:refactor-use-files-for-history-scanner

Conversation

@KJ7LNW

@KJ7LNWKJ7LNW commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

Note to Reviewer

This is a PR series, so the line numbers shown by Github are exaggerated. The commit series clearly marks where each PR begins using lines that say NOTICE: PR ____ STARTS HERE

The commits tell a clean story, it will be easier to understand what is happening here by looking at each commit individually under "Commits" than by looking at all of the files that were changed.

Dependencies

This pull request implements a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues.

Actual diff without tests or langs:

]$gitdiff-w--statgithub/refactor-use-files-for-history..github/refactor-use-files-for-history-scanner--':(exclude)**/__tests__/**'':(exclude)**/i18n/**'// new task scanner and rebuild implementationsrc/core/task-persistence/taskScanner.ts|594++++++++++++++++++++webview-ui/src/components/settings/HistoryIndexTools.tsx|770++++++++++++++++++++++++++// new message handlers for that purpose src/core/webview/webviewMessageHandler.ts|129+++++// minor plumbingpackages/types/src/history.ts|94++++src/core/webview/ClineProvider.ts|2+-src/shared/ExtensionMessage.ts|4+-src/shared/WebviewMessage.ts|9+-webview-ui/src/components/settings/SettingsView.tsx|6+8fileschanged,1605insertions(+),3deletions(-)

Context

This PR addresses issue #5545 by providing tools to recover tasks that were lost due to global state race conditions. While issue #5544 prevents future task loss, this PR focuses on recovering tasks that were already lost before that fix.

Implementation

  • Added a new task history scanner that can identify valid, orphaned, and missing tasks
  • Implemented a task reconstruction system that can recover lost tasks from UI message history
  • Created a mutex pattern to ensure history operations are mutually exclusive
  • Added bidirectional sync capabilities between file-based history and legacy globalState
  • Developed a comprehensive UI for managing and repairing task history

History Index Tools

image

Missing/Orphaned Task Preview

image

Orphaned Task Recovery

image

UI Index Scan Logs

image

UI Index Rebuild Logs

image

After Recovery

image

How to Test

  1. Open the Settings panel and navigate to the History section
  2. Use the "Scan Task History" button to identify any inconsistencies
  3. Review the scan results to see valid, orphaned, and missing tasks
  4. Use the repair options to reconstruct and reindex lost tasks

Fixes#5545

@KJ7LNW
KJ7LNW requested review from cte, jr and mrubens as code ownersJuly 10, 2025 02:32
@dosubotdosubotBot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request UI/UX UI/UX related or focused labels Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as draft July 10, 2025 02:33
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@hannesrudolphhannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 10, 2025
@KJ7LNW
KJ7LNW marked this pull request as ready for review July 10, 2025 03:38
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@daniel-lxsdaniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code RoadmapJul 10, 2025
@hannesrudolphhannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 10, 2025
@hannesrudolphhannesrudolph moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code RoadmapJul 10, 2025
@daniel-lxs

Copy link
Copy Markdown
Member

Hey @KJ7LNW,Thanks for the work on this! Do you think we should consider simplifying the UI and options a bit? Maybe a single button to restore tasks under the "About Roo Code" section or somewhere similar that just restores tasks for the current workspace?

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

@daniel-lxsdaniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code RoadmapJul 10, 2025
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

I’m a bit concerned that the current options might be too complex for users who are just trying to recover lost tasks quickly. Let me know what you think.

I had the same thought about complexity for that interface, it can certainly be simpler. These options were mostly used for my testing, and end users probably just need a big "fix it" button.

What if I leave the check boxes to what they should default as, and just move them into the collapsed advanced section?

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@daniel-lxs I am moving this into draft, but the dependent pull requests can still be reviewed and merged before this one is ready.

Eric Wheeler added 20 commits July 11, 2025 15:06
…ions
- Added HistorySearchOptions interface to packages/types
- Updated WebviewMessage to use historySearchOptions field instead of individual fields
- Added historyItems message type to ExtensionMessage
- Implemented getHistoryItems handler in webviewMessageHandler
- Refactored getHistoryItemsForSearch to accept HistorySearchOptions parameter
- Completely replaced client-side filtering with server-side filtering
- Removed dependency on Fzf for client-side search
- Added loading state to history components with loading spinner
- Updated HistoryPreview to use limit parameter and respect loading state
- Updated tests to account for the new loading state
- Set explicit limits for history items in ChatView (10) and HistoryPreview (3)
This refactoring improves performance by moving filtering to the server side,
enhances type safety with the dedicated HistorySearchOptions type, reduces
duplication in the interface definitions, and improves the user experience
with loading indicators.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: improve history search sorting and filtering
- Created dedicated HistorySortOption type in shared types package
- Modified API to take year and month as direct parameters
- Added helper functions to reduce code duplication:
- _getTasksByWorkspace to extract tasks from month data
- _fastSortFilterTasks for efficient pre-filtering and sorting
- Ensured consistent sorting across all functions
- Optimized filtering to happen before file reads
- Added support for custom sort order in getAvailableHistoryMonths
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Move fuzzy search from frontend to backend using fzf library
- Create dedicated taskHistorySearch module with configurable parameters
- Add match position tracking for proper highlighting in UI
- Implement debounced search in frontend to prevent flickering
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: maintain sort order during search
When a search string is present, the sort order specified by the user wasn't
being respected. This change ensures that:
- Non-relevance sorts (newest, oldest, etc.) maintain their order when searching
- The 'mostRelevant' sort option continues to use fuzzy search order
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implemented automatic refresh of the task history list when tasks are deleted:
- Added taskDeletedConfirmation message type to WebviewMessage and ExtensionMessage
- Modified webviewMessageHandler to send confirmation after task deletion
- Updated useTaskSearch hook to listen for deletion confirmation and refresh the list
- Implemented non-flickering refresh that maintains current search parameters
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Created SpinnerOverlay component to darken the view during deletion
- Added state to track deletion in progress in HistoryView
- Updated DeleteTaskDialog and BatchDeleteTaskDialog to trigger the overlay
- Added event listener to hide the overlay when deletion completes
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add request ID tracking to useTaskSearch hook to ensure each component
only processes responses to its own search requests. This prevents the
issue where multiple components using the hook would all receive updates
when a search response comes back, regardless of which component initiated
the search.
- Add global serial counter to generate unique request IDs
- Add component-isolated ref to track current request ID
- Modify message handler to only process matching responses
- Pass request ID back in webviewMessageHandler response
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed taskHistory field and all its references from the codebase as part
of migrating to file-based storage.
- Removed taskHistory from GlobalSettings schema
- Removed import of historyItemSchema
- Removed taskHistory from ExtensionState interface
- Cleared PASS_THROUGH_STATE_KEYS array in ContextProxy
- Updated ClineProvider to use file-based API instead of global state
- Updated UI components to work without taskHistory prop
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Removed redundant useTaskSearch call from ChatView since HistoryPreview
already makes its own call to fetch the tasks it needs to display.
This eliminates an unnecessary API call on application startup and
simplifies the component by removing conditional rendering based on task count.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Remove unnecessary loading and returning of entire task history array.
The return value was never used by any caller, so we can make this an O(1)
operation instead of O(n) by simply saving the single item.
This change significantly improves performance when updating task history,
which happens frequently during task execution.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Allows you to filter tasks not just by all and current, but also by any
historic workspace directory that exists in existing HistoryItem metadata
- Added persistent workspace index with metadata (path, name, missing status, timestamp)
- Created a rich workspace selector UI with filtering and grouping capabilities
- Added visual indicators for missing workspaces (strikethrough)
- Improved loading states and feedback during workspace changes and searches
- Added special workspace paths handling ("all", "current", "unknown")
- Standardized empty/undefined workspace paths to "unknown" for legacy items that do not have workspace stored in their metadata
- Optimized batch processing for better performance
This enhancement provides users with a more intuitive and powerful way to navigate their task history across multiple workspaces.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added a limit filter dropdown to the history view that allows users to control
how many results are displayed. The filter:
- Defaults to 50 items
- Offers options for 50, 100, 200, 500, 1000 items or all results
- Shows loading spinner when changing limits
- Integrates with existing workspace and sort filters
- Maintains consistent search options across operations
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This change modifies the copy button in task history to retrieve the task content from the backend storage using getHistoryItem before copying it to the clipboard. This ensures the most up-to-date content is copied.
Fixes: #3648
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a structured upgrade system that manages the task history migration process:
- Create a dedicated upgrade UI that blocks normal app usage until migration completes
- Separate migration check from migration execution for better control flow
- Add progress logging during migration to provide user feedback
- Remove automatic migration during extension activation
- Add new message types for upgrade status and completion
This change improves the user experience during task history migration by providing
visual feedback and ensuring the app is in a consistent state before allowing normal usage.
The upgrade system is designed to be extensible for future structural upgrades beyond
task history migration.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Add tests for cross-workspace functionality
- Verify items can be found in all workspaces where they existed
- Ensure workspace property reflects the latest workspace
- Add tests for helper functions and edge cases
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Removed pass-through state tests from ContextProxy that no longer apply
- Updated ClineProvider tests to use file-based history instead of global state
- Modified ChatTextArea tests to use useTaskSearch hook instead of taskHistory prop
- Completely rewrote useTaskSearch tests to use message-based architecture
- Updated other tests to remove taskHistory references from mock states
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
test: Fix ClineProvider test by mocking extension context and taskHistory
This commit fixes the failing test 'correctly identifies subtask scenario for issue #4602' by:
1. Adding necessary Vitest imports
2. Mocking getExtensionContext to return a mock context with globalStorageUri
3. Mocking taskHistory module to prevent file system operations during tests
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Added missing translations across all 17 supported locales:
- upgrade.* keys in common.json for task history index upgrade UI
- workspace.unknown, workspace.available, workspace.recent, workspace.filterPlaceholder in history.json
- limit.* keys and noItemsFound in history.json for pagination controls
All translations now complete with proper localization for:
- Catalan, German, Spanish, French, Hindi, Indonesian, Italian
- Japanese, Korean, Dutch, Polish, Portuguese (Brazil)
- Russian, Turkish, Vietnamese, Chinese (Simplified/Traditional)
Fixes missing UI text that would appear in English fallback
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Implement a comprehensive task history management system with UI tools for scanning, diagnosing, and repairing history issues:
- Add new HistoryScanResults and HistoryRebuildOptions interfaces
- Refactor reindexHistoryItems into modular components:
- scanTaskHistory: Identifies valid, orphaned, and missing tasks
- rebuildIndexes: Rebuilds indexes with configurable options
- reconstructTask: Recovers orphaned tasks from UI messages
- Create new HistoryIndexTools UI component with:
- Task history scanning capabilities
- Configurable rebuild options (merge/replace modes)
- Task preview and inspection tools
- Real-time operation logging
- Improve error handling and provide detailed logging
- Update message handlers and type definitions
- Add comprehensive translations for the new UI
This change helps users diagnose and fix task history inconsistencies between global state and filesystem, preventing "lost" tasks and improving history reliability.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: prevent ReDoS vulnerability in log message regex
Replace non-greedy wildcard pattern (.*?) with a more specific character class [^\]]*
to avoid potential catastrophic backtracking on malicious input.
This addresses a security vulnerability where the regex could run slow on
strings starting with '[]' and containing many repetitions of '\t'.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
fix: replace regex with string indexes in logMessage
Replace regex pattern with string index operations in logMessage function to
avoid potential ReDoS (Regular Expression Denial of Service) vulnerabilities.
The change uses indexOf and substring instead of regex matching, which is
more efficient and safer for processing log messages with tags.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: implement mutual exclusion for history operations
Created a mutex pattern to ensure history operations are mutually exclusive.
This prevents concurrent execution of reindexHistoryItems and search operations,
maintaining data consistency during indexing.
Extracted common mutex logic into a reusable _withMutex helper function.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
feat: add bidirectional sync with legacy globalState
Adds capability to synchronize tasks between the new file-based history system and legacy VSCode globalState storage:
- Renamed mergeGlobal to mergeFromGlobal for clarity
- Added new mergeToGlobal option to update globalState with file index data
- Added tracking of tasks that exist only in file indexes via tasksOnlyInTaskHistoryIndexes
- Added developer UI controls in advanced section for managing globalState sync
- Updated tests and documentation to reflect new bidirectional capabilities
This feature enables backward compatibility testing with older versions of Roo Code by ensuring tasks created in the new storage format are also available in the legacy format.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
refactor: make rebuildIndexes private by renaming to _rebuildIndexes
This change makes the rebuildIndexes function private by adding an underscore prefix
to its name, following the project's convention for private functions. All references
to this function have been updated accordingly in both the implementation and test files.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add translations for task history reindexing features across all supported languages:
- Add backend translations for history reindex success/failure messages
- Add frontend translations for the history index tools UI
- Update settings and common translation files for all locales
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Simplifies the task history recovery interface by moving all recovery and rebuild options into a single collapsed 'Advanced' section. This addresses feedback that the previous UI was too complex for users who just need to quickly restore tasks.
The main 'Rebuild' and 'Rescan' action buttons remain directly visible, while all configuration checkboxes and mode selections are now neatly tucked away, available on-demand, and default to sensible values for a simple 'fix it' experience.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

All configuration checkboxes and mode selections are now neatly tucked away, and default to sensible values for a simple 'fix it' experience:

image

@KJ7LNW
KJ7LNW marked this pull request as ready for review July 11, 2025 23:51
@KJ7LNWKJ7LNW moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code RoadmapJul 11, 2025
@ellipsis-dev

Copy link
Copy Markdown
Contributor

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@KJ7LNW

Copy link
Copy Markdown
ContributorAuthor

@KJ7LNWKJ7LNW closed this Jul 12, 2025
@github-project-automationgithub-project-automationBot moved this from PR [Needs Prelim Review] to Done in Roo Code RoadmapJul 12, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

EnhancementNew feature or requestPR - Needs Preliminary Reviewsize:XXLThis PR changes 1000+ lines, ignoring generated files.UI/UXUI/UX related or focused

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

No way to recover tasks lost due to global state race conditions

3 participants

@KJ7LNW@daniel-lxs@hannesrudolph