Unable to change erroneous properties of internal users

Problem to solve

Unable to edit properties of internal users, including email address. These users are included in a backup for some reason, and restored as part of that backup. This is undesirable because the backup was being “restored” on a new server as part of a migration, and that server is at a different domain.

Steps to reproduce

Make backup of instance which has internal users, restore that backup on another system which DID NOT have internal users, observe that the internal users are now visible on the new system.

Versions

Self-managed, v16.7

My issue is similar to the issue described here. The documentation on Internal Users is bereft of any helpful information. I believe that the behavior being seen can be traced back to this issue. The “solution” to that issue seems to have landed on a middle ground that makes little sense. I.e. I want to change some properties of these users which are incorrect, but GitLab does not give me the ability. Yet I’m show these users for some reason, even though I can’t do anything with them. If they truly don’t matter, they shouldn’t be displayed at all.

How can I fix this?

Running this from gitlab-rails console seems to do the trick…

For GitLab Alert Bot:

user = User.find_by(name: 'GitLab Alert Bot')
user.email = 'alert@correct.domain.com'
user.skip_reconfirmation!
user.save!

For GitLab Support Bot:

user = User.find_by(name: 'GitLab Support Bot')
user.email = 'support@correct.domain.com'
user.skip_reconfirmation!
user.save!

The GitLab Support Bot held onto its incorrect email address as a secondary email address. I was able to go to Admin Area > Overview > Users and select GitLab Support Bot and delete the secondary email address from there.