Count child pipelines toward the per-user pipeline rate limit

What does this MR do and why?

Child pipelines skip both pipeline creation rate limits: pipelines_create (per project, user and commit) and pipelines_created_per_user. Skipping the per-commit limit is needed, because child pipelines share the parent's commit and any fan-out past the limit would be blocked. Skipping the per-user limit isn't: it lets one user create far more pipelines than the per-user limit allows (2,000/min on GitLab.com) by fanning out child pipelines.

Behind the ci_rate_limit_child_pipelines_per_user derisk flag, this MR counts child pipelines toward the per-user limit and keeps them out of the per-commit one.

  • With the flag on, Chain::Limit::RateLimit checks child pipelines against pipelines_created_per_user only. Every other pipeline is checked against both limits, as before.
  • A child pipeline over the limit isn't created. Its trigger job fails with downstream_pipeline_creation_failed and the message Too many pipelines created in the last minute. Try again later. The job isn't retried automatically.
  • With the flag off, child pipelines skip both limits, as today.
  • Policy, excluded Duo workflow and lint pipelines are unchanged.
  • No new logging. The existing Pipeline rate limit exceeded log covers throttled child pipelines, and their context carries meta.caller_id: Ci::CreateDownstreamPipelineWorker, which tells them apart from top-level pipelines.

Expected impact on GitLab.com, from Kibana aggregates for Oct 27 to Nov 3: no user created 2,000 pipelines in a minute, child pipelines included. The busiest single user in one minute created 632 pipelines, and the most child pipelines created across the whole platform in one minute was 1,319. Users in GITLAB_THROTTLE_USER_ALLOWLIST are exempt from this limit.

This supersedes the log-only experiment in !266778 (closed), which is closed.

Docs: doc/administration/cicd/limits.md doesn't mention the exclusion today, and its "Per user" wording already describes the new behaviour. A history note belongs in the flag removal MR.

References

Screenshots or screen recordings

Not applicable, no UI changes.

How to set up and validate locally

  1. In the Rails console, set a low per-user limit and turn the flag on:

    ApplicationSetting.current.update!(pipeline_limit_per_user: 2)
    Feature.enable(:ci_rate_limit_child_pipelines_per_user)

    Sidekiq caches flag values for up to a minute, so wait a minute before the next step.

  2. In a project, commit a .gitlab-ci.yml with three trigger jobs that each include: child.yml, plus a child.yml with one job. The push creates the parent pipeline.

  3. The parent and one child pipeline are created. The other two trigger jobs fail with downstream_pipeline_creation_failed and the message Too many pipelines created in the last minute. Try again later.

  4. log/application_json.log has one Pipeline rate limit exceeded for pipelines_created_per_user line per blocked child, with meta.caller_id: Ci::CreateDownstreamPipelineWorker.

  5. Disable the flag, wait a minute, and commit again. All three child pipelines are created and nothing is logged.

Verified on GDK with exactly these steps. Flag on: 1 parent + 1 child created, 2 trigger jobs failed with downstream_pipeline_creation_failed, 2 log lines. One of them:

{
  "severity": "INFO",
  "time": "2026-11-03T18:13:35.393Z",
  "meta.caller_id": "Ci::CreateDownstreamPipelineWorker",
  "meta.root_caller_id": "POST /api/:version/internal/post_receive",
  "meta.feature_category": "continuous_integration",
  "meta.user": "root",
  "meta.gl_user_id": 1,
  "meta.project": "root/rl-1793729534",
  "meta.root_namespace": "root",
  "class": "Gitlab::Ci::Pipeline::Chain::Limit::RateLimit",
  "namespace_id": 1,
  "project_id": 61,
  "commit_sha": "59b1242415890cd8a6fc1276e128113e6dd3051e",
  "subscription_plan": "default",
  "message": "Pipeline rate limit exceeded for pipelines_created_per_user",
  "throttled": true,
  "throttle_override": false
}

The matching Ci::CreateDownstreamPipelineWorker done lines in log/sidekiq.log carry extra.ci_create_downstream_pipeline_worker.create_error_message: ["Too many pipelines created in the last minute. Try again later."].

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 Max Fan

Merge request reports

Loading
Loading