Skip to content

Fix/28944 symlink skills dedupe - #29017

Open
Kanika0306 wants to merge 4 commits into
google-gemini:mainfrom
Kanika0306:fix/28944-symlink-skills-dedupe
Open

Fix/28944 symlink skills dedupe#29017
Kanika0306 wants to merge 4 commits into
google-gemini:mainfrom
Kanika0306:fix/28944-symlink-skills-dedupe

Conversation

@Kanika0306

Copy link
Copy Markdown

Title

fix(core): dedupe symlinked/junctioned skill directories during discovery (#28944)

Summary

Fixes #28944

When a workspace or user directory links .gemini to .agents (e.g. via Windows junction mklink /J .gemini .agents or a POSIX symlink) to support open Agent Skills standards alongside legacy paths, SkillManager.discoverSkills() scanned both entry points (.gemini/skills and .agents/skills).

Because paths were evaluated as raw strings, identical skills were discovered twice under different logical paths, triggering false Skill conflict detected warnings 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:

  1. User .gemini/skills
  2. User .agents/skills
  3. Project .gemini/skills
  4. Project .agents/skills

When .gemini is 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.md vs .agents/skills/foo/SKILL.md), which leads addSkillsWithPrecedence() to flag a false conflict:

if (existingSkill && existingSkill.location !== newSkill.location) {
  // False positive conflict warning triggered!
}

@Kanika0306
Kanika0306 requested review from a team as code owners August 24, 2026 12:56
@github-actions github-actions Bot added the size/l A large sized PR label Aug 24, 2026
@github-actions

Copy link
Copy Markdown

📊 PR Size: size/L

  • Lines changed: 471
  • Additions: +456
  • Deletions: -15
  • Files changed: 5

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Skill Discovery Deduplication: Implemented path canonicalization in SkillManager.discoverSkills() to prevent duplicate scanning of symlinked or junctioned skill directories, which previously caused false conflict warnings.
  • Tool Output Truncation Fix: Updated formatTruncatedToolOutput to safely handle non-positive maxChars values, preventing output inflation and ensuring correct truncation behavior.
  • Documentation Update: Updated the hook reference documentation to include the "ask" and "approve" decision types.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gemini-cli gemini-cli Bot added priority/p3 Backlog - a good idea but not currently a priority. area/extensions Issues related to Gemini CLI extensions capability labels Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/extensions Issues related to Gemini CLI extensions capability priority/p3 Backlog - a good idea but not currently a priority. size/l A large sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/skills reload reports duplicate warnings when .gemini is symlinked/junctioned to .agents

1 participant