Commit Graph

192 Commits

Author SHA1 Message Date
816ddeeb9e Fix call to _get_previous_review_comment
Hey @mrT23, I thinks there's a problem with moving this line to after `self.git_provider.publish_comment(pr_comment)`.

The reason I originally placed it here is because otherwise, if you run `/review --pr_reviewer.remove_previous_review_comment=true` it will publish your review and then immediately after delete it, because it will look for the previous review comment only after you published your new review - so it will take your new review as the previous one. In order to get the real "previous" review you must collect the comments list before publishing a review, so placing this method call first ensures that.

The method `self._get_previous_review_comment()` is a no-op if `pr_reviewer.remove_previous_review_comment=false` so I see no downside in keeping it before `self.git_provider.publish_comment(pr_comment)`

Additionally, the check for `if previous_review_comment:` is redundant because it's done internally in `self._remove_previous_review_comment`. I thought it looked cleaner without this extra nesting here, but if you think more verbosity is better I'll keep it.
2023-10-30 09:06:51 +02:00
c895657310 fixed review 2023-10-29 17:59:46 +02:00
61d3e1ebf4 Merge pull request #394 from zmeir/zmeir-external-push_trigger
Added support for automatic review on push event
2023-10-29 13:04:33 +02:00
d772213cfc fix labels 2023-10-29 08:58:12 +02:00
f53ec1d0cc move enable custom labels to custom labels function 2023-10-27 21:12:58 +03:00
f3bdbfc103 Add /generate_labels function + fix issues 2023-10-26 23:28:33 +03:00
e6bea76eee Typo 2023-10-26 17:07:16 +03:00
02570ea797 Remove previous review comment on push event 2023-10-26 16:46:54 +03:00
65bb70a1dd Added support for automatic review on push event
The new feature can be enabled via the new configuration `github_app.handle_push_event`. To avoid any unwanted side-effects, the current default of this configuration is set to `false`.

The high level flow (assuming the configuration is enabled):
1. receive push event from GitHub
2. extract branch and commits from event
3. find PR url for branch (currently does not support PRs from forks)
4. perform configured commands (e.g. `/describe`, `/review -i`)

The push event flow is guarded by a backlog queue so that multiple push events on the same branch won't trigger multiple duplicate runs of the PR-Agent commands.
Example timeline:
1. push 1 - start handling event
2. push 2 - waiting to be handled while push 1 event is still running
3. push 3 - event is dropped since handling it and handling push 2 is the same, so it is redundant
4. push 1 finished being handled
5. push 2 awakens from wait and continues handling (potentially reviewing the commits of both push 2 and push 3)

All of these options are configurable and can be enabled/disabled as per the user's desire.

Additional minor changes in this PR:
1. Created `DefaultDictWithTimeout` utility class to avoid too much boilerplate code in managing caches for outdated triggers.
2. Guard against running increment review when there are no new commits.
3. Minor styling changes for incremented review text.
2023-10-25 11:15:23 +03:00
1a89c7eadf refactor + add description options 2023-10-24 22:28:57 +03:00
07617eab5a add custom labels 2023-10-24 22:06:27 +03:00
fa24413201 Custom Labels 2023-10-23 16:29:33 +03:00
c324d88be3 Refactor logging system to use custom logger across the codebase 2023-10-16 14:56:00 +03:00
8f9f09ecbf Fixed help message for bot user
This changes the help message to display properly when running a custom deployment of the PR-Agent app (i.e. not via GitHub Actions, and with the setting `github_app.override_deployment_type=false`)
2023-10-08 16:19:11 +03:00
72eecbbf61 add line number 2023-10-05 17:59:08 +03:00
989c56220b add line number 2023-10-05 17:48:36 +03:00
632de3f186 protections 2023-09-20 07:39:56 +03:00
ea91a38541 Estimated effort to review 2023-09-17 16:31:58 +03:00
caaee4e43d Estimated time to review 2023-09-15 17:09:58 +03:00
115b513c9b Remove 'bitbucket' explicit dependency anywhere that's not in bitbucket_provider.py 2023-09-10 14:06:13 +03:00
67ff50583a fix improve, update_changelog and review inline comment 2023-08-24 11:52:20 +05:30
631fb93b28 Implement Automatic Review Configuration for GitHub app 2023-08-16 16:24:30 -04:00
bb5878c99a Merge branch 'main' into tr/block_scalar 2023-08-11 18:36:21 +03:00
273a9e35d9 block scalar 2023-08-11 18:35:34 +03:00
d38c5236dd Merge pull request #187 from Codium-ai/ok/limit_description
Limiting Description and Commit Messages Length
2023-08-09 14:14:47 +03:00
e0f295659d A less hacky way 2023-08-09 12:17:54 +03:00
fe75e3f2ec yaml
yaml
2023-08-09 12:15:52 +03:00
e3274af831 A (still) hacky way to clip description and commit messages 2023-08-09 10:17:58 +03:00
a00038fbd8 Merge remote-tracking branch 'origin/main' into patch-1 2023-08-06 18:09:09 +03:00
fed0ea349a find_line_number_of_relevant_line_in_file
find_line_number_of_relevant_line_in_file
2023-08-06 08:13:07 +03:00
ed8554699b bug fixes and updates 2023-08-03 16:05:46 -07:00
3e94a71dcd commit_messages_str is used in all tools 2023-08-02 18:26:39 +03:00
8ae936e504 Bug fixes 2023-08-01 15:58:23 +03:00
d7b77764c3 Support context aware settings (for each incoming request), support override of settings, refactor CLI to use pr_agent.py 2023-08-01 14:43:26 +03:00
3daf94954a update_settings_from_args 2023-07-30 11:43:44 +03:00
ef71a7049e fix TypeError when iterating discussion_messages
When `pr-agent` is reviewing a long list of messages, a TypeError is thrown on the line

```python
for message in reversed(discussion_messages):
```

When reviewing the PyGithub library, the recommend an alternate syntax for iterating a paginated list in reverse.

https://github.com/PyGithub/PyGithub/blob/v1.59.0/github/PaginatedList.py#L122-L125

```
    If you want to iterate in reversed order, just do::

        for repo in user.get_repos().reversed:
            print(repo.name)
```

And here's a copy of the actual traceback

```
Traceback (most recent call last):
  File "/app/pr_agent/servers/github_action_runner.py", line 68, in <module>
    asyncio.run(run_action())
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/app/pr_agent/servers/github_action_runner.py", line 64, in run_action
    await PRAgent().handle_request(pr_url, body)
  File "/app/pr_agent/agent/pr_agent.py", line 19, in handle_request
    await PRReviewer(pr_url, is_answer=True).review()
  File "/app/pr_agent/tools/pr_reviewer.py", line 49, in __init__
    answer_str, question_str = self._get_user_answers()
  File "/app/pr_agent/tools/pr_reviewer.py", line 253, in _get_user_answers
    for message in reversed(discussion_messages):
TypeError: object of type 'PaginatedList' has no len()
```
2023-07-28 11:04:46 +02:00
1bd47b0d53 enhance pr_reviewer.py code 2023-07-26 17:24:03 +03:00
02a1d8dbfc Add support for fallback models 2023-07-23 16:16:36 +03:00
4c36fb4df2 args bug 2023-07-19 18:18:18 +03:00
577f24d107 Merge pull request #89 from zmeir/zmeir-review_score
Add Score Review Feature
2023-07-19 17:07:05 +03:00
3326327572 More refactoring.... 2023-07-19 17:01:56 +03:00
8038b6ab99 refactor and clean 2023-07-19 14:22:34 +03:00
8868c92141 Merge branch 'main' into zmeir-review_score 2023-07-19 11:05:24 +03:00
f73cddcb93 Change Review title when 2023-07-19 01:03:47 +03:00
5f36f0d753 Merge commit 'bdf7eff7cd0a8894c3e66e49bdf89f27da1bfcb4' into hl/incremental_review 2023-07-18 23:28:43 +03:00
dc4bf13d39 Add Incremental Review 2023-07-18 23:14:47 +03:00
0396e10706 Add configuration to request a score for the PR
This can help teams compare the review of the PR agent with that of a human reviewer, and fine-tune a score threshold for automatic approval where they decide the agent's review is satisfactory.
2023-07-18 16:40:35 +03:00
c507785475 bugfix 2023-07-18 16:32:51 +03:00
2e36fce4eb Merge pull request #83 from Codium-ai/hl/gitlab_description
Support describe for Gitlab
2023-07-18 13:47:32 +03:00
f2b74b6970 support gitlab describe function 2023-07-18 13:03:36 +03:00