fix(config): parse markdown prompt file blocks as prompts#12610
Open
rodboev wants to merge 1 commit into
Open
Conversation
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.
Fixes #12412
Summary
Markdown files referenced from
config.yamlpromptsblocks are currently resolved but then dropped, because markdown fallback parsing always wraps the file as a rule. This changes block unrolling so markdown files resolved for thepromptssection become prompt blocks instead.Root cause
packages/config-yaml/src/load/unroll.ts:436-441resolvesusesblocks and then reads the array for the current section, such asblockConfigYaml.prompts. ButresolveBlockparses markdown fallback content throughparseMarkdownRuleOrAssistantUnrolled, andparseYamlOrMarkdownRuleatunroll.ts:798-802always wraps markdown as{ rules: [...] }. For apromptsblock, that leavesblockConfigYaml.promptsundefined, so the prompt is silently skipped.Changes
packages/config-yaml/src/markdown/parseMarkdownPrompt.ts: add a small markdown prompt parser that preserves frontmatter name, description, prompt body, and source file.packages/config-yaml/src/markdown/index.ts: export the prompt parser.packages/config-yaml/src/load/unroll.ts: pass the target section into resolved block parsing and wrap markdown prompt files underprompts.packages/config-yaml/src/load/unroll.test.ts: cover markdown prompt block unrolling and existing markdown rule fallback.What this doesn't change
This does not change YAML prompt blocks, injected blocks, or local prompt-file discovery in
core/config/yaml/loadYaml.ts. It also keeps markdown fallback as rules for non-promptssections.Checklist
Screen recording or screenshot
N/A, no UI change.
Tests
cd packages/config-yaml && npm test -- src/load/unroll.test.ts— blocked before this test file executes by existingTS7006diagnostics insrc/converter.tson unchangedorigin/mainlines.cd packages/config-yaml && cross-env NODE_OPTIONS=--experimental-vm-modules npx jest src/load/unroll.test.ts --globals '{"ts-jest":{"diagnostics":false}}'— 30/30 passing. Covers markdown prompt block unrolling, frontmatter parsing, filename fallback, source file propagation, and unchanged markdown rule fallback.Summary by cubic
Parse markdown files referenced in
config.yamlpromptsblocks as prompts instead of rules, so referenced prompts are no longer dropped. Non-promptsmarkdown fallbacks still parse as rules.promptsby passing a section hint throughunroll.ts.parseMarkdownPromptand exported frompackages/config-yaml/src/markdown/index.tsto keep name, description, body, andsourceFile.packages/config-yaml/src/load/unroll.test.tscover prompt parsing, filename fallback, source propagation, and unchanged rule fallback.Written for commit ca4e36a. Summary will update on new commits.