-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
ShadowCheckpointService.initShadowGit() compares core.worktree to this.workspaceDir using raw string equality (worktree !== this.workspaceDir at ~line 158). On Windows, equivalent paths can differ in string representation, causing checkpoints to fail with:
Checkpoints can only be used in the original workspace: C:/Users/Foo/project !== C:\Users\Foo\project
Root cause
Git on Windows stores core.worktree with forward slashes (e.g., C:/Users/Foo/project), while VS Code resolves workspace paths with native backslashes (e.g., C:\Users\Foo\project). Additional divergence sources include:
- Drive-letter casing:
c:\projectvsC:\project - Trailing separators:
C:\project\vsC:\project - Symlink resolution: realpath may differ from the originally-provided path
How to reproduce
- Open a workspace on Windows where the workspace path uses backslashes
- Create a task that initializes checkpoints (shadow git repo is created,
core.worktreestored with forward slashes) - Close and reopen the workspace (VS Code may resolve the path differently)
- Attempt to resume the task — checkpoint initialization fails because
core.worktree(forward slashes) doesn't string-matchworkspaceDir(backslashes)
Search pattern
worktree !== this.workspaceDir
Suggested fix
Add a normalizePathForCompare() helper that:
- Applies
path.resolve()+path.normalize()to canonicalize separators - Strips trailing path separators
- Uses case-insensitive comparison on
win32platform - Preserves fail-closed behavior: missing/undefined
core.worktreestill throws
Acceptance criteria
- Equivalent Windows paths with different separator styles are recognized as equal
- Drive-letter casing differences don't cause false mismatches
- Trailing separator differences don't cause false mismatches
- Missing
core.worktreestill throws (fail-closed preserved) - No behavioral change on macOS/Linux (paths are already case-sensitive and use consistent separators)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working