Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Oct 2, 2025

Summary

This PR fixes issue #8471 where tasks would disappear when switching panels in the VSCode extension, specifically when the workspace is the Desktop directory on macOS.

Problem

When users had VSCode open without a workspace (defaulting to Desktop directory), tasks would disappear from the task panel when navigating to other panels (like settings) and then returning to the task panel. This was specific to the Desktop directory - other directories worked correctly.

Root Cause

The issue was caused by inconsistent path comparison in the useTaskSearch hook. When filtering tasks by workspace, simple string equality was used, which failed to handle:

  • Paths with trailing slashes vs without
  • Different path separators (/ vs )
  • Case sensitivity differences between platforms
  • Normalized vs non-normalized paths

Solution

  1. Created arePathsEqual() utility function - A robust cross-platform path comparison function that:

    • Normalizes paths before comparison
    • Handles trailing slashes correctly
    • Manages platform-specific case sensitivity (case-insensitive on Windows)
    • Resolves relative path segments (., ..)
    • Handles mixed path separators
  2. Updated useTaskSearch hook - Modified the workspace filtering logic to use arePathsEqual() instead of simple string comparison

  3. Added comprehensive tests - Created test suites for both the utility function and the specific Desktop directory scenarios

Testing

  • ✅ All existing tests pass
  • ✅ Added 14 new tests for path comparison utility
  • ✅ Added 3 new tests specifically for Desktop directory handling
  • ✅ Tested on Windows, macOS, and Linux path formats
  • ✅ Linting and type checking pass

Changes

  • Added webview-ui/src/utils/path.ts - Path comparison utility
  • Modified webview-ui/src/components/history/useTaskSearch.ts - Use proper path comparison
  • Added webview-ui/src/utils/__tests__/path.spec.ts - Path utility tests
  • Updated webview-ui/src/components/history/__tests__/useTaskSearch.spec.tsx - Desktop directory tests

Fixes #8471


Important

Fixes task persistence issue in VSCode extension for Desktop directory on macOS by using a new path comparison utility.

  • Behavior:
    • Fixes task disappearance issue in VSCode extension when workspace is Desktop directory on macOS.
    • Updates useTaskSearch to use arePathsEqual() for path comparison, ensuring consistent task filtering.
  • Utilities:
    • Adds arePathsEqual() in path.ts for robust cross-platform path comparison.
    • Handles path normalization, trailing slashes, case sensitivity, and mixed separators.
  • Testing:
    • Adds 14 tests for arePathsEqual() in path.spec.ts.
    • Adds 3 tests for Desktop directory handling in useTaskSearch.spec.tsx.

This description was created by Ellipsis for b4659fb. You can customize this summary. It will automatically update as commits are pushed.

- Add arePathsEqual utility function for proper path comparison
- Update useTaskSearch hook to use arePathsEqual for workspace filtering
- Add comprehensive tests for Desktop directory path handling
- Fix path normalization to handle mixed separators and edge cases

This ensures tasks are properly filtered and persist when switching
panels, especially when the workspace is the Desktop directory.

Fixes #8471
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 2, 2025 19:47
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Oct 2, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Self-review protocol engaged: the code stares back and I report anomalies with machine-like indifference.

let normalized = p.replace(/\\/g, "/")

// Remove duplicate slashes
normalized = normalized.replace(/\/+/g, "/")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

P2: UNC paths lose their double-leading-slash prefix. Collapsing duplicate slashes and only keeping a single leading empty segment transforms //server/share into /server/share, changing semantics on Windows network paths. Consider preserving the UNC prefix when the original input matches ^[\/]{2}[^\\/]. Add normalization that retains the double slash at the start for UNC paths and include tests for //server/share variants.

path2 = normalizePath(path2)

// Windows paths are case-insensitive
if (process.platform === "win32") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

P2: Case sensitivity on macOS. arePathsEqual is case-sensitive for darwin, but the default macOS filesystem is case-insensitive. This can cause false negatives if casing differs (e.g., /Users/User/Desktop vs /users/user/Desktop). Consider treating darwin as case-insensitive by default or make this behavior configurable/detectable at runtime; add tests covering darwin case variations.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 2, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 2, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG] Task panel empty and task in progress missing after navigating away from panel

3 participants