Address review comments: use MergedCloudEvent for merged MR flow trigger

What does this MR do and why?

Addresses open review comments from !249082 (merged) (now merged).

relate to #613978

Changes

1. Introduce MergeRequests::MergedCloudEvent

Creates a proper CloudEvents v1.0 event class (inheriting from BaseCloudEvent) published from CE MergeRequests::PostMergeService#execute (alongside the existing MergedEvent published from the EE hook). The new event carries the acting user (who merged the MR) in the CloudEvent envelope, eliminating the need for the resolve_current_user workaround.

2. Fix conceptual mismatch in the worker

ExecuteMergeRequestMergedWorkflowTriggersWorker now subscribes to MergedCloudEvent instead of the plain MergedEvent, aligning it with every other worker in Ai::CloudEventsFlowTriggerWorker. The resolve_current_user override is removed — current_user now comes from the event envelope directly.

3. Remove EVENT_TYPES[:merge_request] from Developer flow defaults

The merge_request event type was added in !249081 (merged) to drive the merged-MR flow via the legacy MergedEvent. Now that the worker subscribes to MergedCloudEvent instead, keeping EVENT_TYPES[:merge_request] in the Developer defaults would cause duplicate flow invocations on every merge. It has been removed. Note: SyncFoundationalFlowsService is create-only, so projects that already synced keep their existing merge_request trigger row; those rows become inert once the flags are enabled because the worker no longer subscribes to the legacy event.

4. Feature flag improvements

  • feature_issue_url updated to point at the canonical GitLab feature issue (gitlab-org#22593) instead of the AIGW dependency issue.
  • description updated to mention the companion merge_request_merged_memory_distillation flag and the existing-Developer-flow-session requirement.

5. Feature category

Worker, event definition, and specs updated to :code_suggestions (the dap_triggers category is not yet synced from the www-gitlab-com stages.yml). The redundant feature_category :code_suggestions declaration in the worker is removed — it is already provided by the Ai::CloudEventsFlowTriggerWorker concern.

References

How to set up and validate locally

  1. check out branch !250633 and restart gdk
  2. run bundle exec rails runner scripts/duo/merged_trigger_demo.rb in gitlab repo
  3. follow the instruction, wait for the session complete and click merge
  4. a memory distillation flow is triggered and a MR is created

Screenshot_2026-08-19_at_13.41.51{width=607 height=600

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 Duo Developer

Merge request reports

Loading
Loading