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

Update PR code suggestions prompts #1170

Merged
merged 2 commits into from
Aug 25, 2024
Merged

Conversation

mrT23
Copy link
Collaborator

@mrT23 mrT23 commented Aug 23, 2024

PR Type

Enhancement


Description

  • Updated instructions for generating code suggestions in PR review process
  • Clarified that suggestions should focus on new code introduced in the PR
  • Added instruction to avoid repeating changes already present in the PR
  • Introduced option to return an empty list if no relevant suggestions exist
  • Consolidated and streamlined existing instructions for better clarity

Changes walkthrough 📝

Relevant files
Enhancement
pr_code_suggestions_prompts.toml
Refine code suggestion generation instructions                     

pr_agent/settings/pr_code_suggestions_prompts.toml

  • Updated instructions for generating code suggestions
  • Clarified focus on new code and avoiding repetition of existing
    changes
  • Added instruction to return an empty list if no relevant suggestions
  • +6/-6     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🏅 Score: 95
    🧪 No relevant tests
    🔒 No security concerns identified
    🔀 No multiple PR themes
    ⚡ No key issues to review

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Aug 23, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Combine multiple instructions into a single, more concise instruction to improve readability and reduce redundancy

    Consider combining the three separate instructions into a single, more concise
    instruction. This can improve readability and reduce redundancy in the prompt.

    pr_agent/settings/pr_code_suggestions_prompts.toml [39-41]

    -- Provide up to {{ num_code_suggestions }} code suggestions.
    -- The suggestions should be diverse and insightful. They should focus on improving only the new code introduced the PR, meaning lines from '__new hunk__' sections, starting with '+' (after the line numbers).
    -- Prioritize suggestions that address possible issues, major problems, and bugs in the PR code. Don't repeat changes already present in the PR. If there are no relevant suggestions for the PR, return an empty list.
    +- Provide up to {{ num_code_suggestions }} diverse and insightful code suggestions, focusing on improving new code (lines starting with '+' in '__new hunk__' sections). Prioritize addressing possible issues, major problems, and bugs. Don't repeat existing changes. If no relevant suggestions, return an empty list.
     
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The suggestion effectively consolidates three separate instructions into one concise statement, improving readability and reducing redundancy without losing important information.

    8
    Clarify the purpose of '__old hunk__' sections in the instructions to provide better context for code reviewers

    Consider adding a clarification about the purpose of the 'old hunk' sections to
    provide better context for the code reviewer.

    pr_agent/settings/pr_code_suggestions_prompts.toml [40]

    -- The suggestions should be diverse and insightful. They should focus on improving only the new code introduced the PR, meaning lines from '__new hunk__' sections, starting with '+' (after the line numbers).
    +- The suggestions should be diverse and insightful. They should focus on improving only the new code introduced in the PR, meaning lines from '__new hunk__' sections, starting with '+' (after the line numbers). The '__old hunk__' sections are provided for context and should not be the focus of suggestions.
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: This suggestion adds valuable context about the purpose of 'old hunk' sections, which can help code reviewers better understand the structure of the diff.

    7
    Best practice
    Add a note about maintaining consistency with the existing codebase style and conventions in suggestions

    Consider adding a note about maintaining consistency with the existing codebase
    style and conventions when making suggestions.

    pr_agent/settings/pr_code_suggestions_prompts.toml [162]

    -- Take into account that you are recieving as an input only a PR code diff. The entire codebase is not available for you as context. Hence, avoid suggestions that might conflict with unseen parts of the codebase, like imports, global variables, etc.
    +- Take into account that you are receiving as an input only a PR code diff. The entire codebase is not available for you as context. Hence, avoid suggestions that might conflict with unseen parts of the codebase, like imports, global variables, etc. When making suggestions, try to maintain consistency with the visible code style and conventions.
     
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: The suggestion adds a useful reminder about maintaining code consistency, but it's a minor improvement to an already comprehensive instruction.

    6

    @AHancher2022
    Copy link

    Hey @mrT23 I will try this out but im not sure this will prevent the small PR issues. I had one PR I was testing with and it was giving back relevent suggestions but it was not a great solution since the change was so small. Did you see an improvement with the PR you were testing with?

    @mrT23
    Copy link
    Collaborator Author

    mrT23 commented Aug 23, 2024

    Hey @mrT23 I will try this out but im not sure this will prevent the small PR issues. I had one PR I was testing with and it was giving back relevent suggestions but it was not a great solution since the change was so small. Did you see an improvement with the PR you were testing with?

    yes

    @mrT23 mrT23 merged commit dae87d7 into main Aug 25, 2024
    2 checks passed
    @mrT23 mrT23 deleted the tr/avoid_repeating_pr_changes branch August 25, 2024 04:17
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    4 participants