Page MenuHomePhabricator

[SPIKE] Test Automoderator with Indonesian Wikipedia's FlaggedRevs configuration [8HRS]
Closed, ResolvedPublicSpike

Description

Our prototype of Automoderator works well in a default MediaWiki environment. One potential complication is that a few dozen wikis use the MediaWiki-extensions-FlaggedRevs extension to hold edits for review by designated patrollers. We need to understand how Automoderator currently interfaces with Flagged Revisions so that we can make any changes necessary to have it operate smoothly on those wikis.

This question primarily concerns the technical side of this - we may also need to consult with patrollers to understand their expectations around how Automoderator would behave.

Questions might include:

  • Is Automoderator able to revert edits when Flagged Revisions is enabled?
  • Are system account edits (i.e. Automoderator) also flagged for review by patrollers, or are they treated as trusted edits?

Event Timeline

Restricted Application changed the subtype of this task from "Task" to "Spike". · View Herald TranscriptFeb 7 2024, 6:30 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
  • Is Automoderator able to revert edits when Flagged Revisions is enabled?

The purpose of FlaggedRevs is to hide edits rather than preventing them, so it shouldn’t prevent PageUpdater from doing edits.

  • Are system account edits (i.e. Automoderator) also flagged for review by patrollers, or are they treated as trusted edits?

FlaggedRevs knows nothing about system accounts, only user rights. An edit is reviewed among others if

  • the user has autoreview right, and
  • either the edit is a revert to the stable revision (the SHA1 hashes match), or auto-review is enabled in config (it’s enabled on all WMF wikis) and the previous version is reviewed.

The above conditions mean that if the Automoderator account has the autoreview right (I assume system accounts can also have user rights?), the patrollers don’t get extra work – if the page had no unreviewed edits, or the only unreviewed edit was the one that has just been reverted, the revert is auto-reviewed. If there were more unreviewed edits, the page is not reviewed (unless those unreviewed edits happened to be back-and-forth reverts by non-autoreviewer users) – and neither should it be, since the previous edits still need manual review. These unreviewed edits don’t add to the backlog, as the page has already been in the backlog due to the previous unreviewed edits.

However, the logic (rEFLR includes/backend/FlaggedRevsHooks.php:394-539 (at 8e6abc00e9bb)) accesses the global $wgRequest object several times, which is a bit scary, as the request is the one that made the to-be-reverted edit, not the revert edit.

Thanks for all this great information @Tacsipacsi!

