Pipeline creation requests randomly transition from IN_PROGRESS to FAILED to SUCCEEDED
Summary
When creating pipelines asynchronously for merge requests using MergeRequests::CreatePipelineService#execute_async, pipeline creation requests occasionally exhibit unexpected status transitions: IN_PROGRESS → FAILED → SUCCEEDED. This behavior occurs randomly and was previously unnoticed because the frontend wasn't fetching pipeline creation request statuses in real-time.
Current Behavior
With the implementation of GraphQL subscriptions for pipeline creation requests (Persist pipeline creation status across page re... (!207190 - merged) • Sahil Sharma • 18.7), we now observe split-second status transitions:
- Pipeline creation request starts with status
IN_PROGRESS - Request briefly transitions to
FAILED - Request finally transitions to
SUCCEEDEDwhen the pipeline is successfully created
This behaviour is happening randomly and seems to be reproducible on master branch via GraphQL explorer (when the ci_pipeline_creation_requests_realtime feature flag is enabled).
Local GDK example
Screen_Recording_2025-11-18_at_10.06.29
Staging example
Screen_Recording_2025-11-18_at_11.38.10
Steps to Reproduce
- Ensure the
ci_pipeline_creation_requests_realtimefeature flag is enabled - Create multiple pipelines for a merge request in quick succession using the async pipeline creation flow
- Monitor the pipeline creation request status via GraphQL subscription
subscription {
ciPipelineCreationRequestsUpdated(mergeRequestId: "gid://gitlab/MergeRequest/17883633") {
id
iid
pipelineCreationRequests {
status
pipelineId
error
}
}
}
- Observe random pipeline creation requests transition through
FAILEDstate before reachingSUCCEEDED
Expected Behavior
Pipeline creation requests should transition directly from IN_PROGRESS to either:
-
SUCCEEDED(when pipeline is created successfully) -
FAILED(when pipeline creation genuinely fails)
There should be no intermediate FAILED state when the pipeline ultimately succeeds.
Impact
- User Experience: Users may see a "failed" alert which will be confusing since it immediately resolves
- Reliability: Indicates potential race conditions or timing issues in the async pipeline creation flow
Technical Context
The issue occurs in the async pipeline creation flow:
-
MergeRequests::CreatePipelineService#execute_asynccreates a pipeline creation request withIN_PROGRESSstatus -
MergeRequests::CreatePipelineWorkeris enqueued to process the request - The worker calls
MergeRequests::CreatePipelineService#execute(merge_request) - If validation checks in
executefail (viacannot_create_pipeline_error), the request is marked asFAILED - However, the pipeline creation ultimately succeeds, updating the status to
SUCCEEDED
The root cause of why the validation checks temporarily fail is currently unknown and requires investigation.