Put diffs above comments when serializing MRs for Duo Chat
What does this MR do and why?
We had an issue where a MR with a lot of comments had the diff get cut off because it was going over the character limit for requests to Claude.
Diff is more important than comments for MRs, so it is best to ensure that diffs come before comments.
MR acceptance checklist
Screenshots or screen recordings
Note how the diff used to be after the MR comments, but now it is before.
Before
After
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to reproduce locally
- Enable MR FF
Feature.enable(:ai_merge_request_reader_for_chat)
- Go to a MR
- Ask Duo Chat a question about the MR
- Enable LLM logging
- Look at LLM logs and ensure that diffs come before MR comments
Related to #464587 (closed)
Edited by Lesley Razzaghian