Fix/28944 symlink skills dedupe - #29017
Conversation
|
📊 PR Size: size/L
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses two main issues: it fixes a bug where symlinked or junctioned skill directories were scanned multiple times, triggering false conflict warnings, and it improves the robustness of the tool output truncation utility to handle edge cases with negative or zero character limits. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the hook documentation to include new decision values and addresses two key issues in the core package. It resolves a duplicate skill loading bug (GitHub issue #28944) by tracking canonicalized paths of scanned directories in 'SkillManager' to prevent duplicate loading when directories are symlinked or junctioned. Additionally, it fixes an issue in 'formatTruncatedToolOutput' to safely handle zero or negative 'maxChars' values without output inflation. Comprehensive unit and regression tests have been added for both fixes. As there are no review comments, no further feedback is provided.
Title
fix(core): dedupe symlinked/junctioned skill directories during discovery (#28944)
Summary
Fixes #28944
When a workspace or user directory links
.geminito.agents(e.g. via Windows junctionmklink /J .gemini .agentsor a POSIX symlink) to support open Agent Skills standards alongside legacy paths,SkillManager.discoverSkills()scanned both entry points (.gemini/skillsand.agents/skills).Because paths were evaluated as raw strings, identical skills were discovered twice under different logical paths, triggering false
Skill conflict detectedwarnings on startup and during/skills reload.This PR canonicalizes directory paths prior to scanning, ensuring each physical directory is scanned exactly once per discovery pass.
Root Cause
SkillManager.discoverSkills()scans four locations per pass:.gemini/skills.agents/skills.gemini/skills.agents/skillsWhen
.geminiis symlinked or junctioned to.agents, paths #3 and #4 point to the same physical folder on disk. Scanning both paths causes glob matches to produce different logical file paths (e.g.,.gemini/skills/foo/SKILL.mdvs.agents/skills/foo/SKILL.md), which leadsaddSkillsWithPrecedence()to flag a false conflict: