Skip to content
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

Add toggle to automatically enable /improve --extended #569

Merged

Conversation

zmeir
Copy link
Contributor

@zmeir zmeir commented Jan 4, 2024

Type

Enhancement


Description

  • Introduced a new method _get_is_extended in pr_agent/tools/pr_code_suggestions.py to check if the extended mode should be enabled by the --extended flag or automatically based on the configuration.
  • Modified the logic in pr_agent/tools/pr_code_suggestions.py to prevent reducing the number of suggestions below a certain threshold.
  • Updated the documentation (docs/IMPROVE.md) to include the new auto_extended_mode configuration parameter.
  • Added a new configuration parameter auto_extended_mode to the settings file (pr_agent/settings/configuration.toml).

PR changes walkthrough

Relevant files                                                                                                                                 
Enhancement
1 files
pr_code_suggestions.py                                                                           
    pr_agent/tools/pr_code_suggestions.py

    The PR introduces a new method _get_is_extended to
    determine if the extended mode should be enabled either by
    the --extended flag or automatically according to the
    configuration. It also modifies the logic for reducing the
    number of suggestions, ensuring it doesn't go below a
    certain threshold.

+19/-3
Documentation
1 files
IMPROVE.md                                                                                                   
    docs/IMPROVE.md

    The documentation is updated to include the new
    auto_extended_mode configuration parameter.

+1/-0
Configuration changes
1 files
configuration.toml                                                                                   
    pr_agent/settings/configuration.toml

    A new configuration parameter auto_extended_mode is added
    to the settings file.

+1/-0

User description

Simpler version of #564 without all the extra thresholds, and keeping the default as false for backwards compatibility.

Copy link

PR Description updated to latest commit (c2b0891)

Copy link

PR Analysis

  • 🎯 Main theme: Enhancement of the 'improve' tool to automatically enable extended mode based on configuration.
  • 📝 PR summary: This PR introduces a new configuration parameter auto_extended_mode to automatically enable the extended mode of the 'improve' tool. It also modifies the logic to prevent reducing the number of suggestions below a certain threshold. The documentation is updated to reflect these changes.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 2, because the PR is relatively small and the changes are straightforward. However, it modifies a key part of the application, so understanding the context is important.
  • 🔒 Security concerns: No

PR Feedback

💡 General suggestions: The PR is well-structured and the changes are clear. It would be beneficial to add tests to validate the new functionality and ensure it doesn't break existing features. Also, consider handling exceptions more specifically rather than using a general catch-all.

🤖 Code feedback:
relevant filepr_agent/tools/pr_code_suggestions.py
suggestion      

Consider replacing the general exception handling with specific exceptions that you expect might occur. This can help in debugging and prevent masking of unexpected errors. [important]

relevant lineexcept Exception as e:

relevant filepr_agent/tools/pr_code_suggestions.py
suggestion      

It would be better to use a more descriptive variable name instead of s in the for loop. This can improve code readability. [medium]

relevant linefor s in sort_order['Sort Order']:

✨ Usage tips:

To invoke the PR-Agent, add a comment using one of the following commands:

  • /review: Request a review of your Pull Request.
  • /describe: Update the PR title and description based on the contents of the PR.
  • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
  • /ask <QUESTION>: Ask a question about the PR.
  • /update_changelog: Update the changelog based on the PR's contents.
  • /add_docs 💎: Generate docstring for new components introduced in the PR.
  • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
  • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To edit any configuration parameter from the configuration.toml, add --config_path=new_value.
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, add a /config comment.

@mrT23
Copy link
Collaborator

mrT23 commented Jan 4, 2024

this looks good :-)
Notice we also have a 'max_number_of_calls', to protect use even if we enable extended by default.

This kind of limitation to prevent "explosion" of calls in edge cases is important

@mrT23 mrT23 merged commit fe6b206 into Codium-ai:main Jan 4, 2024
1 check passed
@zmeir zmeir deleted the zmeir/enhance/auto_improve_extended_simple branch January 4, 2024 17:30
yochail pushed a commit to yochail/pr-agent that referenced this pull request Feb 11, 2024
…e_extended_simple

Add toggle to automatically enable `/improve --extended`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants