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.
This commit is contained in:
openhands 2026-03-15 12:51:59 +00:00
parent 4b95d32a0c
commit a114f638ef

View file

@ -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"