Page MenuHomePhabricator

[SPIKE]Investigate using Rollback instead of Undo for Automoderator reverts[16H]
Closed, ResolvedPublicSpike

Description

On tr.wiki we've seen some undesirable behaviour from Automoderator whereby a vandal makes a few edits which are not caught, then one edit which is reverted. Automoderator only undoes the final edit, obscuring the previous bad edits. To resolve this we could be using rollback instead, which reverts all previous concurrent edits by the reverted user in one go.

Open questions

  • How does this work technically?
  • How does a rollback work?
  • How would we implement it?
  • Would all communities want this, or should Undo vs Rollback be a configuration?
  • Would we need to change any of our data tracking if we made this change?

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Restricted Application changed the subtype of this task from "Task" to "Spike". · View Herald TranscriptAug 12 2024, 4:41 PM

Would we need to change any of our data tracking if we made this change?

Would love to know if you have any insight on this @KCVelaga_WMF!

Here on tr.wiki we can see a case where a user made a number of small edits, then a big (addition of and) removal of content, but only the last edit was reverted.

Here the edits had the following scores (older to newer):

  • 0.96
  • 0.96
  • 0.97
  • 0.96
  • 0.97
  • 0.97
  • 0.96
  • 1.00 (reverted)

As our caution levels only go as low as 0.975, even at lower threshold values the older edits would not have been individually reverted.

image.png (1×1 px, 791 KB)

@Samwalton9-WMF

Would love to know if you have any insight on this @KCVelaga_WMF!

On the analytics side, it doesn't change much. I have been tracking both mw-undo & mw-rollback tags, and for mediawiki_history both are considered as identify reverted.

Scardenasmolinar renamed this task from Investigate using Rollback instead of Undo for Automoderator reverts to [SPIKE]Investigate using Rollback instead of Undo for Automoderator reverts[16H].Aug 20 2024, 3:09 PM
Scardenasmolinar updated the task description. (Show Details)
Scardenasmolinar moved this task from To be estimated to Up next on the Moderator-Tools-Team board.

Change #1064407 had a related patch set uploaded (by Kgraessle; author: Kgraessle):

[mediawiki/extensions/AutoModerator@master] [SPIKE]Investigate using Rollback instead of Undo for Automoderator reverts

https://gerrit.wikimedia.org/r/1064407

How does a rollback work?

Both undo and rollback are considered "reverts".

A revert is (broadly speaking) an edit that reverses the actions of other editors.
In that process a new version of the page is created.

There are three methods of performing reverts that are recognized by MediaWiki.

  • Undo
  • Rollback
  • Manual Revert

As far as I can tell, the rollback behaves exactly like an undo except that
it lets you revert multiple revisions by the same user simultaneously.

Rollback reverts the last X edits made by the last editor of the page.
This is a commonly useful scenario when dealing with
vandalism, as usually all changes made recently by one user should be reverted.

Limitations:

  • When all revisions of the page are from the same user, it cannot be rolled back.
  • Rollback requires both the edit and the rollback user right on the target page; currently, this means that OAuth consumers, bot passwords etc. require both the editpage and the rollback grant

See more info here and here.

How does this work technically?

I created a spike PR here that demonstrates the functionality.

But ultimately there is a service called the RollbackPageFactory where we can pass in the following parameters:

  • page identity
  • performer
  • user to revert

and then call the method rollbackIfAllowed which will handle all logic for us.

How would we implement it?

see spike PR.

Would all communities want this, or should Undo vs Rollback be a configuration?

I think we should keep it configurable.

My open questions/thoughts about this are:

  • Would we potentially revert more good edits if the revision itself was based on a false positive score?

In my spike PR I just manually went back X revisions and chose that revision ID but this is probably not how
we'd want this to behave in the real world.

Huh - speaking totally out of ignorance here but is there not some internal MediaWiki functionality for triggering a standardised 'rollback' that's the same as if I as a user click the Rollback button?

In my spike PR I just manually went back X revisions and chose that revision ID but this is probably not how
we'd want this to behave in the real world.

Huh - speaking totally out of ignorance here but is there not some internal MediaWiki functionality for triggering a standardised 'rollback' that's the same as if I as a user click the Rollback button?

