Skip to content

fix(agent-core): surface skill parse failures as session warnings#2046

Open
Fromsko wants to merge 1 commit into
MoonshotAI:mainfrom
Fromsko:fix/skill-load-warning
Open

fix(agent-core): surface skill parse failures as session warnings#2046
Fromsko wants to merge 1 commit into
MoonshotAI:mainfrom
Fromsko:fix/skill-load-warning

Conversation

@Fromsko

@Fromsko Fromsko commented Jul 22, 2026

Copy link
Copy Markdown

Related Issue

Resolve #1972

Problem

A skill file that fails to parse at session start (malformed YAML frontmatter, missing required name/description fields, or an unsupported type) is silently dropped — it does not appear in the skill list and no warning or error is emitted. The only way to discover the failure is to notice the skill is missing and bisect the frontmatter by hand.

The reporter observed that long description values triggered the drop and assumed a length limit, but the real trigger is that longer plain-scalar descriptions are more likely to contain a character sequence that breaks YAML parsing (e.g. a ": " inside the value). Quoting the description fixes it because it becomes a valid YAML quoted scalar — confirming the root cause is a swallowed parse failure, not a length cap.

Two code defects caused the silence:

  1. SessionSkillRegistry is constructed without an onWarning callback, so the default no-op () => {} is used. The skill scanner catches SkillParseError and forwards it to warn(...), but that call goes nowhere.
  2. Session.getSession.getSessionWarnings() only checks the AGENTS.md size warning and never reads the skill layer, so even if warnings were collected they would never reach the TUI.

What changed

  • SessionSkillRegistry now collects skill parse failures into an internal warnings list (new getLoadWarnings() method), in addition to still forwarding to the optional external onWarning callback. This means every SessionSkillRegistry instance — including the live session one that previously passed no callback — captures load failures.
  • Session.getSessionWarnings() now awaits skillsReady (so discovery has completed) and surfaces each collected skill warning with code: "skill-load-failed". The TUI already polls getSessionWarnings() and renders each entry on the status line, so the warning is now visible to the user naming the offending file.

No changes to the TUI are needed — the existing showSessionWarnings path picks up the new warnings automatically. Unsupported skill types (a deliberate skip, not a failure) are intentionally excluded, matching the existing agents-md-oversized warning style.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • 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.

A skill file that fails to parse (malformed YAML frontmatter, missing
required fields, unsupported type) was silently dropped during session
start with no user-visible feedback. The SessionSkillRegistry did not
wire its onWarning callback, and getSessionWarnings only checked the
AGENTS.md size warning, so skill load failures never reached the TUI.

SessionSkillRegistry now collects parse failures into a warnings list
alongside the existing onWarning callback, and getSessionWarnings
surfaces them with code 'skill-load-failed' so the TUI status line
names the offending file.

Fixes MoonshotAI#1972
@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 36a4ff9

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

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/agent-core Patch
@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

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.

Skill silently dropped when description exceeds length limit — no warning or error

1 participant