RemoveProject empties a project (Skills, Servers, then syncProject) and
takes the entry off the list only once nothing magpie placed or wrote is
left in it. But the only thing that empties those records, syncProject,
gives up on a folder that's gone: it says "the folder is gone" and
returns with the records as they were — and the Result RemoveProject
hands it is thrown away, so the removal itself says nothing; the toast
the user sees is the one the full sync after every change reports. With
the folder gone there is nothing magpie can ever take back, so the
records never empty and the entry stays for good: the only way out was
the keep checkbox, which takes the entry off the list without looking at
the folder (#514), though that reads as keeping what magpie wrote, not
as the way out of a dead removal.
So removal now does what a skill's removal already does when its folder
is gone (removeSkill: only the entry goes): a folder that isn't there
has nothing of magpie's on disk to take back, so the project and the
records of what it placed and wrote go together, and the removal says
nothing failed. A folder that is there removes as before; a project
gone from disk still shows its "folder is gone" badge and still reports
the folder on a full sync; keep is untouched.
TestRemoveProjectWhoseFolderIsGone is new: a project with placed skills
whose folder is deleted outside magpie, removed without keep — the
entry goes, the Result has no problem, the library's skills stay; and a
gone project removed with keep goes off the list as it always did. It
fails without the change (the removal says "the folder is gone" and the
entry stays) and passes with it.
go test -tags nogui -count=1 ./internal/library/ pass (28 project and
gone-family tests targeted first); gofmt, go vet -tags nogui and
go build -tags nogui ./... pass. The cgo warning from
internal/gui/trayimage_darwin.go is there before this change.
Generated-by: GLM-5.3-Flash (ZCode)
Reviewed and ported, narrowed: only a folder known to be gone (not
there, or not a folder) drops the records. A Stat that fails another way
(no permission, a drive answering with an error) isn't known to be gone,
so the removal goes as before and the records stay, to be taken back
once the folder answers; TestRemoveProjectWhoseFolderCantBeRead pins it.
Run on mote (darwin arm64, Go 1.26.8): go test -tags nogui -count=1
./internal/library/ ok 73.8s. On Linux (wsl-run, magpie-desktop):
-run TestRemoveProject ok.
Broken by hand: projects.go back at main, tests kept:
TestRemoveProjectWhoseFolderIsGone FAIL "the removal said: [... the
folder is gone]", the entry left with Placed [.agents/skills/pdf
.claude/skills/pdf]. The patch's own check (err != nil):
TestRemoveProjectWhoseFolderCantBeRead FAIL "projects: []".
Not tried: removing a deleted project from the GUI on Windows, the
reporter's system.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
An unreadable subfolder in an agent's copy of a skill hid edits from the
timestamp scan, which ignored read and stat errors. So switching copy/link
mode, refreshing the skill, or removing a duplicate copy could replace the
copy and lose those edits. Shared-folder deduplication could remove
SKILL.md before failing on the unreadable subtree. changedAt and
copyIsFresh now return the scan error. The copy is kept in place for that
sync (Library.blockedSkills) and reported as a Problem naming the path.
This covers agent copies, shared-folder deduplication, project copies and
Claude Desktop copies. Other agents still sync, and a later sync tries
again once the copy can be read.
Merged onto main. #1449 added two callers of changedAt in
skill_changed.go:
- libraryHash doesn't remember a hash for a folder it couldn't wholly read.
- editState says unknown for an agent's copy it couldn't wholly read, so
an update from GitHub keeps the library's version aside.
TestEditStateUnknownForAnUnreadableCopy covers editState.
docs/subsystems/library.md keeps both new rules.
Run:
- go test -tags nogui ./internal/library/ and ./... (see the PR), go vet
for darwin, linux with nogui, and windows, and gofmt.
- With changedAt ignoring walk errors again, the four ScanError and
EditState tests go red.
- With editState ignoring the error, the new test goes red
(edited true, known true).
- Checked with Unix permissions on macOS only, not as root and not on
Windows.
YangZhiqiang98 asked (#1449) that the Library find which skills have
updates and update them. magpie already checked skills from GitHub (a
market install among them) by hand and could update them, but an update
deleted the library's folder, so a skill the user had changed (by hand,
through an agent's link, or in an agent's copy not yet taken in) was lost
without a word, and nothing checked unless the user pressed Check.
- A skill is "changed here" when its library folder no longer hashes to
what was fetched (Finder's .DS_Store aside), or an agent's copy was
edited since its mark and not yet taken in (editState, skill_changed.go).
The view says so (SkillView.edited) and the row shows "Changed here".
- UpdateSkill refuses such a skill with *EditedError unless told to
replace it. The row's Update asks in the page first (Keep mine / Update;
Update sends replace). Update N, the group's Update N and the CLI's
update-all leave it as it is and say so. The CLI takes
`magpie library skill update <name> --replace-edits`.
- The version an update replaces is moved to the backups when it was
changed, or when it can't be told (a skill with no hash from before).
- View.checkDue: no check since magpie started, or none for 12 hours. The
page then runs the check once by itself as the skills open, and says
only what there is to update or add.
Not checked, by design: skills the skills CLI manages (`npx skills
update` updates them; magpie only groups them), linked local folders,
skills imported from an agent with no source, and From-only skills have
no remote; CC Switch-installed skills can still be updated by hand.
Verified:
- go test -tags nogui ./... (sandbox HOME); new TestUpdateKeepsASkillChangedHere,
TestUpdateKeepsACopyEditedInAnAgent, TestUpdateKeepsWhatItCantTell,
TestCheckDue, TestCheckSkillsMarksItDone, all from httptest. With
editState forced to "not changed" the first three fail.
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui on
./internal/library ./internal/gui ./internal/tui .
- GUI: new skill-update-edited.test.cjs (Chromium and WebKit, 860 and
400px, en and zh; no scroll on click; fails with the row's ask removed),
plus the 22 other library skill tests, gui-ja, gui-de, gui-zh-tw,
i18n-keys and click-scroll: 262 pass.
- Real use in a sandbox HOME with github.com/anthropics/skills: installed
pdf and docx, the real check said both current; an edit through Claude
Code's link was refused by `skill update pdf`, skipped by `skill update`
(docx updated), replaced by `--replace-edits` with the edit in
backups/<time>/library/skills/pdf; docx edited later shows edited, a
.DS_Store doesn't.