Route GitLabDuo MR mentions to DAP flow via messaging adapter

What does this MR do and why?

For DAP users, @GitLabDuo mentions in MR comments currently route to classic Duo Chat, which gives lower-quality responses and incorrect billing. Classic chat will be blocked for Duo Core/Pro users at 18.11

This MR introduces the assistant_flow intent path: when DuoCodeReviewChatWorker classifies a mention as assistant_flow, it delegates to AssistantFlowHandler, which triggers the DAP gitlab_duo_mention_assistant flow via the new GitlabDuoNote messaging adapter. Three conditions must hold for this path to activate: the ai_duo_mention_messaging_adapter feature flag is enabled, the namespace is in DAP mode, and a service account is configured for the code_review/v1 foundational flow. If any condition is not met, the worker falls through to classic chat unchanged.

AssistantFlowHandler resolves the catalog item + service account, builds a goal from the discussion/diff context, and calls adapter.trigger. Returns false if SA is not configured so the worker can fall back.

GitlabDuoNote adapter posts a progress note on on_request_received, then delivers or errors into the original discussion thread via deliver_result / deliver_error.

References

How to set up and validate locally

Manual validation — assistant_flow path

  1. Enable the feature flag: Feature.enable(:ai_duo_mention_messaging_adapter)
  2. Ensure the namespace is in DAP mode and the code_review/v1 flow has a service account configured
  3. Comment @GitLabDuo Can you help me understand this approach? on a diff in an MR
  4. Confirm routing to AssistantFlowHandler in logs, progress note appears, and flow reply is posted in the same thread

Manual validation — fallback

  1. Disable the feature flag (or use a non-DAP namespace)
  2. Same @GitLabDuo comment → classic chat path: progress note + chat response

Screenshots

MR View MR View Completed Session View
Screenshot_2026-05-25_at_3.13.55_PM Screenshot_2026-05-25_at_3.14.22_PM Sessions_timeline_view

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.

Edited by Kinshuk Singh

Merge request reports

Loading