Skip to content

fix(skill): don't register payload files beside a bundle's SKILL.md - #3741

Open
he-yufeng wants to merge 1 commit into
MoonshotAI:mainfrom
he-yufeng:fix/skill-bundle-payload-registration
Open

he-yufeng wants to merge 1 commit into
MoonshotAI:mainfrom
he-yufeng:fix/skill-bundle-payload-registration

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

What this PR does

When a plugin root is itself a bundle (its directory has its own SKILL.md), skill discovery no longer runs the flat top-level .md loop in that directory, so payload documents beside the bundle (the mattpocock-style GLOSSARY-FORMAT.md case from the legacy v1 scanner) stop being registered as standalone skills. Loose top-level .md files in a root that has no SKILL.md keep registering exactly as before, which the existing test for that shape still pins.

Why it's needed

Filed as #3740 with a reproduction on current main: discovering a root laid out as teach/SKILL.md plus teach/GLOSSARY-FORMAT.md returns both teach and a phantom GLOSSARY-FORMAT skill, where the v1 issue's expectation is just the bundle. The phantom entries pollute the skill catalog and can shadow real skills on name collision.

How to verify

Run the catalog suite: pnpm vitest run test/features/skill/catalog/. The new regression case lays out a plugin bundle root with a payload document and asserts only the bundle is discovered; the previously pinned flat-.md case (root without SKILL.md) still passes, as do all 240 tests across the skill and plugin suites.

Tested on

macOS, Node 24 (pnpm 10.33.0).

Linked Issues

Fixes #3740

@changeset-bot

changeset-bot Bot commented Sep 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ea36f09

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-13T15:08:28.306066Z ea36f09 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2a54f7024

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

skillDirName: skillName,
root,
});
if (!rootIsBundle) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Apply the bundle guard to runtime skill discovery

Workspace/session catalogs are built with RuntimeSkillDiscovery in program.ts, not this FileSkillDiscovery, and its top-level loop at runtimeSkillDiscovery.ts:142-158 still registers every sibling .md file after loading the root SKILL.md. Consequently, the reported plugin layout continues to expose GLOSSARY-FORMAT as a phantom skill during normal session use; mirror this guard in the runtime scanner (and cover that production path) as well.

Useful? React with 👍 / 👎.

A plugin root that is itself a bundle (it has its own SKILL.md) still
ran the flat top-level .md loop, so payload documents like
GLOSSARY-FORMAT.md were registered as standalone skills alongside the
bundle. Skip that loop when the root dir has its own SKILL.md; loose
top-level .md files in a root without one keep registering, matching
the existing pinned behavior.

Fixes MoonshotAI#3740
@he-yufeng
he-yufeng force-pushed the fix/skill-bundle-payload-registration branch from e2a54f7 to ea36f09 Compare September 13, 2026 15:05
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased: the branch was accidentally stacked on the unrelated #2581 head, which made the diff show 100 files. Now it is the single skill commit on current main (2 files, as intended). Content unchanged; fileSkillDiscovery suite 15/15 and the full skill feature directory 134/134 pass, check-no-comments clean.

@pkg-pr-new

pkg-pr-new Bot commented Sep 13, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@ea36f09
npx https://pkg.pr.new/@moonshot-ai/kimi-code@ea36f09

commit: ea36f09

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(skill): plugin bundle payload files are registered as standalone skills in v2 discovery

1 participant