Skip to content

fix(skill): ignore complex YAML frontmatter to prevent parsing errors#1043

Open
jujn wants to merge 2 commits intoagentscope-ai:mainfrom
jujn:fix_1030
Open

fix(skill): ignore complex YAML frontmatter to prevent parsing errors#1043
jujn wants to merge 2 commits intoagentscope-ai:mainfrom
jujn:fix_1030

Conversation

@jujn
Copy link
Contributor

@jujn jujn commented Mar 25, 2026

Description

Close #1030

This PR updates the internal SimpleYamlParser to gracefully skip unsupported block-style complex structures (like lists or nested objects) instead of throwing exceptions.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@jujn jujn requested review from a team and Copilot March 25, 2026 14:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes MarkdownSkillParser more tolerant of complex/invalid YAML frontmatter by skipping unsupported lines instead of throwing, so skills with non-flat frontmatter won’t block loading.

Changes:

  • Updated SimpleYamlParser to skip non-key: value YAML lines and avoid throwing on unsupported structures.
  • Added/updated unit tests to assert “graceful ignore” behavior for invalid lines and list-style YAML in frontmatter.
  • Adjusted empty-value generation/parsing expectations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
agentscope-core/src/main/java/io/agentscope/core/skill/util/MarkdownSkillParser.java Makes YAML parsing tolerant by skipping unsupported lines/structures and adds debug logging.
agentscope-core/src/test/java/io/agentscope/core/skill/util/MarkdownSkillParserTest.java Updates tests to validate non-throwing behavior and adds a complex-frontmatter parsing scenario.

@codecov
Copy link

codecov bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...gentscope/core/skill/util/MarkdownSkillParser.java 86.66% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@jujn
Copy link
Contributor Author

jujn commented Mar 27, 2026

@fang-tech PTAL Thanks.

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.

[Bug]: Agent SKILL.md parser fails for non-strings frontmatter, blocks loading of the skill

2 participants