Skip to content

.NET: Fix YAML block scalar parsing for file skills#5610

Merged
SergeyMenshykh merged 2 commits intomicrosoft:mainfrom
tejakusireddy:fix-dotnet-yaml-block-scalar
May 5, 2026
Merged

.NET: Fix YAML block scalar parsing for file skills#5610
SergeyMenshykh merged 2 commits intomicrosoft:mainfrom
tejakusireddy:fix-dotnet-yaml-block-scalar

Conversation

@tejakusireddy
Copy link
Copy Markdown
Contributor

Motivation and Context

Fixes the .NET file skill loader portion of #5586.

SKILL.md frontmatter currently parses YAML block scalar values like description: | or description: > as only the scalar indicator (| / >) instead of the multiline content.

Description

This PR updates the .NET file skill loader to parse YAML block scalar values in frontmatter.

Changes:

  • Supports literal scalars: |, |-, |+
  • Supports folded scalars: >, >-, >+
  • Strips common indentation from block content
  • Preserves newlines for literal scalars
  • Folds lines with spaces for folded scalars
  • Adds regression coverage in FileAgentSkillLoaderTests

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contributing Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? No

Validation:

  • dotnet build ./dotnet/tests/Microsoft.Agents.AI.UnitTests/Microsoft.Agents.AI.UnitTests.csproj
  • FileAgentSkillLoaderTests: 79/79 passed
  • Microsoft.Agents.AI.UnitTests net10.0 assembly: 1459/1459 passed

Copilot AI review requested due to automatic review settings May 2, 2026 18:35
@moonbox3 moonbox3 added the .NET label May 2, 2026
@github-actions github-actions Bot changed the title Fix YAML block scalar parsing for file skills .NET: Fix YAML block scalar parsing for file skills May 2, 2026
Copy link
Copy Markdown
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 fixes .NET SKILL.md frontmatter parsing so YAML block scalar values (e.g., description: | / description: >) are parsed as multiline content instead of just the scalar indicator, addressing issue #5586.

Changes:

  • Updates the .NET file skill loader to detect block scalar indicators and read indented continuation lines.
  • Normalizes indentation and applies basic literal (|) vs folded (>) joining behavior.
  • Adds unit tests covering literal, folded, and chomping-indicator variants.

Reviewed changes

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

File Description
dotnet/src/Microsoft.Agents.AI/Skills/File/AgentFileSkillsSource.cs Adds block-scalar-aware parsing when extracting frontmatter scalar values.
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/FileAgentSkillLoaderTests.cs Adds regression tests for parsing multiline description values from YAML block scalars.

Comment thread dotnet/src/Microsoft.Agents.AI/Skills/File/AgentFileSkillsSource.cs
Comment thread dotnet/src/Microsoft.Agents.AI/Skills/File/AgentFileSkillsSource.cs Outdated
Comment thread dotnet/src/Microsoft.Agents.AI/Skills/File/AgentFileSkillsSource.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants