Skip to content

Commit 725a26b

Browse files
committed
docs: add inline comments explaining diff marker normalization logic
1 parent 1a4df62 commit 725a26b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pr_agent/algo/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,14 +877,18 @@ def try_fix_yaml(response_text: str,
877877
response_text_lines_copy[i] = ' ' + line[1:]
878878
modified = True
879879

880+
# normalize lines starting with '-'. Distinguish real YAML list items from diff deletions.
880881
for i, line in enumerate(response_text_lines_copy):
881882
if not line.startswith('-'):
882883
continue
884+
883885
remainder = line[1:]
884886
if line.startswith('- '):
885887
second_char = remainder[1] if len(remainder) > 1 else ''
886888
if second_char and second_char not in (' ', '\t', '+', '-'):
887-
continue
889+
continue # real list item → keep as-is
890+
891+
# treat it as a diff "removed" marker inside block content
888892
cleaned = remainder
889893
while cleaned and cleaned[0] in ('+', '-'):
890894
cleaned = cleaned[1:]

0 commit comments

Comments
 (0)