Skip to content

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

Screenshot_2024-08-06_at_4.16.46_PM

After

Screenshot_2024-08-06_at_4.07.31_PM Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to reproduce locally

  1. Enable MR FF
Feature.enable(:ai_merge_request_reader_for_chat)
  1. Go to a MR
  2. Ask Duo Chat a question about the MR
  3. Enable LLM logging
  4. Look at LLM logs and ensure that diffs come before MR comments

Related to #464587 (closed)

Edited by Lesley Razzaghian

Merge request reports

Loading