Codium-ai / pr-agent

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

/review broke - docker:latest #881

Closed kristofenyi closed 4 months ago

kristofenyi commented 4 months ago

Hi,

I run the app from docker using the latest version 0.21. Noticed today the /review is broken. Definetely was working few days back.

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 290, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.10/site-packages/starlette_context/middleware/raw_middleware.py", line 92, in __call__
    await self.app(scope, receive, send_wrapper)
  File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 69, in app
    await response(scope, receive, send)
  File "/usr/local/lib/python3.10/site-packages/starlette/responses.py", line 174, in __call__
    await self.background()
  File "/usr/local/lib/python3.10/site-packages/starlette/background.py", line 43, in __call__
    await task()
  File "/usr/local/lib/python3.10/site-packages/starlette/background.py", line 26, in __call__
    await self.func(*self.args, **self.kwargs)
  File "/app/pr_agent/agent/pr_agent.py", line 93, in handle_request
    await command2class[action](pr_url, ai_handler=self.ai_handler, args=args).run()
  File "/app/pr_agent/tools/pr_reviewer.py", line 65, in __init__
    'require_can_be_split_review': get_settings().pr_reviewer.require_can_be_split_review,
  File "/usr/local/lib/python3.10/site-packages/dynaconf/utils/boxing.py", line 21, in evaluate
    value = f(dynabox, item, *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/dynaconf/utils/boxing.py", line 44, in __getattr__
    return super().__getattr__(n_item, *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/dynaconf/vendor/box/box.py", line 176, in __getattr__
    raise BoxKeyError(str(E))from _A
dynaconf.vendor.box.exceptions.BoxKeyError: "'DynaBox' object has no attribute 'require_can_be_split_review'"

restarted the pods, still same. Other commands work.

Any idea? Change in the API or dependncy?

mrT23 commented 4 months ago

@kristofenyi

1) the latest docker is nightly updated, and is different than the 0.21 docker, which is fixed (docker pull codiumai/pr-agent:0.21-github_action) . this is a highly common setup. Choose yourself against which one to work.

2) There is no problem in either of the dockers with the review command, nor with the require_can_be_split_review parameter

3) I cannot debug your self-hosted pod, but something in your definitions is wrong. Triple and quadruple check it. its related to require_can_be_split_review parameter. My guess is that it's not under the correct category ( [pr_reviewer] ).

All the best

https://github.com/Codium-ai/codium-code-examples/pull/37#issuecomment-2074080938 image

kristofenyi commented 4 months ago

Hi @mrT23 , thanks for the reply. The thing is, i was running the pods for 3 weeks and it was working. So it shouldnt be the configs or my enviroment, as it did not change. Maybe could gitlab change or the dependencies its using?

tried

/review --pr_reviewer. require_can_be_split_review=true
/review --pr_reviewer. require_can_be_split_review=false

Yesterday /descibe worked now even that doesnt work with basically same error

{"icon": "❌", "name": "ERROR", "no": 40}, "line": 155, "message": "Error generating PR description https://GITLAB_URL: \"'DynaBox' object has no attribute 'generate_ai_title'\"", "module": "pr_description", "name": "pr_agent.tools.pr_description", "process": {"id": 1, "name": "MainProcess"}, "thread": {"id": 139886202153856, "name": "MainThread"}, "time": {"repr": "2024-04-24 12:47:28.147689+00:00", "timestamp": 1713962848.147689}}}

tried running it as

image: codiumai/pr-agent:gitlab_webhook
image: codiumai/pr-agent:0.21-gitlab_webhook

I can see in the logs that the response came

"text": "Full_response\n", "record":  {"elapsed": {"repr": ...

but its just not returining it back to the PRs. for /review the bot doesnt even make comment.

for /describe it puts back the first commetn

[CodiumAppDev]
project_3_bot_41deb71cf02e9180a6b2cd44bda4c01
· [2 minutes ago](URL/merge_requests/2436#note_66340)
Preparing PR description...

but thats that. No edito of the descirption (which it did just yesterday)

mrT23 commented 4 months ago

the docker works well also on gitlab, I checked.

I cannot debug your personal pod on your personal hosting. If you struggle with self-hosting, I suggest considering PR-Agent Pro. If not, try deleting all your configurations, making sure it works with that, and then adding them one-by-one.

review https://pr-agent-docs.codium.ai/tools/describe/#configuration-options to make sure all your configurations are updated

All the best

image image