From 66131854c1214343afdcc74ea8a0e1f4ded6c77d Mon Sep 17 00:00:00 2001 From: joosomi Date: Sat, 24 May 2025 03:04:59 +0900 Subject: [PATCH] fix: avoid incorrect ToDo header --- pr_agent/algo/utils.py | 2 +- pr_agent/settings/pr_reviewer_prompts.toml | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index ba55f938..93fe7e02 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -154,7 +154,7 @@ def convert_to_markdown_v2(output_data: dict, for key, value in output_data['review'].items(): if value is None or value == '' or value == {} or value == []: - if key.lower() not in ['can_be_split', 'key_issues_to_review', 'todo_sections']: + if key.lower() not in ['can_be_split', 'key_issues_to_review']: continue key_nice = key.replace('_', ' ').capitalize() emoji = emojis.get(key_nice, "") diff --git a/pr_agent/settings/pr_reviewer_prompts.toml b/pr_agent/settings/pr_reviewer_prompts.toml index 87cbbc06..cfe63562 100644 --- a/pr_agent/settings/pr_reviewer_prompts.toml +++ b/pr_agent/settings/pr_reviewer_prompts.toml @@ -108,7 +108,7 @@ class Review(BaseModel): security_concerns: str = Field(description="Does this PR code introduce possible vulnerabilities such as exposure of sensitive information (e.g., API keys, secrets, passwords), or security concerns like SQL injection, XSS, CSRF, and others ? Answer 'No' (without explaining why) if there are no possible issues. If there are security concerns or issues, start your answer with a short header, such as: 'Sensitive information exposure: ...', 'SQL injection: ...' etc. Explain your answer. Be specific and give examples if possible") {%- endif %} {%- if require_todo_scan %} - todo_sections: List[TodoSection] = Field(description="A list of TODO comments found in the code. Return an empty list if there are no TODO comments.") + todo_sections: Union[List[TodoSection], str] = Field(description="A list of TODO comments found in the code. Return 'No' (as a string) if there are no TODO comments.") {%- endif %} {%- if require_can_be_split_review %} can_be_split: List[SubPR] = Field(min_items=0, max_items=3, description="Can this PR, which contains {{ num_pr_files }} changed files in total, be divided into smaller sub-PRs with distinct tasks that can be reviewed and merged independently, regardless of the order ? Make sure that the sub-PRs are indeed independent, with no code dependencies between them, and that each sub-PR represent a meaningful independent task. Output an empty list if the PR code does not need to be split.") @@ -157,11 +157,7 @@ review: security_concerns: | No todo_sections: - - relevant_file: | - src/file1.py - line_number: 13 - content: | - ... + No {%- if require_can_be_split_review %} can_be_split: - relevant_files: @@ -281,11 +277,7 @@ review: security_concerns: | No todo_sections: - - relevant_file: | - ... - line_number: ... - content: | - ... + No {%- if require_can_be_split_review %} can_be_split: - relevant_files: