fix(readiness-core): don't let an unreadable skills path abort the whole scan - #525
Merged
cobusgreyling merged 1 commit intoAug 17, 2026
Conversation
…ole scan scanSkillDirectories() only guarded the readdir() call with a prior fileExists() check, which just proves the path existed at stat() time -- it doesn't prove readdir() will succeed on it. A skills path that exists but isn't actually a directory (renamed, a broken checkout, a stray file artifact) throws ENOTDIR; an unreadable or permission- denied directory throws EPERM; a path removed between the two calls throws ENOENT. All three used to propagate out of this function uncaught, which aborts the entire audit run in loop-audit and goal-audit (both call this via findSkills) instead of just skipping that one broken path and scanning the rest. tools/mcp-server/src/resolver.ts's listSkills() already handles the identical shape of problem correctly, wrapping its readdir() in a try/catch with the same fileExists()-then-readdir() structure. Applied the same fix here. Test plan: added a regression test where .claude/skills exists as a file instead of a directory, asserting the scan completes and still finds a valid skill under a sibling path instead of throwing. Full clean rebuild + npm test: 6/6 passing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
cobusgreyling
approved these changes
Aug 17, 2026
cobusgreyling
left a comment
Owner
There was a problem hiding this comment.
scanSkillDirectories should skip unreadable/non-dir skills paths instead of aborting the whole audit. Matches mcp-server listSkills() and the ENOTDIR fixture test is good.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
scanSkillDirectories() only guarded the readdir() call with a prior
fileExists() check, which just proves the path existed at stat() time
-- it doesn't prove readdir() will succeed on it. A skills path that
exists but isn't actually a directory (renamed, a broken checkout, a
stray file artifact) throws ENOTDIR; an unreadable or permission-
denied directory throws EPERM; a path removed between the two calls
throws ENOENT. All three used to propagate out of this function
uncaught, which aborts the entire audit run in loop-audit and
goal-audit (both call this via findSkills) instead of just skipping
that one broken path and scanning the rest.
Fix
tools/mcp-server/src/resolver.ts's listSkills() already handles the
identical shape of problem correctly, wrapping its readdir() in a
try/catch with the same fileExists()-then-readdir() structure. Applied
the same fix here.
Test plan
Added a regression test where .claude/skills exists as a file instead
of a directory, asserting the scan completes and still finds a valid
skill under a sibling path instead of throwing. Full clean rebuild +
npm test: 6/6 passing.