Preserve inline sub-agent frontmatter during extraction#39577
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
model: frontmatter during extraction
|
@copilot the entire frontmatter should be preserved as is |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed in 952be38. Inline sub-agent extraction now preserves the entire authored frontmatter as-is, and the JS/Go coverage was updated to lock in that behavior. |
model: frontmatter during extractionThere was a problem hiding this comment.
Pull request overview
This PR updates inline sub-agent handling so authored YAML frontmatter blocks are preserved (rather than filtered) during extraction, and adjusts validation/tests to accept arbitrary sub-agent frontmatter as long as it remains parseable.
Changes:
- Remove runtime filtering of inline sub-agent frontmatter and keep emitted agent content intact.
- Relax Go sub-agent frontmatter validation to only warn on parse/extraction errors (not unknown keys).
- Add Go + JS regression tests to ensure nested YAML and field ordering are preserved.
Show a summary per file
| File | Description |
|---|---|
| pkg/parser/sub_agent_validation_test.go | Updates validation expectations to allow arbitrary sub-agent frontmatter and adds a malformed-frontmatter warning test. |
| pkg/parser/sub_agent_extractor.go | Removes unknown-field validation and validates only frontmatter parseability for inline sub-agents. |
| pkg/parser/sub_agent_extractor_test.go | Adds a regression test asserting extracted sub-agent content preserves the authored frontmatter block. |
| actions/setup/js/extract_inline_sub_agents.test.cjs | Updates JS tests to assert frontmatter is preserved (including order and nested YAML). |
| actions/setup/js/extract_inline_sub_agents.cjs | Removes frontmatter filtering logic and preserves agent content when writing extracted agent files. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 3
| "---", | ||
| "engine: copilot", | ||
| "on:", | ||
| " workflow_dispatch:", | ||
| "---", | ||
| `description: "unterminated string`, | ||
| "model: claude-haiku-4.5", | ||
| "Do work.", | ||
| }, "\n") |
| // - description: Human-readable description of the sub-agent's role. | ||
| // - model: AI model to use. Default is "inherited" (uses the parent | ||
| // workflow's model when not set). | ||
| // Sub-agent frontmatter is preserved exactly as authored. |
| // description Human-readable description of the sub-agent's role. | ||
| // model AI model to use. Default is "inherited" (uses the parent | ||
| // workflow's model when not set). | ||
| // Sub-agent frontmatter is preserved exactly as authored. |
|
@copilot run pr-finisher skill |
…omments Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done. Addressed all three open review threads in the latest commit:
Local |
Inline sub-agents can declare their own frontmatter, including
model:overrides and additional engine-specific fields. The extraction path should preserve that frontmatter exactly as authored instead of filtering unsupported keys or corrupting nested YAML.Runtime extractor fix
Regression coverage
tools:appears betweendescription:andmodel:.Parser coverage
Now extracts as: