"Project scheduled for deletion" notification mails are sent to BOT-accounts

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When scheduling a project for Deletion email notifications are sent to bot accounts with the role of owner, such accounts are implicitly created when creating group access tokens.

Steps to reproduce

  1. Create a group: my-group
  2. Create a project: my-project
  3. Create a group access token with: owner role, any Access Level
  4. Go back to my-project
  5. Settings -> General -> Advanced -> Delete Project -> Yes, delete project

An notification mail is sent out to the bot account, even though according to the documentation bots should not receive email:

What is the current bug behavior?

E-Mail is sent to a bot account with the owner role.

What is the expected correct behavior?

Bots should not receive email.

Relevant logs and/or screenshots

Screenshot of my mailgun log:

Safari_Reporting_new_Logs_-Mailgun_Send-_2025-05-27_at_17.25.23

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:		Ubuntu 24.04
Current User:	git
Using RVM:	no
Ruby Version:	3.2.5
Gem Version:	3.6.7
Bundler Version:2.6.5
Rake Version:	13.0.6
Redis Version:	7.2.7
Sidekiq Version:7.3.9
Go Version:	unknown

GitLab information
Version:	18.0.1
Revision:	7f42fade2b3
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	16.8
URL:		https://gitlab-test.basex.io
HTTP Clone URL:	https://gitlab-test.basex.io/some-group/some-project.git
SSH Clone URL:	git@gitlab-test.basex.io:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers:

GitLab Shell
Version:	14.42.0
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	18.0.1
- default Git Version: 	2.49.0.gl2

Possible fixes

I think it might be rooted here: https://gitlab.com/gitlab-org/gitlab/-/blob/v18.0.1-ee/app/services/notification_service.rb#L759-770

But that is just a wild guess.

Edited by 🤖 GitLab Bot 🤖