Improve OpenClaw DX validation and summary sanitization#179
Conversation
| if [[ -n "$fragment" && ( "$line" == "- "* || "$line" == "• "* ) ]]; then | ||
| line="$(trim_line "$line $fragment")" | ||
| if [[ "$line" == *":" ]]; then | ||
| if [[ -z "$candidate" ]]; then | ||
| candidate="$line" | ||
| fi | ||
| continue | ||
| fi | ||
| printf '%s' "$line" | ||
| return | ||
| fi |
There was a problem hiding this comment.
🟡 Fragment variable not cleared after bullet combination causes stale fragment to leak to subsequent bullets
In extract_delta_summary_candidate, when a wrapped fragment is combined with a bullet line and the result ends with :, the fragment variable is never cleared. On subsequent iterations, the same stale fragment is incorrectly combined with earlier bullets (processed in reverse order), corrupting them into :-ending lines that get skipped instead of returned.
Root Cause and Impact
The combining block at skills/amux/scripts/openclaw-step.sh:390-400 combines $fragment with a bullet, but only clears the fragment implicitly via return (line 399). When the combined line ends with :, the function continues (line 396) without clearing fragment. On the next loop iteration, if the next line is also a bullet, the stale fragment is re-appended.
For example, given this reversed input:
wrapped_fragment): detail:
- Second bullet:
- Added file.md with description
With the bug: Step 3 combines - Added file.md with description with the stale fragment → - Added file.md with description wrapped_fragment): detail: which ends with : → skipped. The function falls back to a worse candidate.
Without the bug (fragment cleared): Step 3 processes - Added file.md with description on its own → contains .md, not file-only, doesn't end with : → printed as the summary.
Impact: Good summary bullets containing file references are silently skipped in favor of lower-quality fragment text whenever a preceding bullet+fragment combination ends with :.
| if [[ -n "$fragment" && ( "$line" == "- "* || "$line" == "• "* ) ]]; then | |
| line="$(trim_line "$line $fragment")" | |
| if [[ "$line" == *":" ]]; then | |
| if [[ -z "$candidate" ]]; then | |
| candidate="$line" | |
| fi | |
| continue | |
| fi | |
| printf '%s' "$line" | |
| return | |
| fi | |
| if [[ -n "$fragment" && ( "$line" == "- "* || "$line" == "• "* ) ]]; then | |
| line="$(trim_line "$line $fragment")" | |
| fragment="" | |
| if [[ "$line" == *":" ]]; then | |
| if [[ -z "$candidate" ]]; then | |
| candidate="$line" | |
| fi | |
| continue | |
| fi | |
| printf '%s' "$line" | |
| return | |
| fi |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Describe the change and intended behavior.
Quality Checklist
make devchecklocally.make lint-strict-newlocally for changed code.make harness-presets.go test ./internal/tmux ./internal/e2e.