Repository navigation
fix(skills): a skill folder that links to itself is listed with a problem, not a failed list - #265
connorburgess wants to merge 4 commits into
Conversation
…blem, not a failed list Symptom: one skill folder holding a link back to itself (`a -> .`) or to a folder above the link (`sub/up -> ..`) made the whole Skills list fail. GET /api/ui/skills returned an error for every skill instead of listing them, and inspecting the skill failed the same way. Cause: scanSkillDir's walk followed any folder link whose target stays inside the skill root, the root itself included, and read through the growing link path (a/a/a/...). readdirSync threw ELOOP after about 32 levels, and nothing caught it, so discoverLocalSkills threw. A long chain of folder links that never loops hit the same ELOOP. Fix: walk reads each folder through its real path and keeps the folders on the current descent, keyed by realpathSync.native (the plain real path where that call fails) so a link that spells a folder in another case still matches on a case-insensitive disk. A folder link back to one of them is reported as `symlink loop "<path>"` and not followed. That problem starts with "symlink ", so install, pack and adopt refuse the skill the way they already refuse a link that escapes it. Skills without loops list and hash as before. Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
|
My new pull request #266 (link-only skill installs no longer delete the skill's own library folder) also changes |
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
|
The skill directory symlink-loop fix still applies to SessionPipe GUI v0.8.18. Merged current Added the previously deferred Unreleased changelog entry. Validation on this head, macOS / Node 22.23.2:
GitHub CI run 47453785987 for head Desktop shard 2 failed A maintainer needs to rerun/investigate the failed desktop job and aggregate gate before merging. The upstream job-rerun API rejects this account with HTTP 403 for insufficient repository permissions. Also checked the combined source/test changes from all 19 refreshed PRs on the same main: no source conflicts; typecheck, lint and build passed; all 252 unit-test files passed (3,439 tests, two skipped). This was a local integration check, separate from the individual PR run above. Release-note entries may still need combining as PRs land. |
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
|
Merged current CI run 47497346826 for head The earlier run 47453785987 on Locally on |
Updated against v0.8.19 / main
e8bfe999on 2026-12-05. Current validation and refresh details.What
One skill folder with a folder link back into itself (for example
a -> ., orsub/up -> ..) no longer breaks the whole Skills list. The other skills are listed as usual, and the looping skill appears with the problemsymlink loop "<path>". Install, pack and adopt refuse that skill, as they already refuse a link that escapes the skill folder.Why
scanSkillDir'swalkinserver/ui/skillsCore.tsfollows a folder link whenever its real target is inside the skill root, and that includes the root itself. It read through the growing link path (a/a/a/...) untilreaddirSyncthrewELOOP: too many symbolic links encountered(32 levels on macOS). Nothing caught the error, sodiscoverLocalSkillsthrew andGET /api/ui/skillsfailed for every skill.inspectLocalSkillfailed the same way. A long chain of folder links that never loops (d0/next -> ../d1,d1/next -> ../d2, and so on) ran into the same ELOOP, because the path it read through grew with each link.The fix:
walkreads each folder through its real path, so the path it reads through never grows.realpathSync.nativespelling, so a link written../SUBstill matchessubon a case-insensitive disk. Where the native call fails, as it does on some Windows virtual drives, they are compared by the plain real path.Original proof (before the v0.8.18 refresh)
New tests in
server/ui/skills.test.ts(skillsCore symlink loops). They are skipped on Windows, where creating symlinks needs extra rights, using theskipIf(process.platform === "win32")pattern fromserver/tls-status.test.ts. The case test runs only on a case-insensitive disk (macOS default). On a case-sensitive disk that link is just broken, so the test skips itself.On this branch (
npx vitest run server/ui/skills.test.ts --reporter verbose):The same tests with
server/ui/skillsCore.tsfrommain(1a475e8):Checks on macOS, Node 22:
npm run typecheck: passes.npm run lint: exit 0. It reports 135 warnings, the same count as onmain, and none in the two changed files (npx biome check server/ui/skills.test.ts server/ui/skillsCore.ts: no diagnostics).npm test: on this branchTests 1 failed | 3371 passed | 2 skipped (3374). The one failure isserver/control/remote.parity.test.ts("machines, sends, refusals, jobs, … row for row":TestTimeoutError: Test timed out in 15000ms). It fails the same way on unmodifiedmain1a475e8 (Tests 1 failed | 3366 passed | 2 skipped (3369), the same test, the same 15000 ms timeout).web/src/files/model.break.test.ts("rebuilds a 20k-line file with 50 edits well under a second") also failed, at 1139 ms against its 1 s limit, under the load of the full run. It passed in the other full run, and on its own (Tests 26 passed (26)). It does not touch skills.Not done here, and not changed by this pull request:
SKILL.mdto the file cap.linkLocalSkilldoes not check these problems before linking a skill into a harness.All of these behave the same on
main.An entry is now included under Unreleased in
CHANGELOG.md. Other open PRs also add release notes; those entries may need combining as the PRs land.Checklist
git commit -s): the DCO is the only paperwork.npm run typecheck && npm run lint && npm testpass;npm run test:e2efor a UI change. (Not a UI change. Fornpm test, see Proof: the one failure also fails onmain.)// SPDX-License-Identifier: Apache-2.0. (No new files.)--demo).shared/*names the wire-contract change in the description. (Noshared/*change.)CHANGELOG.md.