The truncate_for_display() function now takes only the first line of input before truncating. This prevents multi-line error messages (like str_replace failures) from breaking the compact single-line format. Added tests for multi-line input handling.