Implements merge_request_ready trigger using EventStore

What does this MR do and why?

Addresses #592454 (closed). This MR implements merge_request_ready event trigger using the Event Store.

Background

This trigger was originally implemented using the work-in-progress Events Platform (MR). Due to ongoing architectural feedback, the scope of the Events Platform has shifted. To avoid blocking delivery and deliver results for customers , we've iterated on the approach and moved the merge_request_ready implementation to use the Event Store directly, with plans to migrate to the Events Platform once it's stable and merged.

Problem

Custom flows like code review workflows currently trigger on reviewer assignment, which can happen while a merge request is still in draft. This means AI review runs against WIP code, wasting compute resources and producing feedback on incomplete changes that the author is still actively working on.

Solution

Introduce a configurable merge_request_ready trigger event that fires when a merge request transitions from draft to ready, signalling the author considers the code complete and ready for review. This enables focused review at the right moment in the development workflow.

Key changes

  • Flow trigger: Adds merge_request_ready: 4 to the trigger type enum.
  • Event publishing: When the Draft -> Ready transition occurs in a class that inherits from ee/app/services/ee/merge_requests/base_service.rb, publish_merge_request_ready_event is called, which triggers the assigned workflow using the Events Store.
  • UI configuration: Adds merge_request_ready as a configurable trigger option in the flow trigger UI.

Feature flag

  • Name: merge_request_ready_flow_trigger
  • Type: gitlab_com_derisk
  • Scoped to: Project
  • Default: disabled
  • Rollout issue: #598421

How to set up and validate locally (see screen recording for UI navigation)

Pre-requisites:

  • Duo Enterprise enabled
  • GDK running with all services up
  1. Checkout this branch 594482/sq/trigger-events/mr_ready-event-store
  2. In Rails console: get your duo enterprise enabled project, e.g: proj = Project.find(1000000)
  3. Enable the feature flag: Feature.enable(:merge_request_ready_flow_trigger, proj)
  4. Create a custom flow in the GDK UI following the docs instructions:
    • Go to: http://172.16.123.1:3000/explore/ai-catalog/flows/
    • Add a flow named my_merge_request_ready_test_flow
    • Select a "Managed by" project, e.g. GitLab Duo / Test
    • Add a description and you can leave the yaml configuration as is
    • Create flow
  5. Enable the newly created flow in the GDK UI following the docs instructions:
    • Deselect all triggers and add the Merge request ready trigger
    • Enable flow
  6. Trigger the event:
    • Create or navigate to an existing draft MR in the project
    • Transition the MR from draft -> ready
  7. Verify:
    • The custom workflow should trigger, with a system note appearing in the MR timeline (see screenshot)
    • Frontend (feature flag gating)
      • Disable feature flag on the project: Feature.disable(:events_platform_trigger_cloud_events, proj)
      • Confirm that Merge request ready event_type is not available in the configuration UI (http://gdk.test:8080/gitlab-duo/test/-/automate/triggers/new) - see screenshot below.

Screenshot

  1. MR timeline showing system note after draft -> ready transition triggers the event:

Screenshot_2026-04-29_at_13.51.40

  1. Frontend feature flag gating: Merge request ready event type not available when ff is disabled

Screenshot_2026-04-23_at_15.19.44

Screen recording (GDK UI navigation)

  1. Draft: Implements merge_request_ready trigger e... (!232171 - closed)
  2. Events Platform Phase 1 first iteration (!228912 - closed)
  3. Make new_draft_status param required in DraftSt... (#599148)

Screenshots or screen recordings

Before After

How to set up and validate locally

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 Shola Quadri

Merge request reports

Loading