Skip to content

fix(core): dedupe symlinked/junctioned skills directories during discovery - #28968

Open
aniruddhaadak80 wants to merge 1 commit into
google-gemini:mainfrom
aniruddhaadak80:fix/issue-28944-skill-alias-dedupe
Open

fix(core): dedupe symlinked/junctioned skills directories during discovery#28968
aniruddhaadak80 wants to merge 1 commit into
google-gemini:mainfrom
aniruddhaadak80:fix/issue-28944-skill-alias-dedupe

Conversation

@aniruddhaadak80

Copy link
Copy Markdown
Contributor

Summary

Fixes #28944

When a user links their .gemini folder to .agents (Windows junction via \mklink /J .gemini .agents, or a symlink) to follow the open Agent Skills standard while retaining compatibility, the CLI scanned both configured entry points (.gemini/skills and .agents/skills) as if they were separate directories. Since discovery did not resolve aliases to their physical paths, identical skills were registered twice, producing duplicate-skill conflict warnings on every startup and /skills reload.

Changes

  • \SkillManager.discoverSkills\ now tracks scanned directories by their physical (real) path (\ s.realpath) and skips any directory that resolves to an already-scanned location.
  • Applies to both tiers where the alias exists: user-level (~/.gemini/skills\ / ~/.agents/skills) and workspace-level (<ws>/.gemini/skills\ / <ws>/.agents/skills). Built-in and extension skills are unaffected.
  • Non-existent directories fall back to their resolved path, preserving existing behavior.

Behavior after the fix

With .gemini -> .agents: skills are discovered exactly once from the first entry point; no \Skill conflict detected: ... overriding ...\ warnings. With two genuinely distinct directories, behavior is unchanged (including existing alias precedence).

Testing

  • Added end-to-end tests in \skillManagerAlias.test.ts:
    • Workspace tier: .agents/skills/my-skill/SKILL.md\ with .gemini\ created as a real junction/symlink → skill discovered once, zero conflict warnings (skips gracefully on platforms that disallow directory links).
    • User tier: same scenario for ~/.gemini -> ~/.agents.
  • Full \src/skills\ suite passes (29 tests), plus eslint, prettier, and \ sc --noEmit\ on @google/gemini-cli-core.

Documentation

@aniruddhaadak80
aniruddhaadak80 requested a review from a team as a code owner August 22, 2026 22:55
@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 an issue where identical skills were being registered multiple times when users employed symlinks or Windows junctions to alias their skill directories. By resolving paths to their physical locations during the discovery process, the system now correctly identifies and skips redundant scans, eliminating unnecessary conflict warnings and improving startup performance.

Highlights

  • Deduplication of Skill Directories: Implemented a mechanism in SkillManager to track scanned directories by their physical path, preventing duplicate skill discovery when symlinks or junctions are used.
  • Improved Path Resolution: Added a new private method 'loadSkillsFromUniqueDir' that resolves paths to their real locations before scanning, ensuring consistent behavior across aliased directories.
  • Regression Testing: Added comprehensive end-to-end tests in 'skillManagerAlias.test.ts' to verify that linked directories are scanned exactly once and do not trigger conflict warnings.
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.

@github-actions github-actions Bot added the size/m A medium sized PR label Aug 22, 2026
@github-actions

Copy link
Copy Markdown

📊 PR Size: size/M

  • Lines changed: 162
  • Additions: +158
  • Deletions: -4
  • Files changed: 2

@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 introduces a mechanism to prevent duplicate skill discovery when directories are symlinked or junctioned (e.g., .gemini pointing to .agents). It adds a loadSkillsFromUniqueDir helper in SkillManager that resolves directories to their physical paths using fs.realpath and tracks visited paths in a Set. Additionally, corresponding unit tests are added to verify that duplicate skills are not reported under symlinked/junctioned alias directories. There are no review comments, so I have no feedback to provide.

@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 22, 2026
@gemini-cli

gemini-cli Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Hi there! Thank you for your interest in contributing to Gemini CLI.

To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'.

This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

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/m A medium sized PR status/pr-nudge-sent

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