fix(admin): automod-bypass reports success when a Discord role change fails - #26
fix(admin): automod-bypass reports success when a Discord role change fails#26SebTardif wants to merge 1 commit into
Conversation
Await addRole/removeRole on /admin automod-bypass-toggle. Reply with an ephemeral error when Discord rejects the role change, and only report success after the role update resolves. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 21, 2026, 6:59 PM ET / 22:59 UTC. ClawSweeper reviewWhat this changesThe PR awaits Discord automod-bypass role changes, shows an ephemeral failure on rejection, and adds regression tests for both outcomes. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain Current main still reports success before a rejected Discord role update settles, so this PR remains necessary. The core fix is sound, but unchanged P2 policy violations and mock-only proof block merge readiness. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherThe Discord admin command changes a member’s automod-bypass role and then privately reports the outcome to the administrator. The role controls whether automod applies to that member, so the acknowledgement must match the completed mutation. flowchart LR
A[Discord administrator] --> B[Admin command]
B --> C[Member role update]
C --> D{Discord accepted update?}
D -->|Yes| E[Private success reply]
D -->|No| F[Private failure reply]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Preserve the awaited mutation flow, render both failure paths with Carbon v2 components backed by configured automod copy, and add redacted proof from a real Discord role operation. Do we have a high-confidence way to reproduce the issue? Yes. Current main visibly discards the rejected role-update promise before sending success, and the PR’s focused tests encode that rejected-operation path. Is this the best way to solve the issue? No. Awaiting the Discord mutation is the right repair, but the new failure replies must use Carbon v2 components and configuration-driven automod copy. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 17a621b47dba. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
What Problem This Solves
Fixes an issue where Discord admins running
/admin automod-bypass-togglewould be told the automod bypass role was added or removed even when Discord rejected the role change (missing permissions, role hierarchy, or API error). The member's roles stayed the same while the command reported a new security state.That false success is worse than a failed command: staff can believe someone is exempt from automod when they are not, or believe a bypass was revoked when it is still attached.
Why This Change Was Made
/admin automod-bypass-togglenow waits foraddRole/removeRoleto finish. If Discord rejects the change, the command replies with an ephemeral error and does not claim success. The previous success copy is sent only after the role update resolves./admin inactivity-warnis unchanged.User Impact
Admins get an accurate private reply about whether automod bypass was actually granted or removed. A Discord API failure no longer looks like a completed security change.
Evidence
Live
bunrun of/tmp/proof-hermit-automod.tsagainst this branch. The script calls the previous fire-and-forget handler and the patchedAutomodBypassToggle.runwith a Discord member whoseaddRole/removeRolethrowsMissing Permissions, then prints the command replies.Before this patch the command always printed the success sentence. After the patch a rejected role update prints
Failed to add/remove automod bypass role.and the success sentence is reserved for a resolved role update.Real behavior proof
Behavior or issue addressed:
/admin automod-bypass-togglereported that automod bypass was added or removed even when Discord rejected the role change, so staff could act on a false security state.Real environment tested: macOS 26.6.1 Darwin 25.6.0 arm64, Node v26.7.0, bun 1.3.14, patched checkout
/tmp/oc-impl-hermit-automodonfix/automod-bypass-role-errors(base97d3731).Exact steps or command run after this patch:
Evidence after fix: terminal output from the patched command class:
Observed result after fix: A rejected
addRole/removeRolenow repliesFailed to add automod bypass role.orFailed to remove automod bypass role.(ephemeral). The success sentence is printed only after the role update resolves.What was not tested: A live Discord guild with a real role hierarchy or missing-permissions token. The inactivity-warn thread member path is unchanged.
Origin
This behavior landed in 3e71d04 (
admin and team lead commands, 2026-04-07) and has been present for 130 days.user.addRole(...).catch(() => {})/user.removeRole(...).catch(() => {})discarded the Discord error, then the command still replied with the success sentence.Sibling
/rolealready awaitsaddRole/removeRolebefore replying. Beta Pings already replies privately when the Discord role update throws.