Feature flag rollout: batched_git_ref_updates_repair_stray_parent

Summary

Roll out the feature flag batched_git_ref_updates_repair_stray_parent (type gitlab_com_derisk, group group::gitaly, default_enabled: false).

When BatchedGitRefUpdates::ProjectCleanupService deletes a batch of references and Gitaly reports a reference conflict (a bare reference such as refs/merge-requests/<iid> exists, so git refuses to touch refs/merge-requests/<iid>/head), the service repairs the repository instead of failing every minute: it keeps around the commit the stray parent points to, verifies the keep-around reference, deletes the parent and retries the batch once. Each repair is logged with the project id and the reference.

Gitaly reports the conflict as a typed DeleteRefsError.reference_conflict detail since gitaly!9409 (merged); before that version the error is Internal and the flag has no effect.

Context: #632245 (the retry loop), gitlab-org/gitaly#7432, INC-14259 follow-ups. The scheduler-level back-off in the same MR is not behind this flag.

Prerequisites

  • gitaly!9409 (merged) merged (2026-10-21)
  • The gitaly gem bumped to a version that carries DeleteRefsError.reference_conflict (none published as of 2026-10-23: 19.6.0.pre.rc1 was tagged two hours before !9409 (closed) merged). The Rails MR can merge before the bump; the flag has no effect until the gem arrives.
  • !263001 (merged) merged

Rollout

  • Enable on staging: /chatops run feature set batched_git_ref_updates_repair_stray_parent true --staging
  • For each project under repair, check whether it is inside its back-off window: the same MR skips a project whose batch keeps failing for a delay that doubles from one minute to one day, so after flag-on the repair runs at the project's next retry time. Either wait for it, or from a Rails console delete the key batched_git_ref_updates:project_cleanup:backoff:<project_id> in Gitlab::Redis::SharedState so the next scheduler tick (every minute) runs the repair at once.
  • Enable for the two known repositories on production (project actors), confirm one repair log line each and that sli_error/DeleteRefs/Internal on the tracker finding falls below 500/day
  • Enable on production for all: /chatops run feature set batched_git_ref_updates_repair_stray_parent true
  • Leave enabled; remove the flag after two weeks of stable operation (gitlab_com_derisk lifespan is 2 months from merge)
Edited by Kranthi Erusu