From a114f638ef3d5d15074cda00bdf95370768fa367 Mon Sep 17 00:00:00 2001 From: openhands Date: Sun, 15 Mar 2026 12:51:59 +0000 Subject: [PATCH] fix: planner validates bullet output, rejects meta-commentary Sonnet sometimes narrates what it did instead of outputting the actual STATE.md. Added validation that first line starts with '- ' and strengthened the output-only instruction. --- planner/planner-agent.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/planner/planner-agent.sh b/planner/planner-agent.sh index 2595e9f..a7e8dc0 100755 --- a/planner/planner-agent.sh +++ b/planner/planner-agent.sh @@ -92,7 +92,7 @@ Update STATE.md by merging the new commits/issues into the existing snapshot. - No more than 30 bullet points — be concise and factual - If current STATE.md is empty, build the snapshot from scratch using the git log and issues -Output ONLY the bullet list — no preamble, no markdown fences, no explanation." +IMPORTANT: Output ONLY the updated bullet list. No summary of changes, no meta-commentary, no preamble, no markdown fences, no explanation of what you did. Just the bullets starting with '- '." PHASE1_OUTPUT=$(timeout "$CLAUDE_TIMEOUT" claude -p "$PHASE1_PROMPT" \ --model sonnet \ @@ -106,6 +106,12 @@ Output ONLY the bullet list — no preamble, no markdown fences, no explanation. 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)" + exit 1 + fi + # Atomic write TEMP_STATE=$(mktemp "${STATE_FILE}.XXXXXX") printf '%s\n' "$PHASE1_OUTPUT" > "$TEMP_STATE"