From 5a8ce252f7397d4cfa5d13533e11fdbee616dcf5 Mon Sep 17 00:00:00 2001 From: Guber Tamas Date: Mon, 19 May 2025 16:16:23 +0200 Subject: [PATCH 1/2] Adding num_max_findings configuration parameter with a default value of 3, to have the possibility to extend it --- docs/docs/tools/review.md | 4 ++++ pr_agent/settings/configuration.toml | 1 + pr_agent/settings/pr_reviewer_prompts.toml | 2 +- pr_agent/tools/pr_reviewer.py | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/docs/tools/review.md b/docs/docs/tools/review.md index e5cc6b93..3245418eb 100644 --- a/docs/docs/tools/review.md +++ b/docs/docs/tools/review.md @@ -70,6 +70,10 @@ extra_instructions = "..." enable_help_text If set to true, the tool will display a help text in the comment. Default is true. + + num_max_findings + Number of maximum returned finding. Default is 3. + !!! example "Enable\\disable specific sub-sections" diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index ce097c95..c6437931 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -81,6 +81,7 @@ require_ticket_analysis_review=true # general options persistent_comment=true extra_instructions = "" +num_max_findings = 3 final_update_message = true # review labels enable_review_labels_security=true diff --git a/pr_agent/settings/pr_reviewer_prompts.toml b/pr_agent/settings/pr_reviewer_prompts.toml index a322b2b9..d4c0a523 100644 --- a/pr_agent/settings/pr_reviewer_prompts.toml +++ b/pr_agent/settings/pr_reviewer_prompts.toml @@ -98,7 +98,7 @@ class Review(BaseModel): {%- if question_str %} insights_from_user_answers: str = Field(description="shortly summarize the insights you gained from the user's answers to the questions") {%- endif %} - key_issues_to_review: List[KeyIssuesComponentLink] = Field("A short and diverse list (0-3 issues) of high-priority bugs, problems or performance concerns introduced in the PR code, which the PR reviewer should further focus on and validate during the review process.") + key_issues_to_review: List[KeyIssuesComponentLink] = Field("A short and diverse list (0-{{ num_max_findings }} issues) of high-priority bugs, problems or performance concerns introduced in the PR code, which the PR reviewer should further focus on and validate during the review process.") {%- if require_security_review %} 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 %} diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index ff48819f..39780e4c 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -81,6 +81,7 @@ class PRReviewer: "language": self.main_language, "diff": "", # empty diff for initial calculation "num_pr_files": self.git_provider.get_num_of_files(), + "num_max_findings": get_settings().pr_reviewer.num_max_findings, "require_score": get_settings().pr_reviewer.require_score_review, "require_tests": get_settings().pr_reviewer.require_tests_review, "require_estimate_effort_to_review": get_settings().pr_reviewer.require_estimate_effort_to_review, From c97b49c373a3f9c297f43484a1ae67f2921dc69b Mon Sep 17 00:00:00 2001 From: Guber Tamas Date: Mon, 19 May 2025 16:19:41 +0200 Subject: [PATCH 2/2] typo fix --- docs/docs/tools/review.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/tools/review.md b/docs/docs/tools/review.md index 3245418eb..d330947c 100644 --- a/docs/docs/tools/review.md +++ b/docs/docs/tools/review.md @@ -72,7 +72,7 @@ extra_instructions = "..." num_max_findings - Number of maximum returned finding. Default is 3. + Number of maximum returned findings. Default is 3.