Draft: Implements merge_request_ready trigger event
What does this MR do and why?
This MR addresses #592454 (closed) and implements merge_request_ready event trigger.
Problem
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 relay event that uses the Event Platform to fire, this is only 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. - Relay dispatcher: Calls
execute_flow_triggersinRelay::Dispatchers::Baseand addshandle_merge_request_readyto theMergeRequestsdispatcher to resolve the event. - Event publishing: When the Draft -> Ready transition occurs in
ee/app/services/ee/merge_requests/update_service.rb,publish_merge_request_ready_eventis called, which triggers thecode_review/v1foundational workflow using the Events Platform. - UI configuration: Adds
merge_request_readyas a configurable trigger option in the flow trigger UI.
How to set up and validate locally (see screen recording for UI navigation)
Pre-requisites:
- Duo Enterprise enabled
- GDK running with all services up
- In Rails console: get your duo enterprise enabled project:
proj = Project.find(1000000) - Enable the feature flag:
Feature.enable(:events_platform_trigger_cloud_events, project) - Start watching logs in your terminal (gdk root) - see script in details below
-
Create & configure a flow trigger in the GDK UI:
- Navigate to your project -> Automate -> Triggers -> New Trigger (e.g. http://gdk.test:8080/gitlab-duo/test/-/automate/triggers)
- Event type: select
Merge request ready - Service account: select
Duo Code Review - Agent or Flow: select Code Review
- Add a description and save
-
Trigger the event:
- Create or navigate to an existing draft MR in the project
- Transition the MR from draft -> ready
-
Verify:
- The Duo Code Review flow should trigger, with a system note appearing in the MR timeline (see screenshot)
- Confirm
merge_request_readyevent is published and consumed in the logs (see details below for log example) - 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:
{"severity":"INFO","time":"2026-04-21T10:14:38.584Z","correlation_id":"01KPQRHSTCA9AQM9E4F6P88G7E","meta.caller_id":"Relay::ConsumeEventsWorker","meta.feature_category":"code_suggestions","meta.organization_id":1,"meta.remote_ip":"172.16.123.1","meta.user":"root","meta.gl_user_id":1,"meta.project":"gitlab-duo/test","meta.root_namespace":"gitlab-duo","meta.client_id":"user/1","meta.root_caller_id":"Projects::MergeRequestsController#update","message":**"Starting event consumption"**,"class":"Relay::ConsumeEventService","event_id":"8d307359-432a-4753-9c41-6322949a7915",**"event_type":"com.gitlab.merge_requests.merge_request_ready"**,"event_source":"/projects/1000000"}
{"severity":"INFO","time":"2026-04-21T10:14:38.585Z","correlation_id":"01KPQRHSTCA9AQM9E4F6P88G7E","meta.caller_id":"Relay::ConsumeEventsWorker","meta.feature_category":"code_suggestions","meta.organization_id":1,"meta.remote_ip":"172.16.123.1","meta.user":"root","meta.gl_user_id":1,"meta.project":"gitlab-duo/test","meta.root_namespace":"gitlab-duo","meta.client_id":"user/1","meta.root_caller_id":"Projects::MergeRequestsController#update","message":**"Processing merge_request_ready"**,"class":"Relay::ConsumeEventService","event_id":"8d307359-432a-4753-9c41-6322949a7915",**"merge_request_id":50,"project_id":1000000**}
{"severity":"INFO","time":"2026-04-21T10:14:46.437Z","correlation_id":"01KPQRHSTCA9AQM9E4F6P88G7E","meta.caller_id":"Relay::ConsumeEventsWorker","meta.feature_category":"code_suggestions","meta.organization_id":1,"meta.remote_ip":"172.16.123.1","meta.user":"root","meta.gl_user_id":1,"meta.project":"gitlab-duo/test","meta.root_namespace":"gitlab-duo","meta.client_id":"user/1","meta.root_caller_id":"Projects::MergeRequestsController#update","meta.scoped_user":"root","meta.scoped_user_id":1,"message":**"Event consumption completed",**"class":"Relay::ConsumeEventService","event_id":"8d307359-432a-4753-9c41-6322949a7915",**"event_type":"com.gitlab.merge_requests.merge_request_ready"**}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)
| Before | After |
|---|---|
References
- Implement and integrate configurable event trig... (#594482)
- Events Platform Phase 1 first iteration (!228912 - closed)
- GitLab_Duo_Triggers_and_Agents
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.

