turn: keep the body written before a trailing outcome
ParseOutput returned only the text after the outcome value, so a stage that wrote its result first and "# outcome" last handed the next stage "(no output)" — the probe's Compose and Critique turns were both lost this way. The body is now the whole document with just the outcome heading and value line removed, in order, byte for byte. Tests cover a trailing and a mid-document outcome.
This commit is contained in:
@@ -47,9 +47,11 @@ Files written by a failed visit are not carried or attributed to a later turn.
|
||||
## Outcome-only output contract
|
||||
|
||||
A turn's `output.md` must contain exactly one outcome section and may contain any
|
||||
markdown before or after it. The outcome section is an ATX heading named
|
||||
`outcome` (any level) followed by the first non-blank line, which must be exactly
|
||||
one of the stage's allowed outcome words:
|
||||
markdown before or after it. The body handed to the next turn is the document
|
||||
with only that heading and its value line removed, so a result written first and
|
||||
an outcome written last keeps the whole result. The outcome section is an ATX
|
||||
heading named `outcome` (any level) followed by the first non-blank line, which
|
||||
must be exactly one of the stage's allowed outcome words:
|
||||
|
||||
```md
|
||||
## outcome
|
||||
@@ -61,9 +63,9 @@ The rest of the output is the body, preserved verbatim.
|
||||
```
|
||||
|
||||
Matching trims whitespace and compares case-insensitively, returning the
|
||||
canonical allowed spelling. Text before the heading is ignored. Headings and
|
||||
words inside fenced code blocks (triple backticks or tildes) are ignored, so a
|
||||
diff or code sample cannot add a false outcome. Missing, duplicate, empty, or
|
||||
canonical allowed spelling. Text before the heading is never mistaken for the
|
||||
outcome value. Headings and words inside fenced code blocks (triple backticks or
|
||||
tildes) are ignored, so a diff or code sample cannot add a false outcome. Missing, duplicate, empty, or
|
||||
unknown outcomes are explicit errors; the parser never guesses, repairs the
|
||||
text, or looks for any other section.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user