Fix trailing whitespace
Truncate messages with excessive duplicate lines
Enforce line limit in format_reply