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 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: 4to 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_eventis called, which triggers the assigned workflow using the Events Store. - UI configuration: Adds
merge_request_readyas 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
- Checkout this branch
594482/sq/trigger-events/mr_ready-event-store - In Rails console: get your duo enterprise enabled project, e.g:
proj = Project.find(1000000) - Enable the feature flag:
Feature.enable(:merge_request_ready_flow_trigger, proj) - 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
- Go to:
- Enable the newly created flow in the GDK UI following the docs instructions:
- Deselect all triggers and add the
Merge request readytrigger - Enable flow
- Deselect all triggers and add the
- Trigger the event:
- Create or navigate to an existing draft MR in the project
- Transition the MR from draft -> ready
- 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 readyevent_type is not available in the configuration UI (http://gdk.test:8080/gitlab-duo/test/-/automate/triggers/new) - see screenshot below.
- Disable feature flag on the project:
Screenshot
- MR timeline showing system note after draft -> ready transition triggers the event:
- Frontend feature flag gating:
Merge request readyevent type not available when ff is disabled
Screen recording (GDK UI navigation)
References / Related
- Draft: Implements merge_request_ready trigger e... (!232171 - closed)
- Events Platform Phase 1 first iteration (!228912 - closed)
- 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.

