Skip to content

fix(skills): surface invalid SKILL.md files with their skip reasons - #3680

Open
liukx0205 wants to merge 2 commits into
mainfrom
fix/invalid-skill-visibility
Open

fix(skills): surface invalid SKILL.md files with their skip reasons#3680
liukx0205 wants to merge 2 commits into
mainfrom
fix/invalid-skill-visibility

Conversation

@liukx0205

@liukx0205 liukx0205 commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

Fixes #3673

Problem

A SKILL.md missing frontmatter, with invalid YAML, or missing required fields fails parsing during discovery, but the failure was only recorded as a warn log line — and the daemon defaults to Logs: off, so users see nothing. A broken skill file looks exactly like a hot-reload no-op.

Root cause: both discovery implementations (FileSkillDiscovery.parseAndRegister, RuntimeSkillDiscovery.register) only recorded UnsupportedSkillTypeError in the skipped list that flows into the catalog (recordSkipped / getSkippedByPolicy); SkillParseError went to the log only. And even the recorded skips had no user-visible outlet: the session/workspace skill-list endpoints returned only valid skills.

What changed

  • agent-core-v2: both skill discovery implementations now record SkillParseError failures in the discovery result's skipped list ({ path, type: 'invalid', reason }), alongside the existing warning. These entries already flow through the workspace catalog into the session catalog via the existing recordSkipped chain.
  • kap-server: the session (GET /api/v1/sessions/{id}/skills) and workspace (GET /api/v1/workspaces/{id}/skills) skill-list responses gain an invalid_skills array ({ path, type, reason }), sourced from getSkippedByPolicy() for sessions and from the discovery results for the workspace preview. Clients (e.g. the desktop app) can now show exactly which file failed and why.
  • Tests: discovery records all three failure kinds (missing frontmatter / invalid YAML / missing required field) with path and reason (agent-core-v2); both endpoints return invalid_skills with file name + reason (kap-server).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: the issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Skill discovery recorded only unsupported-type skips; parse failures
(missing frontmatter, invalid YAML, missing required fields) were logged
as warnings that daemon users never see, so a broken SKILL.md looked
exactly like a hot-reload no-op.

Record parse failures as skipped entries (path, type, reason) in both
discovery implementations and expose them as invalid_skills in the
session and workspace skill-list responses.

Fixes #3673
@changeset-bot

changeset-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c58d574

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 9, 2026

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

commit: c58d574

@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: 774dac7f27

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kap-server/src/routes/skills.ts
normalizeMetadata only overrode metadata.type when it was a non-empty
string, so a SKILL.md with type: 123 or type: {} kept the raw YAML
value, UnsupportedSkillTypeError stored it in skillType, and the
number/object leaked into the invalid_skills listing response where
invalidSkillSchema requires a string, breaking strict consumers.

Reject the skill with a stringified type label instead and cover the
session listing path with a schema-parsing regression test.
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.

Invalid SKILL.md silently skipped — surface the parse error to users

1 participant