You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mute bug resulting in early unmuting when 2 or more are active for a member. #362
Occasionally, moderators may apply a mute to a member who already has an existing mute. A good example is the bot's automute when spam is detected, and then a proper mute being given for a longer duration after moderator evaluation. In the current implementation, the mute that was first applied by the bot automatically already has a task in the bot to unmute the member after 10 minutes. The member will then end up with an active mute in infractions, but no mute role allowing them to talk in the server again.
In the related issue, it's recommended to give an error output saying that a mute can't be given because they already have one, but I feel requiring an unmute to an actively spamming account is potentially going to cause issues for that small period of time until the proper mute is applied. If it's an automated sending thing for example, maybe the spamming will immediately resume.
Instead, perhaps we should implement something in the backend to ensure the following:
Only a single unmute task per user is pending of which is always the longest active mute.
Don't allow weirdness such as new mutes that are meant to end earlier than existing ones. Perhaps one of the two approaches for this might suit:
Accumulate durations on top of existing active infractions. So if they have a 1 day mute but they complain via dm rudely and a mod wants to extend it by another 2 days, they could just immediately make a 2 day mute instead and it would be observed after the existing one is over.
Error output to say that it's shorter than the existing duration, including saying what the currently longest active duration is.
When a mute is due for removal, perhaps a double check of active infractions via the api just in case.
Only a single unmute task per user is pending of which is always the longest active mute.
I agree but it's somewhat tricky unless the same scheduler instance is used. Well, the database can be queried for active infractions but technically there's nothing enforcing that a scheduled infraction is also present and active in the database. It's a bit of a mess I suppose.
Don't allow weirdness such as new mutes that are meant to end earlier than existing ones.
On one hand, infractions durations can already be edited with a separate command. On the other hand, it may be more convenient to have durations accumulate in the sense that if it did error out, then it'd be an extra step to run merely a different command with similar parameters. However, it would not be convenient (quite the opposite) if the actor did not wish for the times to accumulate and would have rather had their second infraction attempt invalidated. Therefore, I am leaning towards this option:
Error output to say that it's shorter than the existing duration, including saying what the currently longest active duration is.
When a mute is due for removal, perhaps a double check of active infractions via the api just in case.
Ideally, such a scenario should be made impossible in the first place (both client side and API-side constraints). Problem with API constraints for the active field is that different infractions have different behaviours. For example, the active field doesn't really make sense for notes and warnings (yet I believe such infractions are considered always active) but it makes sense to have multiple notes and warnings for a user. So this would be a bit convoluted.
Another idea is to have custom behaviour for mutes that were authored by the bot because it's easy to check who the actor of the active mute is. I'm not sure what custom behaviour would be implemented but I wanted to point out that it is a possibility.
On one hand, infractions durations can already be edited with a separate command. On the other hand, it may be more convenient to have durations accumulate in the sense that if it did error out, then it'd be an extra step to run merely a different command with similar parameters. However, it would not be convenient (quite the opposite) if the actor did not wish for the times to accumulate and would have rather had their second infraction attempt invalidated. Therefore, I am leaning towards this option:
Error output to say that it's shorter than the existing duration, including saying what the currently longest active duration is.
I agree. I'm also not always sure if we really mean to accumulate infractions when we hand out a secondary infraction. It's easier to reason about "I'm going to add a more severe infraction and it should have this duration" than "I want to add a more severe infraction that should end about here; how long should the duration be so it accumulates nicely with an existing infraction?".
I could also see the later causing issues if the actor makes a mistake, accidentally instating a much longer infraction than that they intended by accumulating to an existing one they were unaware of.
A safer option would be to err out when the new duration is shorter and to replace when the new duration is longer, although we can obviously still provide feedback in some way to the actor that this happened.
For example, the active field doesn't really make sense for notes and warnings (yet I believe such infractions are considered always active)
They currently are, but I think we've (no idea who were involved) discussed it once that it doesn't really make sense for these infractions to be active in the first place. The database also isn't consistent at this point, as I think they were migrated as "Inactive" by default (or whatever caused it, but some notes are marked as active and some as inactive.)
I'd say it makes sense to add a restriction to the back-end that only one infraction of a given type can be active for a given user at any time. To do so we'd have to change:
Restrict notes/warnings to active=False in the back-end;
Write a data migration that makes sure all the old notes/warnings are set to inactive;
Add validation to make sure only one active infraction per type per user can exist.
One downside is that this means we can't reverse the order of API/carrying out the punishment, as was suggested in the discussion surrounding the back-up moderation features for if the API goes down. That said, it wouldn't be difficult to work around that; we'll just have to handle a negative API response in a proper way and we'll need to anyway.
Another idea is to have custom behaviour for mutes that were authored by the bot because it's easy to check who the actor of the active mute is. I'm not sure what custom behaviour would be implemented but I wanted to point out that it is a possibility.
There's already another unanticipated consequence¹ of recent changes that may require this, but I don't think it's a solution to the double mute/ban infraction problem. The issue with double mutes/bans happens most frequently when a human actor escalates an earlier infraction, with the first possibly being an automated infraction.
[1] An automated infraction triggered by an antispam rule now shows up in the original Context (channel) to give context to the situation, since it often means that one of the participants in a conversation suddenly falls silent. We've recently removed the reason from the infraction confirmation message, though, meaning that part of the context is now missing.
Thanks for the well thought out response. I like your proposed API changes. I believe it'll be a lot simpler to add those restrictions in the API then have convoluted checks client-side. And, in general, not needing any logic to account for multiple active infractions (relevant for unmute/unban currently) also reduces client-side code complexity.
One concern I have about making notes and warnings inactive always is that it makes infraction queries (once that is implemented, it's already an issue) more complicated. It'd be more convenient to just list all active infractions rather than having special cases in the query for notes and warnings. I don't know how much that inconvenience would come up in practice though.
Activity
MarkKoz commentedon Oct 1, 2019
I agree but it's somewhat tricky unless the same scheduler instance is used. Well, the database can be queried for active infractions but technically there's nothing enforcing that a scheduled infraction is also present and active in the database. It's a bit of a mess I suppose.
On one hand, infractions durations can already be edited with a separate command. On the other hand, it may be more convenient to have durations accumulate in the sense that if it did error out, then it'd be an extra step to run merely a different command with similar parameters. However, it would not be convenient (quite the opposite) if the actor did not wish for the times to accumulate and would have rather had their second infraction attempt invalidated. Therefore, I am leaning towards this option:
Ideally, such a scenario should be made impossible in the first place (both client side and API-side constraints). Problem with API constraints for the
activefield is that different infractions have different behaviours. For example, theactivefield doesn't really make sense for notes and warnings (yet I believe such infractions are considered always active) but it makes sense to have multiple notes and warnings for a user. So this would be a bit convoluted.MarkKoz commentedon Oct 1, 2019
Another idea is to have custom behaviour for mutes that were authored by the bot because it's easy to check who the actor of the active mute is. I'm not sure what custom behaviour would be implemented but I wanted to point out that it is a possibility.
SebastiaanZ commentedon Oct 1, 2019
I agree. I'm also not always sure if we really mean to accumulate infractions when we hand out a secondary infraction. It's easier to reason about "I'm going to add a more severe infraction and it should have this duration" than "I want to add a more severe infraction that should end about here; how long should the duration be so it accumulates nicely with an existing infraction?".
I could also see the later causing issues if the actor makes a mistake, accidentally instating a much longer infraction than that they intended by accumulating to an existing one they were unaware of.
A safer option would be to err out when the new duration is shorter and to replace when the new duration is longer, although we can obviously still provide feedback in some way to the actor that this happened.
They currently are, but I think we've (no idea who were involved) discussed it once that it doesn't really make sense for these infractions to be active in the first place. The database also isn't consistent at this point, as I think they were migrated as "Inactive" by default (or whatever caused it, but some notes are marked as active and some as inactive.)
I'd say it makes sense to add a restriction to the back-end that only one infraction of a given type can be active for a given user at any time. To do so we'd have to change:
active=Falsein the back-end;One downside is that this means we can't reverse the order of API/carrying out the punishment, as was suggested in the discussion surrounding the back-up moderation features for if the API goes down. That said, it wouldn't be difficult to work around that; we'll just have to handle a negative API response in a proper way and we'll need to anyway.
There's already another unanticipated consequence¹ of recent changes that may require this, but I don't think it's a solution to the double mute/ban infraction problem. The issue with double mutes/bans happens most frequently when a human actor escalates an earlier infraction, with the first possibly being an automated infraction.
[1] An automated infraction triggered by an antispam rule now shows up in the original
Context(channel) to give context to the situation, since it often means that one of the participants in a conversation suddenly falls silent. We've recently removed the reason from the infraction confirmation message, though, meaning that part of the context is now missing.MarkKoz commentedon Oct 1, 2019
Thanks for the well thought out response. I like your proposed API changes. I believe it'll be a lot simpler to add those restrictions in the API then have convoluted checks client-side. And, in general, not needing any logic to account for multiple active infractions (relevant for unmute/unban currently) also reduces client-side code complexity.
One concern I have about making notes and warnings inactive always is that it makes infraction queries (once that is implemented, it's already an issue) more complicated. It'd be more convenient to just list all active infractions rather than having special cases in the query for notes and warnings. I don't know how much that inconvenience would come up in practice though.
MarkKoz commentedon Mar 28, 2020
@scragly @SebastiaanZ I believe this was addressed by python-discord/site#278, which disallows multiple active infractions. Can you confirm?