pr-agent/pr_agent
Marshall Yount 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
..
agent final touches 2023-07-27 08:47:26 +03:00
algo Merge pull request #133 from idavidov/idavidov/github-ratelimit-message 2023-07-27 14:22:11 +03:00
git_providers Merge pull request #152 from Codium-ai/tr/gitlab_fixes 2023-07-28 11:40:53 +03:00
servers Handle marketplace hook 2023-07-28 03:22:25 +03:00
settings Merge pull request #133 from idavidov/idavidov/github-ratelimit-message 2023-07-27 14:22:11 +03:00
tools fix TypeError when iterating discussion_messages 2023-07-28 11:04:46 +02:00
__init__.py Initial commit - PR-Agent OSS release 2023-07-06 00:21:08 +03:00
cli.py final touches 2023-07-27 08:47:26 +03:00
config_loader.py s 2023-07-26 09:21:31 +03:00