fix: strip non-bullet preamble from planner output

Sonnet prepends narration before the actual bullets. Strip everything
before the first '- ' line instead of rejecting the whole output.
This commit is contained in:
openhands 2026-03-15 15:02:53 +00:00
parent af75c0eccf
commit 5c6293fdab

View file

@ -124,9 +124,12 @@ Your response must start with '- ' on the very first character. No summary, no m
exit 1
fi
# Validate output starts with bullet points (reject meta-commentary)
if ! echo "$PHASE1_OUTPUT" | head -1 | grep -q '^- '; then
log "ERROR: phase 1 output is not a bullet list — got: $(echo "$PHASE1_OUTPUT" | head -1)"
# Strip any non-bullet preamble (Sonnet sometimes narrates before the bullets)
PHASE1_OUTPUT=$(echo "$PHASE1_OUTPUT" | sed -n '/^- /,$p')
# Validate output has bullet points
if [ -z "$PHASE1_OUTPUT" ] || ! echo "$PHASE1_OUTPUT" | head -1 | grep -q '^- '; then
log "ERROR: phase 1 output contains no bullet list"
exit 1
fi