pr-agent/pr_agent
zmeir 22d17985a1 Less noisy fallback for publish_code_suggestions in case of invalid comments
As a first option, `publish_code_suggestions` will try to post all review comments in a single GitHub review. This is preferred because it will group all comments together in the GitHub UI under the same review, and will trigger just one notification for any viewers of the PR.

If just one of the comments is malformed, the entire API request will fail and none of the comments will be posted to the PR. In the current implementation, the fallback mechanism is to just post each comment separately with `try/except` and skip the invalid comments. This works, but potentially creates a lot of noise in the PR as each comment is posted as in a separate review, creating multiple notifications.

This suggested fallback is based on a similar idea, but without creating multiple review notifications. The it works is by iterating over the potential comments, and starting a PENDING review for the current comment. The review is not submitted and does not trigger a notification, but it is verified against the GitHub API, and so we can verify if the comment is valid. After checking all comments we then submit a single review with all the verified comments which is guaranteed to succeed.

The end result is having the exact same comments posted to the PR as with the current fallback method, but the downside is having twice as many API calls (for each comment we have 1 extra API call to delete the pending review).
2024-01-07 16:00:44 +02:00
..
agent Refactor AI handler instantiation to use lazy initialization in PR tools 2023-12-17 16:52:03 +02:00
algo s 2024-01-06 10:15:04 +02:00
git_providers Less noisy fallback for publish_code_suggestions in case of invalid comments 2024-01-07 16:00:44 +02:00
log Refactor logging system to use custom logger across the codebase 2023-10-16 14:56:00 +03:00
secret_providers Enhance logging in bitbucket_app, gitlab_webhook, and google_cloud_storage_secret_provider with JSON format and additional context 2023-10-18 16:44:03 +03:00
servers feat: Refactor help text addition in pr_reviewer.py and update tool names in README.md 2023-12-26 09:18:38 +02:00
settings docs: Reorganize and enhance documentation for review and describe tools 2024-01-07 09:28:06 +02:00
tools docs: Reorganize and enhance documentation for review and describe tools 2024-01-07 09:28:06 +02:00
__init__.py Initial commit - PR-Agent OSS release 2023-07-06 00:21:08 +03:00
cli.py Remove logging from pr_agent.py and add line breaks in cli.py and github_action_runner.py 2023-12-14 09:08:47 +02:00
config_loader.py Add /generate_labels function + fix issues 2023-10-26 23:28:33 +03:00