Skip to content

fix: protect skills during copy fallback#2791

Merged
farion1231 merged 1 commit into
farion1231:mainfrom
rogerdigital:fix/skill-sync-copy-fallback
May 18, 2026
Merged

fix: protect skills during copy fallback#2791
farion1231 merged 1 commit into
farion1231:mainfrom
rogerdigital:fix/skill-sync-copy-fallback

Conversation

@rogerdigital

@rogerdigital rogerdigital commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • validate skill source directories before syncing so empty or broken sources are rejected
  • make copy fallback write to a temporary directory before replacing the app skill directory
  • avoid deleting an existing real app skill directory just to attempt symlink creation in auto mode
  • add a regression test for preserving an existing destination when the source is empty

Root cause

The sync path deleted the destination skill directory before attempting symlink creation. If symlink creation failed and fallback copy used an empty or invalid source directory, the previously working app skill directory had already been removed.

Validation

  • pnpm typecheck
  • pnpm test:unit
  • pnpm format:check
  • pnpm build:renderer
  • git diff --check
  • cargo test replace_dest_with_copy_rejects_empty_source_without_touching_existing_dest

Fixes #2762

@rogerdigital
rogerdigital marked this pull request as ready for review May 14, 2026 15:56
@farion1231

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ 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".

@farion1231 farion1231 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for your contribution!

@farion1231
farion1231 merged commit 0977dcd into farion1231:main May 18, 2026
1 check passed
dfbb pushed a commit to dfbb/cc-switch that referenced this pull request May 20, 2026
@rogerdigital
rogerdigital deleted the fix/skill-sync-copy-fallback branch May 20, 2026 16:49
royccai pushed a commit to royccai/cc-switch-mod that referenced this pull request May 31, 2026
delta-lo pushed a commit to delta-lo/cc-switch-mod that referenced this pull request May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

技能同步的"回退到文件复制"逻辑会覆盖并清空用户本地技能,导致数据丢失

2 participants