Skip to content

feat(moderation): merge the Timeout hard action into Mute - #396

Merged
RedStar071 merged 1 commit into
V7from
feat/mute-uses-timeout
Nov 12, 2026
Merged

RedStar071 merged 1 commit into
V7from
feat/mute-uses-timeout

Conversation

@RedStar071

@RedStar071 RedStar071 commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Stacked on #208.

🔗 Linked issue

None.

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

The automod rules, their escalation steps and the warning thresholds offered both Timeout and Mute, which do the same job for a moderator. They are now one action, Mute.

A Mute is a Discord timeout when its duration fits one (5 seconds to 28 days) and the server has the new moderation.mute-timeout setting on, or has no muted role. Otherwise it takes the muted role, as a permanent mute always does. The setting is on by default. applyMute in projects/bot/src/lib/moderation/actions/mute.ts makes that choice for the automod and the warning thresholds, and the case is a Timeout or a Mute after what was done. A Mute no longer needs a duration.

Timeout is gone from /automod edit, /warn-thresholds add and the escalation menu, where timeout 1h still reads as Mute 1h. A Timeout that is already saved, or that the API or a configuration file still sends, is read as a Mute. The dashboard keeps working until it drops the action. /timeout, /mute and the Timeout case type do not change.

⚠️ Breaking Changes

A rule or threshold that was a Timeout with no duration did nothing. After the migration it is a permanent mute with the muted role.

moderation.mute-timeout is on for every server after the migration, including servers that only used the muted role. On those servers, a Mute of 5 seconds to 28 days becomes a Discord timeout instead of the role. This is intended. A server that wants the role back turns the setting off.

📝 Migration

Run the migration 20261112T1628_merge_timeout_into_mute before this bot starts. It adds GuildModeration.mute_timeout (on for every server) and rewrites the saved Timeout hard actions, escalation steps and warning thresholds to Mute. Timeout stays in the GuildAutoModerationHardAction enum, which cannot drop a value. The rewrite is not undone by a rollback.

🤖 AI disclosure: Wolfstar Agent Kit modified this description. AI open source policy.


Read this PR faster    Follow each request

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge with the documented migration and intended behavior changes.

Reviews (5) · Last reviewed commit: "feat(moderation): merge the Timeout hard..." · Reviewed by Greptile

A Mute is now a Discord timeout when its duration fits one (up to 28
days) and the guild has moderation.mute-timeout, on by default, or no
muted role; otherwise it takes the muted role. The automod rules, their
escalation steps and the thresholds of warnings no longer offer
Timeout. A migration adds GuildModeration.mute_timeout and makes the
saved Timeouts Mutes; Timeout is still read as a Mute everywhere.
@coldtea-pr-lens

coldtea-pr-lens Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Architecture

Walkthrough of Merge timeout into mute action, in four steps

Read this PR faster

Inside the changed components — 1 view

Component view — Moderation dispatch

How infraction listeners and commands route mutes through applyMute

Architecture view of Component view — Moderation dispatch in wolfstar-project/wolfstar

Data flow

Data flow diagram for wolfstar-project/wolfstar at 5de9f6c

Follow each request


Data model

Data model diagram for wolfstar-project/wolfstar at 5de9f6c

+ 1 more table on the canvas

Open the canvas


Review

✨ Nothing flagged · reviewed 5de9f6c


Tip

Run npx @coldtea/pr-lens-cli analyze --base origin/main on a branch, then npx @coldtea/pr-lens-cli render .pr-lens/graph.json. Same lenses, your own model key, before the pull request exists

🪧 More tips
  • Run npx skills add coldteadotai/pr-lens, then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Click the link under each diagram to open it on a canvas you can zoom, pan and step through
  • The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change
  • Open a diagram on the canvas, then press W or click play to walk through the change one step at a time
  • The CLI's render reads .github/pr-lens.yml and applies your renames, exclusions and lane pins at draw time
  • Set github.comment.collapsed: true in .github/pr-lens.yml to fold the comment behind one View architecture… row. Drawing still runs as before
  • Set github.draw: on-demand in .github/pr-lens.yml and PR Lens stops drawing pull requests on its own. Comment @pr-lens draw on a pull request when you want that one drawn
  • Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and your model provider's key as its api-key to run PR Lens from your own CI. Any /chat/completions endpoint works
  • After a push, tick Redraw to draw the latest commit
  • Switch GitHub to dark mode and the diagrams follow. The moving dots are this pull request's data in motion
  • Set github.description: false in .github/pr-lens.yml to stop PR Lens adding buttons to your PR descriptions

Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it.  Star PR Lens on GitHub

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one rollout question and two small gaps.

