-
Notifications
You must be signed in to change notification settings - Fork 621
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
Implementing Extended Improve Mode for More Thorough PR Reviews #229
Conversation
/describe |
@mrT23 can you add configuration so that the automatic review can also hit this new path of desired? |
'review' is a different tool, that works differently. But I think a simpler solution, if you like the "extended" feature, is to can make the "improve --extended" command to run automatically on any PR, instead (or in addition) to "review'. |
Yes, that was my expectation. A civics value to have it fire. It would be nice to be able to have describe auto fire as well along with describe. |
/ask rate this PR quality, from 1 to 10. explain why |
Question: rate this pr quality, from 1 to 10. explain why Answer: However, there are a few areas that could be improved:
|
/review |
PR Analysis(review updated until commit 9157fa6)
PR Feedback
How to useInstructions
|
/improve --extended |
@@ -121,7 +138,11 @@ def push_inline_code_suggestions(self, data): | |||
if get_settings().config.verbosity_level >= 2: | |||
logging.info(f"Could not parse suggestion: {d}") | |||
|
|||
self.git_provider.publish_code_suggestions(code_suggestions) | |||
is_successful = self.git_provider.publish_code_suggestions(code_suggestions) |
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.
Suggestion: Consider adding error handling or a retry mechanism in case the 'publish_code_suggestions' function fails.
is_successful = self.git_provider.publish_code_suggestions(code_suggestions) | |
try: | |
self.git_provider.publish_code_suggestions(code_suggestions) | |
except Exception as e: | |
logging.error('Failed to publish code suggestions: ', e) | |
# Retry logic here |
continue | ||
|
||
patch = convert_to_hunks_with_lines_numbers(patch, file) |
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.
Suggestion: Consider adding a check for the existence of 'patch' before calling 'convert_to_hunks_with_lines_numbers'. This will prevent potential errors if 'patch' is None.
patch = convert_to_hunks_with_lines_numbers(patch, file) | |
if patch: | |
patch = convert_to_hunks_with_lines_numbers(patch, file) |
|
||
if patch: | ||
patches.append(patch) |
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.
Suggestion: Consider adding a check for the existence of 'patch' before appending it to 'patches'. This will prevent potential errors if 'patch' is None.
patches.append(patch) | |
if patch: | |
patches.append(patch) |
|
||
if patch: | ||
patches.append(patch) |
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.
Suggestion: Consider adding a check for the existence of 'patch' before appending it to 'patches'. This will prevent potential errors if 'patch' is None.
patches.append(patch) | |
if patch: | |
patches.append(patch) |
PR Code Suggestions ✨Latest suggestions up to 9157fa6
Previous suggestionsSuggestions up to commit 9157fa6
|
Persistent review updated to latest commit 9157fa6 |
@CodiumAI-Agent /review |
Persistent review updated to latest commit 9157fa6 |
@CodiumAI-Agent /review |
Persistent review updated to latest commit 9157fa6 |
/docker sumerise the content and creat a dockefiles |
PR-Agent was enabled for this repository, but no eligible user found. Please link your git user with your CodiumAI identity here. |
Persistent review updated to latest commit 9157fa6 |
@CodiumAI-Agent /improve |
/describe |
PR Description updated to latest commit (9157fa6)
|
Persistent review updated to latest commit 9157fa6 |
1 similar comment
Persistent review updated to latest commit 9157fa6 |
/review |
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. Persistent review updated to latest commit 9157fa6 |
Persistent review updated to latest commit 9157fa6 |
1 similar comment
Persistent review updated to latest commit 9157fa6 |
/review |
Persistent review updated to latest commit 9157fa6 |
1 similar comment
Persistent review updated to latest commit 9157fa6 |
/review |
Persistent review updated to latest commit 9157fa6 |
2 similar comments
Persistent review updated to latest commit 9157fa6 |
Persistent review updated to latest commit 9157fa6 |
User description
PR Type:
Enhancement
PR Description:
This pull request introduces an extended mode for the "improve" tool, which provides more thorough feedback on pull requests by making multiple model calls. The extended mode allows for no compression of diff files, generates code suggestions for each group of diff files, and aggregates these suggestions. It also includes functionality for ranking the suggestions based on their importance and clipping the least important suggestions. The extended mode can be activated with the 'improve --extended' command.
PR Main Files Walkthrough:
pr_agent/tools/pr_code_suggestions.py
: Added support for the extended improve mode. This includes the creation of a new function '_prepare_prediction_extended' to handle the extended mode logic, and a 'rank_suggestions' function to rank code suggestions based on their importance. The 'run' function was also updated to handle the extended mode.pr_agent/algo/pr_processing.py
: Added a new function 'get_pr_multi_diffs' to get multiple diffs for the extended improve mode. The 'pr_generate_extended_diff' function was also updated to return the tokens of each extended patch.pr_agent/cli.py
: Updated the CLI help text to include information about the extended improve mode.pr_agent/servers/help.py
: Updated the server help text to include information about the extended improve mode.pr_agent/algo/ai_handler.py
: Updated the 'chat_completion' function to have a default temperature value.pr_agent/algo/utils.py
: Updated the 'update_settings_from_args' function to handle the '--extended' argument.pr_agent/algo/git_patch_processing.py
: Updated the 'convert_to_hunks_with_lines_numbers' function to add an extra newline before the filename for better readability.pr_agent/config_loader.py
: Added 'settings/pr_sort_code_suggestions_prompts.toml' to the list of configuration files to load.pr_agent/settings/pr_code_suggestions_prompts.toml
: Updated the system and user prompts for code suggestions to accommodate the extended improve mode.pr_agent/settings/pr_sort_code_suggestions_prompts.toml
: Added a new configuration file for the prompts used when sorting code suggestions in the extended improve mode.pr_agent/settings/configuration.toml
: Added new configuration options for the extended improve mode, including the number of code suggestions per chunk, whether to rank extended suggestions, the maximum number of calls, and the final clip factor.PR Type
Enhancement, Documentation
Description
Changes walkthrough 📝
10 files
ai_handler.py
Set default temperature in chat_completion function
pr_agent/algo/ai_handler.py
chat_completion
function.git_patch_processing.py
Enhance hunk formatting and readability in patches
pr_agent/algo/git_patch_processing.py
__new hunk__
and__old hunk__
.pr_processing.py
Implement multi-diff handling and extended diff generation
pr_agent/algo/pr_processing.py
get_pr_multi_diffs
function for handling multiple diffs.pr_generate_extended_diff
to return additional tokens.get_pr_diff
.utils.py
Enhance token clipping and argument validation
pr_agent/algo/utils.py
clip_tokens
.update_settings_from_args
.bitbucket_provider.py
Specify return type for publish_code_suggestions
pr_agent/git_providers/bitbucket_provider.py
bool
topublish_code_suggestions
.git_provider.py
Specify return type for publish_code_suggestions
pr_agent/git_providers/git_provider.py
bool
topublish_code_suggestions
.github_provider.py
Specify return type for publish_code_suggestions
pr_agent/git_providers/github_provider.py
bool
topublish_code_suggestions
.gitlab_provider.py
Specify return type for publish_code_suggestions
pr_agent/git_providers/gitlab_provider.py
bool
topublish_code_suggestions
.local_git_provider.py
Specify return type for publish_code_suggestions
pr_agent/git_providers/local_git_provider.py
bool
topublish_code_suggestions
.pr_code_suggestions.py
Implement extended improve mode and suggestion ranking
pr_agent/tools/pr_code_suggestions.py
3 files
cli.py
Update CLI help for extended improve mode
pr_agent/cli.py
help.py
Update server help for extended improve mode
pr_agent/servers/help.py
pr_code_suggestions_prompts.toml
Update prompts for extended improve mode
pr_agent/settings/pr_code_suggestions_prompts.toml
3 files
config_loader.py
Include sorting configuration in settings loader
pr_agent/config_loader.py
configuration.toml
Add extended improve mode configurations
pr_agent/settings/configuration.toml
pr_sort_code_suggestions_prompts.toml
Add configuration for sorting code suggestions
pr_agent/settings/pr_sort_code_suggestions_prompts.toml