diff --git a/bugbug/tools/code_review/agent.py b/bugbug/tools/code_review/agent.py index 0520f6b1a8..812f5b9fc7 100644 --- a/bugbug/tools/code_review/agent.py +++ b/bugbug/tools/code_review/agent.py @@ -212,10 +212,15 @@ def generate_initial_prompt( ) -> str: created_before = patch.date_created if self.is_experiment_env else None + commit_message = patch.patch_title + if patch.patch_description: + commit_message += f"\n\n{patch.patch_description}" + return FIRST_MESSAGE_TEMPLATE.format( current_date=current_date_for_prompt(), patch=format_patch_set(patch.patch_set), patch_summarization=patch_summary, + commit_message=commit_message, external_context=external_context, comment_examples=self._get_comment_examples(patch, created_before), approved_examples=self._get_generated_examples(patch, created_before), diff --git a/bugbug/tools/code_review/prompts.py b/bugbug/tools/code_review/prompts.py index 59adc4bdf2..27a84de2e8 100644 --- a/bugbug/tools/code_review/prompts.py +++ b/bugbug/tools/code_review/prompts.py @@ -20,11 +20,13 @@ - Understand what the patch is trying to accomplish - Use the patch summary for context, but focus primarily on what you can see in the actual diff - Identify the intent and structure of the changes +- Compare the commit message against the diff: does it accurately describe what changed, and does it explain why? **Step 2: Identify Issues** - Look for bugs, logical errors, performance problems, security vulnerabilities, or violations of the coding standards - Focus ONLY on new or changed lines (lines that begin with `+`) - Never comment on unmodified code +- Flag a commit message that is unclear, misleading, or missing the rationale for a non-obvious change; anchor the comment to a representative changed line, like the patch-scope check does - Prioritize issues in this order: Security vulnerabilities > Functional bugs > Performance issues > Style/readability concerns **Step 3: Verify and Assess Confidence** @@ -97,6 +99,12 @@ {patch_summarization} +Here is the commit message the author wrote for this patch: + + +{commit_message} + + {external_context}