Skip to content

fix(yaml): pin goose recipe prompt block-scalar indentation#3343

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/goose-yaml-indent-block-scalar
Open

fix(yaml): pin goose recipe prompt block-scalar indentation#3343
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/goose-yaml-indent-block-scalar

Conversation

@Quratulain-bilal

@Quratulain-bilal Quratulain-bilal commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

fixes #3342

the goose recipe renderer wrote the prompt body under a bare | block scalar. yaml infers a plain block scalar's indentation from its first non-empty line, so a command body whose first line is itself indented (a markdown code block, a nested list item) made the parser expect that deeper indent for the whole block and reject the later, shallower lines. the generated .goose recipe then failed to parse. a plain body was unaffected, which is why the existing fixtures didn't catch it.

the fix uses an explicit |2 indentation indicator so the block is always read at 2 spaces regardless of what the body looks like. the body is already emitted at a fixed 2-space indent, so this just tells the parser what the renderer already does.

added a regression test (test_yaml_prompt_with_indented_first_line_stays_valid) that round-trips an indented-first-line body through the yaml parser. i confirmed it fails on the pre-fix code by stashing the source and re-running, and the full goose/yaml suites pass with the fix.

the goose recipe renderer emitted the prompt body under a bare '|' block
scalar. yaml infers a plain block scalar's indentation from its first
non-empty line, so a command body whose first line is itself indented (a
markdown code block, a nested list item) made the parser expect that deeper
indent for the whole block and reject the later, shallower lines - the
generated .goose recipe then failed to parse.

use an explicit '|2' indentation indicator so the block is always read at
2 spaces regardless of the body. added a regression test that round-trips
an indented-first-line body through the yaml parser.
@Quratulain-bilal Quratulain-bilal requested a review from mnriem as a code owner July 5, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

goose recipe with an indented first prompt line generates unparseable yaml

1 participant