Are you referring to the rollback 1 edit button in the history screenshot like below or somewhere else? (also let me know if you can't see my screenshot below!)

Screenshot 2024-08-22 at 9.12.57 AM.png (371×1 px, 130 KB)

In my spike PR I just manually went back X revisions and chose that revision ID but this is probably not how
we'd want this to behave in the real world.

Huh - speaking totally out of ignorance here but is there not some internal MediaWiki functionality for triggering a standardised 'rollback' that's the same as if I as a user click the Rollback button?

Are you referring to the rollback 1 edit button in the history screenshot like below or somewhere else? (also let me know if you can't see my screenshot below!)

Screenshot 2024-08-22 at 9.12.57 AM.png (371×1 px, 130 KB)

Yeah exactly! No idea how it works internally but I naively assumed there might be some functionality there that we could just reuse/trigger.

In my spike PR I just manually went back X revisions and chose that revision ID but this is probably not how
we'd want this to behave in the real world.

Huh - speaking totally out of ignorance here but is there not some internal MediaWiki functionality for triggering a standardised 'rollback' that's the same as if I as a user click the Rollback button?

Are you referring to the rollback 1 edit button in the history screenshot like below or somewhere else? (also let me know if you can't see my screenshot below!)

Screenshot 2024-08-22 at 9.12.57 AM.png (371×1 px, 130 KB)

Yeah exactly! No idea how it works internally but I naively assumed there might be some functionality there that we could just reuse/trigger.

Ok, it looks like that button is using the action API which undoes the last edit to the page and then if the last user who edited the page made multiple edits in a row, they will all be rolled back.
Let me test out on the spike branch I have out if we can just provide the previous revision id and the rollback flag parameter to see if it behaves the same way as the API/button.

In my spike PR I just manually went back X revisions and chose that revision ID but this is probably not how
we'd want this to behave in the real world.

Huh - speaking totally out of ignorance here but is there not some internal MediaWiki functionality for triggering a standardised 'rollback' that's the same as if I as a user click the Rollback button?

Are you referring to the rollback 1 edit button in the history screenshot like below or somewhere else? (also let me know if you can't see my screenshot below!)

Screenshot 2024-08-22 at 9.12.57 AM.png (371×1 px, 130 KB)

Yeah exactly! No idea how it works internally but I naively assumed there might be some functionality there that we could just reuse/trigger.

Ok, it looks like that button is using the action API which undoes the last edit to the page and then if the last user who edited the page made multiple edits in a row, they will all be rolled back.
Let me test out on the spike branch I have out if we can just provide the previous revision id and the rollback flag parameter to see if it behaves the same way as the API/button.

Ok @Samwalton9 good news! I found a service that will perform the same functionality as the rollback button and have updated my PR accordingly. I'll also update my comment above.

@Samwalton9-WMF

Would love to know if you have any insight on this @KCVelaga_WMF!

On the analytics side, it doesn't change much. I have been tracking both mw-undo & mw-rollback tags, and for mediawiki_history both are considered as identify reverted.

A quick question that came up in RTL today for you KC - if we rollback multiple edits will that count as one Automoderator action in our metrics, or multiple?

A quick question that came up in RTL today for you KC - if we rollback multiple edits will that count as one Automoderator action in our metrics, or multiple?

The rollback itself will counted as one revert, because it is one edit and a single revision_id. But we also capture the information about the revision id of the edit(s) being reverted. So we can easily show two metrics:

  1. number of reverts made
  2. number of edits that were undone by those reverts

@Samwalton9-WMF

Ok, so after some more investigation we are able to override the summary message using the provided service.
We are also able to control whether we set the bot flag on the rollback.
The only issue I'm seeing now is the rollback service is defaulting all reverts to minor edits so if we wanted to keep that configurable we'd have to refactor the rollback method to our liking.

@Samwalton9-WMF

Ok, so after some more investigation we are able to override the summary message using the provided service.
We are also able to control whether we set the bot flag on the rollback.

That's great!

The only issue I'm seeing now is the rollback service is defaulting all reverts to minor edits so if we wanted to keep that configurable we'd have to refactor the rollback method to our liking.

That's weird! I never noticed that Rollbacks are considered minor edits. I guess the logic is that if you have rollback rights and you roll something back you're a trusted individual so other users don't need to check your edit.

Change #1064817 had a related patch set uploaded (by Kgraessle; author: Kgraessle):

[mediawiki/extensions/AutoModerator@master] [Spike] showing how we could override the rollback function to set the minor edit flag

https://gerrit.wikimedia.org/r/1064817

Change #1064817 had a related patch set uploaded (by Kgraessle; author: Kgraessle):

[mediawiki/extensions/AutoModerator@master] [Spike] showing how we could override the rollback function to set the minor edit flag

https://gerrit.wikimedia.org/r/1064817

Adding a second PR to demo if we want to override the minor edit flag and customize the functionality inside of the rollback function.

I'm inclined to say that we should move forward with Rollback (with minor edit still being configurable), but it would be great if an engineer could take a look at the demo patch to confirm this is a sensible/viable approach, and I'd like to get some community input on whether this is a change we should make across the board or not.

@Dogu @Renvoy @BAPerdana-WMF @Edgars2007 @Strainu Since you're all interested in (or already) using Automoderator - what do you think? Should Automoderator Rollback (revert all of a user's consecutive edits) or Undo (only revert the one edit which crossed the threshold)?

Would all communities want this, or should Undo vs Rollback be a configuration?

I think we should keep it configurable.

I support this recommendation. Revert and undo are familiar to patrollers, they can decide for themselves. Implement both and let the community choose.

My open questions/thoughts about this are:

  • Would we potentially revert more good edits if the revision itself was based on a false positive score?

Yes, but that's in-line with the behavior I see in my community. People prefer to revert because it's a single click process, while undo is a 2 step process.

I think going straight to the rollback function makes the most sense

A quick survey on Discord so far received 5 votes for just using Rollback. I think as long as it's technically feasible we can go ahead with shifting to Rollback and then see if any communities would prefer Undo in the future.

jsn.sherman moved this task from Eng review to Done on the Moderator-Tools-Team (Kanban) board.
jsn.sherman subscribed.

Having reviewed the exploratory patches and the conversation here, I think we should proceed. Thanks for your work on this @Kgraessle !

Change #1064407 abandoned by Kgraessle:

[mediawiki/extensions/AutoModerator@master] [SPIKE]Investigate using Rollback instead of Undo for Automoderator reverts

Reason:

Old spike branch

https://gerrit.wikimedia.org/r/1064407