[go: up one dir, main page]

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_PROGRESSFAILEDSUCCEEDED. 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:

  1. Pipeline creation request starts with status IN_PROGRESS
  2. Request briefly transitions to FAILED
  3. Request finally transitions to SUCCEEDED when 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

  1. Ensure the ci_pipeline_creation_requests_realtime feature flag is enabled
  2. Create multiple pipelines for a merge request in quick succession using the async pipeline creation flow
  3. Monitor the pipeline creation request status via GraphQL subscription
subscription {
  ciPipelineCreationRequestsUpdated(mergeRequestId: "gid://gitlab/MergeRequest/17883633") {
    id
    iid
    pipelineCreationRequests {
      status
      pipelineId
      error
    }
  }
}
  1. Observe random pipeline creation requests transition through FAILED state before reaching SUCCEEDED

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:

  1. MergeRequests::CreatePipelineService#execute_async creates a pipeline creation request with IN_PROGRESS status
  2. MergeRequests::CreatePipelineWorker is enqueued to process the request
  3. The worker calls MergeRequests::CreatePipelineService#execute(merge_request)
  4. If validation checks in execute fail (via cannot_create_pipeline_error), the request is marked as FAILED
  5. 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.

Edited by Sahil Sharma