Skip to content

fix(skill): resolve a skill name clash the same way on every load - #72

Closed
kevoconnell wants to merge 1 commit into
devfrom
kevin/skills-deterministic-order
Closed

kevoconnell wants to merge 1 commit into
devfrom
kevin/skills-deterministic-order

Conversation

@kevoconnell

@kevoconnell kevoconnell commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Issue for this PR

REPL-35247

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Replo sandboxes load skills from two folders: a person's own skills and their project's team skills. When both hold a skill with the same name, the person's own should win. Today the winner is random.

Two things caused that:

  1. loadSkills parsed and registered every SKILL.md concurrently. Each one wrote state.skills[name] when its parse finished, so the slower file won.
  2. In the sandbox, a person's skills sit in opencode's global ~/.agents/skills and the project's team skills in its project folder (OPENCODE_CONFIG_DIR=/workspace/.opencode, so .opencode/skills). opencode reads the global folders first, so in discovery order the team skill comes later and would win. Our opencode.json lists ~/.agents/skills again in skills.paths to put the person's folder last, but the matches set kept a file's first position, so listing it again changed nothing.

The fix:

  • Parse in parallel as before, then register the results in discovery order, so the same files always resolve the same way.
  • When a scan finds a file again, move it to its latest position. With skills.paths listing the personal folder, the personal skill is registered last and wins.

The "duplicate skill name" warning is unchanged.

How did you verify your code works?

  • A new test in test/skill/skill.test.ts puts brand-voice in .opencode/skills and in team/, with skills.paths: ["team", ".opencode/skills"], and expects the personal copy. It fails on dev (3 of 3 runs) and passes with the fix.
  • bun test test/skill/: 26 pass, 0 fail.
  • bun run typecheck is clean.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

🤖 Generated with Claude Code


Summary by cubic

Fixes skill name clashes so the personal skill always wins over a same-named team skill, instead of the winner being random on each load.

  • Parses in parallel but registers results in discovery order, so the same files always resolve the same way.
  • Moves a file found again during scanning to its latest source, so the source listed last in skills.paths wins.
  • Adds a test that verifies the personal copy of a clashing skill wins.

Written for commit 2e0371f. Summary will update on new commits.

View guided diff Turn on auto-fix

Skills were parsed and registered concurrently, so when two folders held a
skill with the same name, whichever file finished parsing last won. Parse in
parallel but register in discovery order, and move a file found again to its
latest source, so the skills path listed last always wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

The following comment was made by an LLM, it may be inaccurate:

@kevoconnell

Copy link
Copy Markdown
Member Author

Closing: replohq/andytown#31715 now keeps each skill name in one folder (sharing moves a skill, and a new skill can't reuse a project skill's name), so the clash order no longer needs a fork change.

@kevoconnell kevoconnell closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant