-
Notifications
You must be signed in to change notification settings - Fork 322
[code_review] Misc improvements part 3 #5560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[code_review] Misc improvements part 3 #5560
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the code review tool to improve its architecture by removing global state, restructuring prompts, and adopting structured output with Pydantic models. The changes aim to improve the quality and consistency of generated code review comments.
- Removes the global
TARGET_SOFTWAREvariable and replaces it with a constructor parameter - Restructures prompts by separating system prompts from user messages and adding support for patch descriptions
- Migrates from string-based JSON parsing to structured output using Pydantic models
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/code_review_tool_evaluator.py | Removes unused assignment to global TARGET_SOFTWARE variable |
| mcp/src/bugbug_mcp/server.py | Adds output_format parameter to CodeReviewTool initialization and removes output_format from generate_initial_prompt call |
| bugbug/tools/core/platforms/swarm.py | Adds abstract patch_description property to Swarm platform implementation |
| bugbug/tools/core/platforms/phabricator.py | Implements patch_description property to retrieve patch summary from Phabricator metadata |
| bugbug/tools/core/platforms/base.py | Adds abstract patch_description property to base Patch class |
| bugbug/tools/code_review/prompts.py | Restructures prompts by separating system prompt template, updating summarization to include patch description, and removing old output format instructions |
| bugbug/tools/code_review/agent.py | Refactors to use Pydantic models for structured output, hardcodes Claude model configuration, removes parse_model_output dependency, and updates to work with structured responses |
| bugbug/tools/code_review/init.py | Removes TARGET_SOFTWARE from exports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Deleted scripts/code_review_tool_runner.py as it is no longer needed
23f8f72 to
1695f61
Compare
1695f61 to
07c1768
Compare
Yes, and I will keep an eye on that anyway to make sure we do not encounter any other unwanted behaviours.
Yes, I forgot to link it. Thank you for the reminder. |
These improvements could be reviewed commit by commit.
Among other things, this PR resolves #4410 and resolves #4812
Here are the results based on the latest evaluation run:
Working on more improvements that aim to improve the results further.