MR tab counts incorrect on initial MR creation, correct on refresh

Summary

On initial MR creation, the tab counts for Commits and Changes are populated with specific values. On immediate refresh, these values can change. This causes confusion and mistrust of the count values.

There doesn't seem to be a polling mechanism to update these values on the page after creation, as the values stay static unless the page is refreshed.

I realise that at MR creation time, the MR is in the "preparing" state, and is waiting on some asynchronous Sidekiq jobs to complete. However, providing one count initially, then changing it on refresh, is confusing.

Steps to reproduce

  1. Create a project on GitLab.com
  2. Create a new branch
  3. Create new files, ensuring multiple commits
  4. Create an MR and take note of the MR tab counts
  5. Refresh the page and take note of the MR tab counts

Example Project

https://gitlab.com/tmike_ultimate_group/zd705609/mr_tab_counts

What is the current bug behavior?

When the page is refreshed after MR creation, the MR tab counts change.

What is the expected correct behavior?

Unsure.

Relevant logs and/or screenshots

Before Refresh After Refresh
Screenshot_2026-04-24_at_09.59.21 Screenshot_2026-04-24_at_10.02.16

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Patch release information for backports

If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.

Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.

High-severity bug remediation

To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.