It seems like, at least on de.wiki, bots have the autoreview flag (https://de.wikipedia.org/wiki/Spezial:Gruppenrechte) so it might make sense for system accounts to have this too, but perhaps this would need to be something discussed with each FlaggedRevs community.

It seems like, at least on de.wiki, bots have the autoreview flag

Yes, on all wikis (T15989).

A note for our pilot wiki (idwiki): It currently has this in config:

$wgGroupPermissions['sysop']['stablesettings'] = true;
$wgFlaggedRevsRestrictionLevels = [ 'autoconfirmed', 'autoreview', 'sysop' ];

A note for our pilot wiki (idwiki): It currently has this in config:

$wgGroupPermissions['sysop']['stablesettings'] = true;
$wgFlaggedRevsRestrictionLevels = [ 'autoconfirmed', 'autoreview', 'sysop' ];

I believe you may also need to look for wgFlaggedRevsProtection, since that is the mode that id.wiki uses (true).

Samwalton9-WMF renamed this task from Does Automoderator work when Flagged Revisions is enabled? to Test Automoderator with Indonesian Wikipedia's FlaggedRevs configuration.Apr 8 2024, 1:33 PM
Samwalton9-WMF moved this task from Inbox to To be estimated on the Moderator-Tools-Team board.
jsn.sherman renamed this task from Test Automoderator with Indonesian Wikipedia's FlaggedRevs configuration to [SPIKE] Test Automoderator with Indonesian Wikipedia's FlaggedRevs configuration [8HRS].Apr 16 2024, 3:30 PM
jsn.sherman moved this task from To be estimated to Up next on the Moderator-Tools-Team board.
Samwalton9-WMF moved this task from Up next to Kanban on the Moderator-Tools-Team board.

After an investigation into testing configuration locally I have uncovered the following configuration to suffice:

$wgGroupPermissions['sysop']['stablesettings'] = true;
$wgFlaggedRevsRestrictionLevels = [ 'autoconfirmed', 'autoreview', 'sysop' ];
$wgFlaggedRevsProtection = true;

The only "gotcha" is that when $wgFlaggedRevsProtection is set to true the reviewable pages GUI doesn't show up automatically.
If this field is set to true: "Pages are reviewable only if they have been manually
configured by an admin to use a 'stable version' as the default".

The admin will need to go into the settings for the individual pages that they wish to be reviewable and set the edit review permissions there (I'm assuming this is already setup on idwiki since the flag is already set to true).
The admin will also need to make sure whichever user they are testing with has reviewer/editor user rights.

A screenshot example of what I updated to get the GUI showing up on a page:

Screenshot 2024-04-29 at 2.19.00 PM.png (445×1 px, 47 KB)

After setting those permissions, the page then becomes reviewable like so:

Screenshot 2024-04-29 at 2.21.56 PM.png (368×1 px, 39 KB)

I was able to get both the reviews and AutoModerator working together but there's probably some more robust testing I can do with a pair?

Screenshot 2024-04-29 at 2.33.57 PM.png (676×1 px, 199 KB)

Thank you for your investigation, @Kgraessle! I found the same results you did.

Is Automoderator able to revert edits when Flagged Revisions is enabled?

Yes, it can but it is flagged for review by patrollers.

Are system account edits (i.e. Automoderator) also flagged for review by patrollers, or are they treated as trusted edits?

AutoModerator reverts seem to be treated as an edit from any other user.

Thanks both! Glad to hear nothing super weird happened.

One question I have is about Automoderator's edits being flagged for review by patrollers. I don't know whether this will be desirable or not - my feeling is that it should probably not be required, otherwise we're not really saving moderators any effort. But I'm also surprised it's the case - does the bot user group on your local wikis have the autoreview user right? My understanding was that Automoderator should have that group, and from my quick checks bots seem to have the autoreview user right on our production wikis, but I don't know if that's by default or not.

If Automoderator does have autoreview then I'm confused why it's still being flagged for patrollers.

Kgraessle changed the task status from Open to In Progress.Tue, Apr 30, 2:16 PM

Thanks both! Glad to hear nothing super weird happened.

One question I have is about Automoderator's edits being flagged for review by patrollers. I don't know whether this will be desirable or not - my feeling is that it should probably not be required, otherwise we're not really saving moderators any effort. But I'm also surprised it's the case - does the bot user group on your local wikis have the autoreview user right? My understanding was that Automoderator should have that group, and from my quick checks bots seem to have the autoreview user right on our production wikis, but I don't know if that's by default or not.

If Automoderator does have autoreview then I'm confused why it's still being flagged for patrollers.

This hasn't been added in code. I'd recommend adding soft dependency on flaggedrevs that adds the autoreview group if flaggedrevs is loaded. We could control that with a boolean config, but it probably isn't necessary for now. We might need to check to see if that group itself is configurable in flagged revs (eg. something like $wgAutoReviewGroupName) and use that config var if so.

Sam, great questions.

I did some more investigation and was able to come up with configuration that shows AutoModerator reverts as autoreviewed in the version history:

$wgGroupPermissions['sysop']['stablesettings'] = true;
$wgFlaggedRevsRestrictionLevels = [ 'autoconfirmed', 'autoreview', 'sysop' ];
$wgFlaggedRevsProtection = true;
$wgFlaggedRevsAutoReview = true;
$wgGroupPermissions['AutoModerator']['autoreview'] = true;

See the last version history was automatically reverted without needing to be reviewed.

Screenshot 2024-04-30 at 9.52.10 AM.png (653×1 px, 214 KB)

The $wgFlaggedRevsAutoReview = true; is needed because: If enabled, every edit by a user with 'autoreview' rights is automatically reviewed upon save. There is no need to hit the "submit review" button. This feature requires that the previous revision was also reviewed; otherwise, auto-review will not occur.

We also, to your point, needed to add autoreview permissions to Automoderator user as seen in

$wgGroupPermissions['AutoModerator']['autoreview'] = true;

My outstanding question now is if $wgFlaggedRevsAutoReview = true; set on idwiki?
And if not, how will this impact our pilot?

My outstanding question now is if $wgFlaggedRevsAutoReview = true; set on idwiki?
And if not, how will this impact our pilot?

https://noc.wikimedia.org/conf/InitialiseSettings.php.txt#:~:text=wgFlaggedRevsAutoReview implies that the default for this value is 3, and a few wikis (not id.wiki) have it set to 1. Not sure how to interpret that :)

Alright, I tested by removing the $wgFlaggedAutoReview = true from my LocalSettings.php and the reverts are still showing as automatically reviewed. I actually do not think we need this field to be set. (default 3 seems to be ok!)
I think we just needed to assign the autoreview user group to the AutoModerator user. Should this be a configurable option per wiki or hardcoded? Is there any reason a wiki would want AutoModerator's reverts to show up as manually reviewable?

$wgGroupPermissions['sysop']['stablesettings'] = true;
$wgFlaggedRevsRestrictionLevels = [ 'autoconfirmed', 'autoreview', 'sysop' ];
$wgFlaggedRevsProtection = true;
$wgGroupPermissions['AutoModerator']['autoreview'] = true;

Alright, I tested by removing the $wgFlaggedAutoReview = true from my LocalSettings.php and the reverts are still showing as automatically reviewed. I actually do not think we need this field to be set. (default 3 seems to be ok!)
I think we just needed to assign the autoreview user group to the AutoModerator user. Should this be a configurable option per wiki or hardcoded? Is there any reason a wiki would want AutoModerator's reverts to show up as manually reviewable?

Good question, I'm actually not sure, and I quite like the idea of having it as an option. One question I have, though, is we've given AutoModerator the bot user group, and on all the wikis I checked, that user group already has the autoreview user right, so assigning the right might not be necessary, unless I'm missing something?

Ok, I think you're correct in that the bot should have that user right already.

The weird behavior we were seeing with the reviewable changes on AutoModerator reverts, I believe is happening after there are pending changes that need to be reviewed on a Page:

Screenshot 2024-04-30 at 12.02.58 PM.png (452×1 px, 151 KB)

Whereas, when a page has no reviewable changes queued- the AutoModerator revert is happening as expected here:

Screenshot 2024-04-30 at 12.05.57 PM.png (584×1 px, 165 KB)

Do we still want the AutoModerator revert to happen automatically if there are previously pending changes to be reviewed on a page?

Ok, I think you're correct in that the bot should have that user right already.

The weird behavior we were seeing with the reviewable changes on AutoModerator reverts, I believe is happening after there are pending changes that need to be reviewed on a Page:

Screenshot 2024-04-30 at 12.02.58 PM.png (452×1 px, 151 KB)

Whereas, when a page has no reviewable changes queued- the AutoModerator revert is happening as expected here:

Screenshot 2024-04-30 at 12.05.57 PM.png (584×1 px, 165 KB)

Do we still want the AutoModerator revert to happen automatically if there are previously pending changes to be reviewed on a page?

@Samwalton9-WMF I think this sounds like a question that should be posed to patrollers?

Ahh - well done for tracking that down, this makes sense now!

I actually don't think there's an open question anymore - the purpose of autoreview is to not require review if the revert happens without any previously unreviewed revisions, so everything here looks to be behaving as I (and I think patrollers) would expect it to!

I'm calling this done for the moment.