Route Duo Developer mentions through the messaging adapter

What does this MR do and why?

Right now, our foundational flows have 2 issues when you trigger them through mentioning:

  1. We ignore the final response and don't route it back to the user --> We need workarounds (e.g. custom llm tool calls) to respond back
  2. They have a different UX than the GitLabDuo bot.

See: Unify UX for mentioning GitLabDuo and Duo Devel... (#601705)

What this MR does:

  • Gives the Duo Developer @mention flow the same UX as @GitLabDuo: an inline "started session" system note plus a framework-delivered reply, instead of today's plain 🔄 Processing → ✅ has started comment where the agent self-posts. Behind the ai_use_messaging_adapter_for_mentions feature flag (default off).
  • This routes foundational-flow @mention triggers (e.g. developer/v1) through the GitlabDuoNote messaging adapter. Non-foundational and non-mention triggers stay on the legacy RunService path, unchanged. @GitLabDuo MR mentions use a separate handler and already use the adapter.
Before After
image.png image.png

How it works

  • Reuse GitLabDuoNote adapter
  • Shared lifecycle. Base#with_lifecycle_hooks is extracted as the synchronous lifecycle (on-receipt ack → build context → started/failed dispatch). Base#trigger (used by @GitLabDuo/Slack) is now expressed in terms of it, so both entry points share one dispatch path.

Known follow-up (frontend)

The progress note renders three different ways today — work-item comment chrome, MR system bullet, and the @GitLabDuo animated indicator — and on merge requests it only clears on reload (the live note-deletion subscription is issue/work-item only). The backend creates an identical, correct note in all cases (destroyed on completion). Unifying the rendering (animated + auto-removing, consistent across issues/MRs) is a separate frontend follow-up.

How to set up and validate locally

Prereqs: a DAP-onboarded project with the developer/v1 foundational flow enabled and a :mention service-account trigger, and the Duo Workflow executor running in GDK. Enable the flags (also settable at /rails/features):

Feature.enable(:ai_use_messaging_adapter_for_mentions)
Feature.enable(:ai_duo_mention_messaging_adapter) # 
  1. Duo Developer mention (flag on): @mention the flow service account @GitLabDuo in an issue/MR/work-item thread → inline "started session" note, then a framework-delivered reply in the same thread when the flow finishes. You should also see the session activity log entries below

    image.png

  2. Duo Developer mention (flag off): same action → legacy UX (🔄 Processing…✅ has started). Confirms no change when off.

    image.png

  3. @GitLabDuo regression (flag on): comment @GitLabDuo … on an MR diff → started note + framework reply, with no duplicate session notes (its bot suppresses them).

References

Edited by Thomas Schmidt

Merge request reports

Loading