A mentor recently retired from mentorship. They followed the instructions on the Special:MentorDashboard to reassign mentees through Special:QuitMentorship. However, as you can see from the above log, Special:QuitMentorship reassigns not only the mentee of the retired mentor, but also the mentees of other mentors. (Not all mentees appear to be affected)
@Bluehill395 Thanks again for noticing this bug. The issue was caused by a bug in our code. I uploaded a patch to fix that.
To explain the issue my patch fixes, this is what happened here:
- GrowthExperiments assigns two mentors to each user: primary mentor (the one shown in the newcomer homepage) and a backup mentor (the one who is sent the questions if the primary mentor is away; backup mentor is not meant to be permanent, GrowthExperiments can change who the backup mentor is, for instance, if they are also away).
- QuitMentorship fetches all mentees assigned to a mentor, regardless of the role (ie. this step includes mentees the mentor had as a backup mentor). This is wrong, because backup mentor is updated by GrowthExperiments when the currently assigned one is not suitable (is away or not a mentor anymore), cf. MentorPageMentorManager::getMentorForUser.
- For each of the relationships fetched in step 2, it calls ChangeMentor to do the reassignment. ChangeMentor assumes a primary relationship needs to be changed, and changes a perfectly valid relationship.
My patch fixes that by only fetching primary assignments in the 2nd step.