GitLab Runner Fetch Repository doesn't retry by default

Summary

At the start of a job, GitLab Runner fetch fresh repository for the job. When the fetch failed, there's a retry attempt for cloning fresh repo again. The message Retrying in 5s is printed but there's no output and it doesn't seem to do anything.

See the RFH issue 3761

Relevant code:

Steps to reproduce

.gitlab-ci.yml
Add the job definition that is failing here

Actual behavior

When failed to create fresh repository, the runner print a retry message and do nothing.

Expected behavior

When failed to create fresh repository, the runner retry and print out of what is being retried.

Relevant logs and/or screenshots

job log
...
Getting source from Git repository
00:03
Gitaly correlation ID: 99cba0984457d648-IAD
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/path/to/project/.git/
Created fresh repository.
error: 897 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
Retrying in 5s
Uploading artifacts for failed job
00:01
Uploading artifacts...
...

Environment description

config.toml contents
Add your configuration here

Used GitLab Runner version

18.3.1

Possible fixes