-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
:saprkles: Auto escalate accounts for high follow/like churn #740
Changes from 1 commit
4c66be1
c650375
35bcc47
8dcd5b5
f218527
0c95315
14c2ceb
1fee4ae
1047e8f
8b951f7
74225a2
3ae1750
fff5bc2
f83d46f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,11 @@ var actionNewTakedownCount = promauto.NewCounterVec(prometheus.CounterOpts{ | |
Help: "Number of new flags persisted", | ||
}, []string{"type"}) | ||
|
||
var actionNewEscalationCount = promauto.NewCounterVec(prometheus.CounterOpts{ | ||
Name: "automod_new_action_escalations", | ||
Help: "Number of new flags persisted", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. out of date |
||
}, []string{"type"}) | ||
|
||
var accountMetaFetches = promauto.NewCounter(prometheus.CounterOpts{ | ||
Name: "automod_account_meta_fetches", | ||
Help: "Number of account metadata reads (API calls)", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,8 +57,13 @@ func (eng *Engine) persistAccountModActions(c *AccountContext) error { | |
if err != nil { | ||
return fmt.Errorf("circuit-breaking takedowns: %w", err) | ||
} | ||
// @TODO: do we want to check if the account is already escalated? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, we should check here. we should also maybe popular review start as part of account meta? and clear account meta when it changes. |
||
newEscalation, err := eng.circuitBreakEscalation(ctx, c.effects.AccountEscalate) | ||
if err != nil { | ||
return fmt.Errorf("circuit-breaking escalation: %w", err) | ||
} | ||
|
||
anyModActions := newTakedown || len(newLabels) > 0 || len(newFlags) > 0 || len(newReports) > 0 | ||
anyModActions := newTakedown || len(newLabels) > 0 || len(newFlags) > 0 || len(newReports) > 0 || newEscalation | ||
if anyModActions && eng.Notifier != nil { | ||
for _, srv := range dedupeStrings(c.effects.NotifyServices) { | ||
if err := eng.Notifier.SendAccount(ctx, srv, c); err != nil { | ||
|
@@ -145,6 +150,27 @@ func (eng *Engine) persistAccountModActions(c *AccountContext) error { | |
if err != nil { | ||
c.Logger.Error("failed to execute account takedown", "err", err) | ||
} | ||
} else if newEscalation { | ||
// we don't want to escalate if there is a takedown | ||
c.Logger.Warn("account-escalate") | ||
actionNewEscalationCount.WithLabelValues("account").Inc() | ||
comment := "[automod]: auto account-escalation" | ||
_, err := toolsozone.ModerationEmitEvent(ctx, xrpcc, &toolsozone.ModerationEmitEvent_Input{ | ||
CreatedBy: xrpcc.Auth.Did, | ||
Event: &toolsozone.ModerationEmitEvent_Input_Event{ | ||
ModerationDefs_ModEventEscalate: &toolsozone.ModerationDefs_ModEventEscalate{ | ||
Comment: &comment, | ||
}, | ||
}, | ||
Subject: &toolsozone.ModerationEmitEvent_Input_Subject{ | ||
AdminDefs_RepoRef: &comatproto.AdminDefs_RepoRef{ | ||
Did: c.Account.Identity.DID.String(), | ||
}, | ||
}, | ||
}) | ||
if err != nil { | ||
c.Logger.Error("failed to execute account escalation", "err", err) | ||
} | ||
} | ||
|
||
needCachePurge := newTakedown || len(newLabels) > 0 || len(newFlags) > 0 || createdReports | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ func InteractionChurnRule(c *automod.RecordContext) error { | |
c.Logger.Info("high-like-churn", "created-today", created, "deleted-today", deleted) | ||
c.AddAccountFlag("high-like-churn") | ||
c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("interaction churn: %d likes, %d unlikes today (so far)", created, deleted)) | ||
c.EscalateAccount() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be in favor of commenting this out for now, so we can review and get the engine change merged, then do the policy/behavior change separately. |
||
c.Notify("slack") | ||
} | ||
case "app.bsky.graph.follow": | ||
|
@@ -36,6 +37,7 @@ func InteractionChurnRule(c *automod.RecordContext) error { | |
c.Logger.Info("high-follow-churn", "created-today", created, "deleted-today", deleted) | ||
c.AddAccountFlag("high-follow-churn") | ||
c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("interaction churn: %d follows, %d unfollows today (so far)", created, deleted)) | ||
c.EscalateAccount() | ||
c.Notify("slack") | ||
} | ||
// just generic bulk following | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment out of date (copypasta)