Reviewed changes

Reviewed the full diff of the single commit that merges Timeout into Mute for automod rules, escalation steps and warn thresholds.

  • applyMute / isMuteTimeout — a mute becomes a Discord timeout when its duration is 5s to 28d and moderation.mute-timeout is on or there is no muted role; used by ModerationMessageListener.onMute and applyWarnThreshold.
  • moderation.mute-timeout setting — new GuildModeration.mute_timeout column (default true), wired through configuration, columns, defaults and locales.
  • Read-side normalization — stored, API-sent, file-imported, menu-typed and legacy Timeout values are read as Mute.
  • Removed Timeout special cases — the "needs a duration" validation, the stale-timeout import check, onTimeout and related locale strings are gone, and tests are updated to match.
  • Migration 20261112T1628_merge_timeout_into_mute — adds the column idempotently and rewrites Timeout in rule hard actions, escalation JSON steps and warn thresholds.

I found no remaining Timeout hard-action handling elsewhere in projects/. The migration SQL (ordinality-preserving jsonb_agg, guarded by @>) looks correct.

ℹ️ Default-on setting changes how existing role-based Mute rules act

The migration adds mute_timeout as DEFAULT true for every server, with the stated goal that "their timeouts stay timeouts". Servers that already had a Mute rule, escalation step or warn threshold with a duration of 5s to 28d and a muted role configured were using the muted role. They will now get a Discord timeout instead, with no change on their side. The behavior differs: the muted role is applied and restored by the bot, while a timeout is enforced by Discord and cannot be applied to members the bot cannot moderate. The PR description covers the Timeout-with-no-duration case but not this one.

Technical details
# Existing role-based Mute becomes a timeout after migration

## Affected sites
- projects/database/migrations/app/20261112T1628_merge_timeout_into_mute/migration.ts:26 — `DEFAULT true` applies to every existing guild, including ones that only ever used the muted role
- projects/bot/src/lib/moderation/actions/mute.ts:47 — `isMuteTimeout` picks the timeout whenever the setting is on and the duration fits

## Required outcome
- A decision, and a note in the PR's Breaking Changes section, on whether guilds with a muted role and existing `Mute` rules should keep role-based mutes after the migration

## Suggested approach (optional)
- Keep `DEFAULT true` for the column, but have the migration set `mute_timeout = false` for guilds that have a muted role and at least one `Mute` rule, escalation step or threshold with a fitting duration, so only guilds that had `Timeout` data or no role start on timeouts
- Or document that the flip is intentional

ℹ️ No tests for the read-side Timeout → Mute normalization in storage

toRule in projects/database/src/settings/automod/storage.ts and fetchWarnThresholds in projects/database/src/settings/warnings/storage.ts now call normalizeAutoModerationHardAction, which is what keeps every pre-migration or rolled-back row working. The new tests cover the escalation normalizer, the request parser, the menu parser and the legacy converter, but nothing exercises these two storage paths or normalizeAutoModerationHardAction itself. A small test that a rule row with hardAction: 'Timeout' and a threshold row with action: 'Timeout' come back as Mute would cover the rollback scenario the PR description calls out.

ℹ️ moderationDefaultWarnThresholds description is now stale

projects/bot/src/locales/en-US/settings.json (and the matching entry in i18next.d.ts) still says the default third-warning mute is "a timeout when there is no muted role". That is no longer the rule: getDefaultWarnThresholds() always returns a Mute, which is a timeout when moderation.mute-timeout is on or there is no muted role. The sentence should point at the new setting.

Pullfrog  | Fix it ➔ | View workflow run | Using claude-sonnet-5-5 | 𝕏

@github-project-automation github-project-automation Bot moved this from Todo to Review Approved in Wolfstar Nov 12, 2026
@RedStar071
RedStar071 merged commit bbb9fce into V7 Nov 12, 2026
9 checks passed
@RedStar071
RedStar071 deleted the feat/mute-uses-timeout branch November 12, 2026 17:30
@github-project-automation github-project-automation Bot moved this from Review Approved to Done in Wolfstar Nov 12, 2026
RedStar071 added a commit to wolfstar-project/wolfstar.rocks that referenced this pull request Nov 12, 2026
wolfstar-project/wolfstar#396 is merged into V7 (bbb9fce5), so the submodule
leaves its pull request head for the branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant