Post duo_mention_started progress note as a reply in the mention thread
What does this MR do and why?
When a user mentions @GitLabDuo in a merge request thread, a "started mention session…" progress system note is created as a standalone top-level note. This caused two problems:
- Wrong placement — the note appeared at the bottom of the page, not inline in the thread where the user typed the mention.
- Note didn't disappear in real-time — the frontend's
fetchUpdatedNotesscopes its search for the progress note to the bot reply's discussion. Becauseduo_mention_startedwas a standalone note in its own discussion (not inside the human mention thread), the scoped search missed it and the note persisted until page refresh.
Solution:
duo_mention_started now accepts discussion as an argument which creates the system note as a reply inside that discussion thread — the same pattern used by duo_code_review_chat_started. on_flow_started in the GitlabDuoNote adapter loads the discussion from the callback context and passes it through.
This makes the progress note appear inline in the mention thread and lets the existing frontend scoped-search logic find and remove it automatically when the reply arrives.
How to set up and validate locally
- Enable the feature flag for your user:
Feature.enable(:ai_duo_mention_messaging_adapter, User.find_by_username('your-username')) - Open an MR on a project with the DAP code review flow enabled.
- Post a comment mentioning
@GitLabDuowith a question or task such as@GitLabDuo what is this MR about? - Observe that the "GitLab Duo started mention session..." progress note appears inline in the thread, not as a standalone note at the top of the activity feed.
- Once the workflow completes, verify the progress note disappears and is replaced by the bot's reply without requiring a page refresh.
Screenshots
| Before | After (running) | After (finished) |
|---|---|---|
![]() |
![]() |
![]() |
Screen Recording (end-to-end)
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.


