Skip to content

fix(skills): clean up orphaned database records when skill directory is missing#2326

Open
wucm667 wants to merge 2 commits intofarion1231:mainfrom
wucm667:fix/skill-cleanup-on-manual-delete
Open

fix(skills): clean up orphaned database records when skill directory is missing#2326
wucm667 wants to merge 2 commits intofarion1231:mainfrom
wucm667:fix/skill-cleanup-on-manual-delete

Conversation

@wucm667
Copy link
Copy Markdown

@wucm667 wucm667 commented Apr 25, 2026

Problem / 问题

When users manually delete skill directories from the filesystem (e.g., ~/.cc-switch/skills/, ~/.claude/skills/, ~/.codex/skills/), the CC Switch client still displays these deleted skills because get_all_installed() only reads from the database without verifying that the skill directory exists on disk.

Closes #2279

Solution / 解决方案

Modified get_all_installed() in src-tauri/src/services/skill.rs to:

  1. Verify the SSOT directory is accessible before cleanup
  2. Check each database record against the filesystem
  3. Auto-remove orphaned records where the directory has been deleted
  4. Log warnings for each cleanup operation

Safety / 安全性

  • If the SSOT directory itself is inaccessible, cleanup is skipped and all records are returned (no false deletions)
  • Only the get_all_installed function is modified — no changes to uninstall, install, or database logic

Files Changed / 文件变更

  • src-tauri/src/services/skill.rsget_all_installed() function (+27/-1)

…is missing

When users manually delete skill directories from the filesystem,
get_all_installed() now detects orphaned database records and removes
them automatically. Adds a safety check to skip cleanup if the SSOT
directory itself is inaccessible.

Fixes farion1231#2279
Copy link
Copy Markdown
Owner

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c26b1a4d7

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

Comment thread src-tauri/src/services/skill.rs Outdated
@wucm667
Copy link
Copy Markdown
Author

wucm667 commented Apr 27, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

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.

claude 、codex手动删除skill后 并且 .cc-switch中skills文件夹也删了但是CCS里面仍然存在删除的skills

2 participants