Implement Duo Code Review Chat
What does this MR do and why?
We are using Duo Chat for the chat functionality part of Duo Code Review.
This can be triggered by tagging GitLab Duo in a comment in a diff discussion the bot in started.
We send most of the notes in thread as part of context we send along in our duo chat request. We exclude notes that are not mentioning GitLab Duo as it's not needed and may confuse the chat bot if we include comments that aren't related to the review (e.g. other users chiming in).
We also send the relevant lines of code as additional context.
This is behind duo_code_review_chat FF.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Setup AI on your local development (doc).
- Enable
duo_code_review_chatfeature flag in rails console. - Execute Duo Code Review on a MR under an AI-enabled project. This can be done by executing
/duo_code_reviewquick action. - Wait for the review to finish.
- In a thread in diff started by Duo Code Review bot, make a comment asking some follow up question/s and mention the bot.
Related to #460932