Fix YAML indentation bug in AI prompt template substitution - #592
Merged
dblock merged 1 commit intoAug 12, 2026
Merged
Conversation
actions/ai-inference@v1 substitutes {{var}} placeholders as raw text
into the prompt YAML file before parsing it as YAML. Since the diff/
diff-stat files started at column 0, injecting their multi-line
content broke the indentation of the enclosing `content: |-` block
scalar in changelog-entries.prompt.yml (which expects continuation
lines to be indented), causing "Failed to parse prompt file: bad
indentation of a mapping entry" at runtime, e.g.:
https://github.com/slack-ruby/slack-ruby-client/actions/runs/31552877245/job/93979138338
Indent every line of the diff/diff-stat files with 6 spaces (to
match the prompt file's block scalar indentation) before writing
them out, so the substituted content stays inside the block.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dblock
force-pushed
the
fix-ai-inference-yaml-indentation
branch
from
August 12, 2026 01:18
18a4e05 to
3d466cf
Compare
Danger ReportNo issues found. |
Coverage Report for CI Build 31553155612Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage remained the same at 91.055%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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.
Problem
The
update_api.ymlworkflow's new AI CHANGELOG generation step (#591) fails on the first real scheduled run:https://github.com/slack-ruby/slack-ruby-client/actions/runs/31552877245/job/93979138338
Root cause
actions/ai-inference@v1substitutes{{diff_stat}}/{{diff}}placeholders as raw text into the prompt YAML file before parsing it as YAML. The diff/diff-stat files were written starting at column 0, so injecting their multi-line content broke the indentation of the enclosingcontent: |-block scalar inchangelog-entries.prompt.yml.Fix
Pipe the diff/diff-stat output through
sed 's/^/ /'(6 spaces, matching the prompt file's block scalar indentation) before writing them to the files consumed viafile_input, so the substituted content stays inside the block and parses correctly.Verified by simulating the exact template substitution locally with
yaml.safe_loadafter applying the fix.