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
- Depends on: !237636 (merged) — refactor that introduces the handler class structure (this MR targets that branch)
- AIGW flow + prompt: ai-assist !5495 (merged) —
classify_code_review_mention_intentprompt must returnassistant_flow - Messaging adapter infrastructure: !236207 (merged) (merged)
- Issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/585237
How to set up and validate locally
Manual validation — assistant_flow path
- Enable the feature flag:
Feature.enable(:ai_duo_mention_messaging_adapter) - Ensure the namespace is in DAP mode and the
code_review/v1flow has a service account configured - Comment
@GitLabDuo Can you help me understand this approach?on a diff in an MR - Confirm routing to
AssistantFlowHandlerin logs, progress note appears, and flow reply is posted in the same thread
Manual validation — fallback
- Disable the feature flag (or use a non-DAP namespace)
- Same
@GitLabDuocomment → classic chat path: progress note + chat response
Screenshots
| MR View | MR View Completed | Session 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.


