Codium-ai / pr-agent

🚀CodiumAI PR-Agent: An AI-Powered 🤖 Tool for Automated Pull Request Analysis, Feedback, Suggestions and More! 💻🔍
Apache License 2.0
4.79k stars 412 forks source link

[Bug?] We fail generate 'PR review' command #963

Closed psbss closed 2 weeks ago

psbss commented 2 weeks ago

Hi

These days we faced to fail PR-Agent every time when I command /review. We tried to update latest master branch but still we have this issue.

How do I fix this one?

The output is here (omit)

{"text": "Failed to review PR: 'str' object has no attribute 'get'\n", "record": {"elapsed": {"repr": "0:00:09.215349", "seconds": 9.215349}, "exception": null, "extra": {"command": "review"}, "file": {"name": "pr_reviewer.py", "path": "/app/pr_agent/tools/pr_reviewer.py"}, "function": "run", "level": {"icon": "❌", "name": "ERROR", "no": 40}, "line": 153, "message": "Failed to review PR: 'str' object has no attribute 'get'", "module": "pr_reviewer", "name": "pr_agent.tools.pr_reviewer", "process": {"id": 7, "name": "MainProcess"}, "thread": {"id": 139723272645504, "name": "MainThread"}, "time": {"repr": "2024-06-13 05:19:47.602679+00:00", "timestamp": 1718255987.602679}}}

actions workflow is here

name: pr-agent-commented

on:
  issue_comment:
    types: [created, edited]

permissions:
  pull-requests: write
  issues: write

jobs:
  pr_agent:
    name: PR Agent
    runs-on: ubuntu-latest
    if: github.event.sender.type != 'Bot' &&
        github.event.issue.state == 'open' &&
        github.event.issue.pull_request != null &&
        startsWith(github.event.comment.body, '/')
    env:
      COMMON_INSTRUCTIONS: >-
        - Please use Japanese in descriptions.
    steps:
      - name: PR Agent actions step
        id: pr-agent
        uses: Codium-ai/pr-agent@aac7aeabd13a647c09b2df29c5d70388d72adbd6
        env:
          OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CONFIG.MODEL: 'gpt-4o-2024-05-13'
          PR_REVIEWER.EXTRA_INSTRUCTIONS: ${{ env.COMMON_INSTRUCTIONS }}
          PR_REVIEWER.ENABLE_REVIEW_LABELS_SECURITY: false
          PR_REVIEWER.ENABLE_REVIEW_LABELS_EFFORT: false
          PR_REVIEWER.REQUIRE_CAN_BE_SPLIT_REVIEW: true
mrT23 commented 2 weeks ago

(1) I was able to reproduce. It is related to your very specific setup: " use Japanese" + "REQUIRE_CAN_BE_SPLIT_REVIEW"

(2) I think: https://github.com/Codium-ai/pr-agent/pull/965 would help the issue.

(3) But I don't recommend using " use Japanese" as a consistent instruction. I know its nice to see an answer in your native language. but in practice, GPT-4 quality deteririotes dramatically when answering in Japanese, compared to english. and it can also lead to producing an invalid YAML, as happened in your case.

psbss commented 2 weeks ago

Thank you so much @mrT23 I will discuss with our team to use english 👍