fix(provider-cursor): a symlinked skills root is no longer scanned twice #18664
main fromrefs/pull/18664/head·merged by juliusmarminge View on GitHubProblem#
Cursor skill discovery walks .cursor/skills, .agents/skills, .codex/skills and .claude/skills under the project, then under the home directory, against one shared budget of 10,000 entries. When one root is a symlink to another, for example ~/.agents/skills pointing at ~/.claude/skills, the same tree is walked and charged twice. A tree over half the budget then fails discovery with scan-budget-exhausted, and Cursor shows no skills.
Change#
Discovery records the real path of each root it walks and skips a root whose real path it has already walked. Root order is unchanged, so the first root that reaches a tree still names its skills and their scope. A project opened at the home directory also stops charging each root twice; its skills keep the project label they had before. Roots that overlap without being the same directory, such as a root linked into a subfolder of another, are walked as before.
Scope and approval#
#17389 fixed the depth-limit part of #17215 and closed the issue. A follow-up comment reproduced two remaining cases on main: this symlinked root, also in m4tta's trace, and a single root over the entry budget.
This is a small fix for an obvious bug: one directory should be charged to the scan budget once. It does not change the over-budget case, because that needs a maintainer decision between the current hard failure and the triage comment's option 3: a budget per root, or partial results with a flag.
Refs #17215
Verification#
Agent-run on Linux. No person tested this.
Live run in headless Chromium (1280×800) against a Linux dev server, with the Cursor provider signed in by API key. The server ran with a throwaway home: ~/.claude/skills held a review skill and 6,000 empty files, and ~/.agents/skills was a symlink to it, so two walks charge 12,006 entries against the 10,000 budget.
| Main | This branch | |
|---|---|---|
Typing $ in a Cursor thread | ![]() | ![]() |
On main the menu reads "No skills found", and the server logs Failed to discover Cursor skills caused by CursorSkillsProbeError … (scan-budget-exhausted). With the change, review is listed, and no discovery error is logged. The other five entries are Codex's built-in skills, which the Codex provider writes under ~/.codex/skills in that home. The main in each checkout bar is the test project's branch.
Discovery took about 4m45s on both builds in this setup, and the menu reads "No skills found" until it ends, so the log line is what shows the failure on main. This run did not trace the delay.
- 7 tests pass in
packages/provider-cursor/src/server/skills.test.ts. - With
packages/provider-cursor/src/server/skills.tsreverted to5753207d53, 1 test fails with assertion errors: "Cursor skills > scans a skills root linked to another root only once". vp fmt --checkandvp lintreport no errors and no new warnings on the 2 changed TS files.- Typecheck passes for
@t3tools/provider-cursor.
Model: Claude Opus 5.5 (implementation and review), GPT-6-Astra (review). Harness: Claude Code, Codex.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Approved at
20bd3e4Macroscope's review found this PR approvable — This is a narrowly scoped Cursor skill-discovery fix that avoids rescanning the same symlink-resolved root while preserving existing root order and scope behavior. It includes focused regression coverage and introduces no schema, deployment, security, billing, or static-analysis changes.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
604ad59d-09e2-4dde-ae92-bca97aaeb19b
📥 Commits
-
Reviewing files that changed from the base of the PR and between 5753207d53362608f281738eda3a9faf4e13b6be and 20bd3e4368d417422ea7d4c86a1135ecf330b787.
📒 Files selected for processing (2)
-
packages/provider-cursor/src/server/skills.test.tspackages/provider-cursor/src/server/skills.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
📝 Walkthrough
-
Walkthrough#
Cursor skill discovery now tracks canonical roots across root scans and skips duplicate roots. A symlink test uses a shared tree with 6,000 entries and checks that the skill is discovered once.
Changes#
Cursor skill scanning
Layer / File(s) Summary Deduplicate canonical skill roots
packages/provider-cursor/src/server/skills.ts,packages/provider-cursor/src/server/skills.test.tsdiscoverSkillsInRootrecords canonical roots and skips roots already scanned.inspectCursorSkillsshares the set across root scans. A symlink test checks that discovery returns the skill once with user scope.Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to
20bd3Cursor skill discovery now skips a skills root it has already scanned, so a symlinked root no longer exhausts the shared scan budget. Root order and skill scope are unchanged. I found no merge-blocking risk.
Architecture Summary#
Architecture risk: 🔵 Low · up to
20bd3The change affects 1 system.
Changed systems:
packages/provider-cursorArchitecture concerns No architecture-level concerns identified.
Review details
-
Systems and components
- observed — packages/provider-cursor (library) was modified; 2 changed files map to changed impact.
Before / after behavior
- observed — Modified behavior in packages/provider-cursor/src/server/skills.test.ts: Added a test, skipped when symlinks are unsupported, that links
.agents/skillsto.claude/skills. With 6,000 entries in the shared tree, it asserts probing succeeds and discovery reportsreviewonce with user scope. - observed — Modified behavior in packages/provider-cursor/src/server/skills.ts:
discoverSkillsInRootnow requiresscannedRoots, checks each root’s resolved real path against the shared set, and records unseen roots before traversal. Duplicate roots return no skills without walking the tree again. - observed — Modified behavior in packages/provider-cursor/src/server/skills.ts:
inspectCursorSkillsnow initializes onescannedRootsset and passes it to each root discovery call, so duplicate-root detection applies across the full scan.
Pre-merge checks |
4-
✅ Passed checks (4 passed)
-
Check name Status Explanation Title check The title clearly and concisely describes the main fix: preventing a symlinked skills root from being scanned twice. Description check The description includes the required Problem, Change, Scope and approval, and Verification sections. It explains the bug, the implementation, issue references, focused test results, manual reproducti… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment `@coderabbitai help` to get the list of available commands.-
coderabbitai[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged this52eba84
juliusmarminge closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes