From 725a26ba8888b41d7bb85443d2b6cf22a365d675 Mon Sep 17 00:00:00 2001 From: isExample Date: Sat, 11 Oct 2025 02:05:55 +0900 Subject: [PATCH] docs: add inline comments explaining diff marker normalization logic --- pr_agent/algo/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index 6e8fd7f2..0bdd1f1e 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -877,14 +877,18 @@ def try_fix_yaml(response_text: str, response_text_lines_copy[i] = ' ' + line[1:] modified = True + # normalize lines starting with '-'. Distinguish real YAML list items from diff deletions. for i, line in enumerate(response_text_lines_copy): if not line.startswith('-'): continue + remainder = line[1:] if line.startswith('- '): second_char = remainder[1] if len(remainder) > 1 else '' if second_char and second_char not in (' ', '\t', '+', '-'): - continue + continue # real list item → keep as-is + + # treat it as a diff "removed" marker inside block content cleaned = remainder while cleaned and cleaned[0] in ('+', '-'): cleaned = cleaned[1:]