Skip to content

Handle expected Twitch ban rejections without agent alerts - #1745

Merged
kevmo314 merged 2 commits into
mainfrom
fix/twitch-moderation-rejections
Oct 29, 2026
Merged

kevmo314 merged 2 commits into
mainfrom
fix/twitch-moderation-rejections

Conversation

@kevmo314

@kevmo314 kevmo314 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

The Agent issues alert recorded an authenticated Twitch /ban request on 2026-10-28 at 22:51:55 UTC: Twitch returned HTTP 400, but the agent returned HTTP 500/INTERNAL and emitted an Error Reporting event. The existing log does not retain Twitch's response message, so the exact rejection in that incident cannot be recovered.

Recognize known ban-state rejections (already banned, not banned, and protected targets) and return a callable failed-precondition with a fixed, safe message. These responses use HTTP 400 and informational request logs. Unknown 400s, missing-parameter errors, permission failures, transport errors, and 5xx responses retain error reporting. The moderation lookup also returns not-found before submitting an invalid ban/unban/timeout request when Twitch returns no matching user.

The room-readiness test keeps its fake connection open until its assertion completes, so cancellation cannot race with connection completion.

Regression tests exercise the callable protocol through the real Twitch client, verify reporting severity and response-body redaction, retain existing rate-limit behavior, and check that missing users cause no moderation request. Validation passed: CI=true TWITCH_CLI=/tmp/rtchat-twitch-cli/twitch go test -race ./..., go vet ./..., and git diff --check. The room-readiness fixture also passed 1,000 race-enabled repetitions.

Twitch documents these HTTP 400 ban-state rejections: https://dev.twitch.tv/docs/api/reference/#ban-user and https://dev.twitch.tv/docs/api/reference/#unban-user.

@kevmo314
kevmo314 merged commit 3b1983c into main Oct 29, 2026
8 checks passed
@kevmo314
kevmo314 deleted the fix/twitch-moderation-rejections branch October 29, 2026 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant