Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bugbug/tools/code_review/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Comment thread
padenot marked this conversation as resolved.
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),
Expand Down
8 changes: 8 additions & 0 deletions bugbug/tools/code_review/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Comment thread
padenot marked this conversation as resolved.

**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**
Expand Down Expand Up @@ -97,6 +99,12 @@
{patch_summarization}
</patch_summary>

Here is the commit message the author wrote for this patch:

<commit_message>
{commit_message}
</commit_message>

<external-resources>
{external_context}
</external-resources>
Expand Down