From 5c6293fdab595fb872ddaec2ce366f135025c5a0 Mon Sep 17 00:00:00 2001 From: openhands Date: Sun, 15 Mar 2026 15:02:53 +0000 Subject: [PATCH] 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. --- planner/planner-agent.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/planner/planner-agent.sh b/planner/planner-agent.sh index 37f5113..d7c72cb 100755 --- a/planner/planner-agent.sh +++ b/planner/planner-agent.sh @@ -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