fix(skills): fall back to junctions for Windows skill links#2749
fix(skills): fall back to junctions for Windows skill links#2749TheLonelyDevil9 wants to merge 1 commit into
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79e2e09ba7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| attributes & FILE_ATTRIBUTE_DIRECTORY != 0 | ||
| && attributes & FILE_ATTRIBUTE_REPARSE_POINT != 0 |
There was a problem hiding this comment.
Restrict managed-link detection to symlink/junction tags
The Windows managed-link check currently treats any directory with FILE_ATTRIBUTE_REPARSE_POINT as a CC Switch link, but many non-link directory types (for example cloud placeholders or other reparse-tagged directories) also match this predicate. Those paths are then routed through remove_path() as managed links, which uses remove_dir instead of recursive removal; this can fail on non-empty directories and break sync/remove flows when a normal skill directory carries a non-symlink reparse tag. The check should validate the reparse tag (e.g., only symlink/mount-point junction tags) before classifying a path as managed.
Useful? React with 👍 / 👎.
What?
Adds a Windows fallback for skill sync when directory symlink creation fails. CC Switch now treats skill sync links as managed links: Unix symlinks, Windows directory symlinks, or Windows junctions.
Why?
Non-admin Windows sessions without Developer Mode can fail directory symlink creation with an administrator-privilege error. That breaks live skill sync across CLI harnesses and can remove an existing link during toggle/re-sync flows.
How?
std::os::windows::fs::symlink_dirfirst on Windows.CreateFileWandDeviceIoControl(FSCTL_SET_REPARSE_POINT), avoidingcmd.exe/mklinkshell parsing.\??\/\\?\prefixes before SSOT comparisons.Testing?
git diff --checkcargo fmt,cargo test, or Rust build checks because Rust tooling is not available in this shell.Screenshots (optional)
Not applicable.
Anything Else?
No matching open upstream PR was found for Windows skill symlink-to-junction fallback.