diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 56391c53..c0ba2b68 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -761,8 +761,8 @@ class PRDescription: @staticmethod def clean_title(title: str) -> str: - """Clean the PR title by stripping whitespace and replacing newlines with spaces.""" - return title.strip().replace('\n', ' ') + """Clean the PR title by normalizing all whitespace to a single space and stripping leading/trailing spaces.""" + return re.sub(r'\s+', ' ', title.strip()) def count_chars_without_html(string):