feat(skill): add YAML auto-repair for unquoted colons in frontmatter#1443
Open
hexly666 wants to merge 4 commits into
Open
feat(skill): add YAML auto-repair for unquoted colons in frontmatter#1443hexly666 wants to merge 4 commits into
hexly666 wants to merge 4 commits into
Conversation
Enhance MarkdownSkillParser to automatically repair YAML frontmatter containing unquoted colon-space patterns in scalar values. When SnakeYAML fails to parse, the parser now attempts to quote problematic values before giving up. Refs agentscope-ai#1442
|
helm30 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
added 3 commits
May 19, 2026 23:56
…repair Add 14 new test cases to cover missing branches in the YAML auto-repair logic introduced in the previous commit: - testKeyWithSpaceNotRepaired: covers repair skipping keys with spaces - testColonAtLineStart: covers firstColon == 0 branch - testColonAtLineEnd: covers line.length() == firstColon + 1 branch - testColonNoSpaceAfter: covers URL values without ': ' pattern - testEmptyValueNoQuoting: covers empty trimmed value in needsQuoting - testColonsWithoutSpaces: covers colons without space after - testMultipleLinesMixedQuoting: covers mixed quoted/unquoted values - testRepairWithDoubleQuotes: covers double quote escaping during repair - testRepairWithBackslash: covers backslash escaping during repair - testRepairStillFailsAfterQuoting: covers repair retry failure path - testYamlParsesToNull: covers loaded == null branch - testNonMapTopLevelYaml: covers non-map top-level YAML branch Tests: 58 total (44 + 14 new), all passing. Refs agentscope-ai#1442
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhance MarkdownSkillParser to automatically repair YAML frontmatter containing unquoted colon-space patterns in scalar values. When SnakeYAML fails to parse, the parser now attempts to quote problematic values before giving up.
Closes #1442
AgentScope-Java Version
[The version of AgentScope-Java you are working on, e.g. 1.0.12, check your pom.xml dependency version or run
mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]Description
When parsing YAML frontmatter in Markdown skill files, SnakeYAML fails to parse scalar values that contain unquoted colon-space patterns (: ). For example:
YAML interprets the : after node as a new key-value separator, causing a parsing error. This results in the entire frontmatter being rejected and metadata being lost.
I added an auto-repair mechanism to the MarkdownSkillParser that activates when SnakeYAML fails to parse the frontmatter:
Detection: On parse failure, the parser examines the raw YAML content for lines containing unquoted : patterns within scalar values.
Repair: It wraps problematic values in double quotes, escaping internal quotes and backslashes:
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)