Skip to content

fix(skill): resolve duplicate skill names deterministically - #15973

Open
markjoin123 wants to merge 2 commits into
Kilo-Org:mainfrom
markjoin123:cursor/skill-duplicate-deterministic-de57
Open

markjoin123 wants to merge 2 commits into
Kilo-Org:mainfrom
markjoin123:cursor/skill-duplicate-deterministic-de57

Conversation

@markjoin123

Copy link
Copy Markdown

Issue

Fixes #15952

Context

Duplicate skill names inside one scan root followed glob order, so the absolute path written into the system prompt could change between runs. Sorting paths within each root makes that winner stable. Later roots are still applied afterward, so root precedence stays the same. A claim comment is already on the issue.

Implementation

Each skill scan sorts that root's paths before recording them. The last path in that sorted order wins for a duplicate name in the same root. A later root still overrides an earlier one because scans run in the existing root order.

Screenshots / Video

N/A. No visual change.

How to Test

Manual/local verification

Agent-executed on eea779dcc6e914e8bfeacd7c8de388310c6bc770 from an isolated checkout of the public https://github.com/Kilo-Org/kilocode.git remote, with git config that does not rewrite GitHub URLs:

  • bun run test in packages/opencode: 318 files passed, 0 failed, 0 flaky (814.4s). This includes fast-tier-kilocode-tools, test/kilocode/sandbox/shell-network.test.ts, and test/kilocode/sandbox/config-network.test.ts.
  • Targeted skill tests: 51 passed, 0 failed, across 12 files, including test/kilocode/skill-duplicate-order.test.ts.
  • The three earlier environment failures pass after installing Bubblewrap 0.9.0 (user and network namespaces succeed) and running cloud remote parsing against that clean public git config. The same sandbox and cloud remote tests also passed on unchanged upstream main (b6a49d01c1).

Previous run: package and repository typechecks passed, and lint reported 0 errors. Changeset: .changeset/skill-duplicate-order.md (@kilocode/cli patch).

Reviewer test steps

  1. Place the same skill name in two directories under one scanned root.
  2. Load skills twice and confirm the lexicographically later path is the one in <available_skills>.
  3. Place that same name in a later root, such as .agents/skills after .claude/skills, and confirm the later root still wins.

Blocked checks and substitute verification

None. The earlier sandbox and cloud-remote failures were environment limits. Bubblewrap is installed, and cloud remote parsing was run from a public checkout without URL rewriting. Sandbox checks were not weakened.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

This pull request was prepared with AI assistance. The personal-review item is unchecked because a person did not review the diff.

Get in Touch

@github-actions github-actions Bot added area:cli CLI, TUI and core engine community Opened by someone outside the Kilo team needs-triage Waiting for a maintainer to look priority:p1 High: fixes and regressions. Set from the title. Change by hand. labels Nov 9, 2026
import { TestInstance } from "../fixture/fixture"
import { testEffect } from "../lib/effect"

const it = testEffect(Layer.mergeAll(AppNodeBuilder.build(Skill.node), AppNodeBuilder.build(CrossSpawnSpawner.node)))

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.

[SUGGESTION]: Pin RuntimeFlags for this test

Sibling skill tests (worktree-project-skills.test.ts:19-22, non-git-global-skills.test.ts:18-22) explicitly override RuntimeFlags with disableExternalSkills: false, disableClaudeCodeSkills: false. This test relies on the env-based defaults, so a machine/CI that sets KILO_DISABLE_CLAUDE_CODE, KILO_DISABLE_CLAUDE_CODE_SKILLS, or KILO_DISABLE_EXTERNAL_SKILLS would stop .claude/.agents skills from being scanned and fail the test. Consider building Skill.node with those overrides for parity.

@kilo-code-bot

kilo-code-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The incremental change pins RuntimeFlags for the duplicate-order test, matching the sibling skill tests and resolving the earlier suggestion. Same-root sorting in packages/opencode/src/skill/index.ts:187 remains intact with root precedence preserved.

Files Reviewed (3 files)
  • .changeset/skill-duplicate-order.md
  • packages/opencode/src/skill/index.ts
  • packages/opencode/test/kilocode/skill-duplicate-order.test.ts
Previous Review Summary (commit eea779d)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit eea779d)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/test/kilocode/skill-duplicate-order.test.ts 11 Test relies on env-based RuntimeFlags defaults instead of pinning disableExternalSkills/disableClaudeCodeSkills, unlike sibling skill tests.
Files Reviewed (3 files)
  • .changeset/skill-duplicate-order.md - 0 issues
  • packages/opencode/src/skill/index.ts - 0 issues (per-root matches.sort() correctly gives a stable winner within a root while preserving root precedence via map insertion order)
  • packages/opencode/test/kilocode/skill-duplicate-order.test.ts - 1 suggestion

Fix these issues in Kilo Cloud


Reviewed by deepseek-flash-latest · Input: 29.7K · Output: 2.1K · Cached: 228.6K

Review guidance: REVIEW.md from base branch main

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli CLI, TUI and core engine community Opened by someone outside the Kilo team needs-triage Waiting for a maintainer to look priority:p1 High: fixes and regressions. Set from the title. Change by hand.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skill list in the system prompt is non-deterministic when a skill name exists in two directories (breaks prompt caching on every turn)

1 participant