Skip to content

feat: configurable AI channel blocklist (#180)#187

Closed
BillChirico wants to merge 11 commits intomainfrom
feat/issue-180
Closed

feat: configurable AI channel blocklist (#180)#187
BillChirico wants to merge 11 commits intomainfrom
feat/issue-180

Conversation

@BillChirico
Copy link
Collaborator

Implements configurable AI channel blocklist.

Changes

  • Add ai.blockedChannelIds config array (default: [])
  • Create isChannelBlocked() function with thread support
  • Block AI responses in blocked channels
  • Dashboard UI with ChannelSelector
  • Config validation
  • Unit tests

Testing

  • All tests passing
  • Lint checks pass

Closes #180

Copilot AI review requested due to automatic review settings March 2, 2026 01:13
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

Warning

Rate limit exceeded

@BillChirico has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 49 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 135cd2e and dcad790.

📒 Files selected for processing (8)
  • config.json
  • src/api/utils/configValidation.js
  • src/modules/ai.js
  • src/modules/events.js
  • tests/modules/ai.test.js
  • tests/modules/events.test.js
  • web/src/components/dashboard/config-editor.tsx
  • web/src/types/config.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/issue-180

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a configurable AI channel blocklist so guild admins can prevent AI responses (and triage processing) in selected channels (including threads), with corresponding dashboard UI, config schema updates, and unit tests.

Changes:

  • Add ai.blockedChannelIds to the web config types and seed config.json defaults.
  • Add dashboard UI to edit blocked channels via ChannelSelector.
  • Add isChannelBlocked() helper + message/triage gating in the message-create handler, plus unit tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
web/src/types/config.ts Adds blockedChannelIds to the AiConfig type.
web/src/components/dashboard/config-editor.tsx Adds UI and draft-config updater for selecting blocked channels.
src/modules/ai.js Introduces isChannelBlocked() helper used to enforce the blocklist.
src/modules/events.js Skips AI mention/reply handling and triage accumulation for blocked channels (incl. threads).
src/api/utils/configValidation.js Allows ai.blockedChannelIds in the writable config schema.
tests/modules/ai.test.js Adds unit tests for isChannelBlocked().
config.json Seeds default ai.blockedChannelIds: [] (plus unrelated encoding-only string changes).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@greptile-apps
Copy link

greptile-apps bot commented Mar 2, 2026

Greptile Summary

This PR implements a configurable AI channel blocklist feature that allows server administrators to prevent the bot from responding in specific channels. The implementation is well-designed with proper thread support (blocking a parent channel blocks all threads within it) and comprehensive test coverage.

Key Implementation Details:

  • isChannelBlocked() function with per-guild configuration support and graceful error handling (fails open if config isn't loaded)
  • Blocklist check strategically placed in events.js to prevent both immediate AI responses and message accumulation
  • Dashboard UI uses ChannelSelector filtered to text channels only
  • Config validation properly updated to accept the new array field

Testing:

  • Unit tests cover all edge cases including null parents, empty arrays, config errors, and thread inheritance
  • Integration tests verify blocklist works for mentions, non-mentions, threads, and allows non-blocked channels

The implementation follows existing patterns in the codebase and maintains consistency with other channel filtering features.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-tested with comprehensive unit and integration tests. The logic is sound with proper error handling (fail-open pattern), thread support, and per-guild configuration. All changes follow existing patterns and maintain backward compatibility with empty array default.
  • No files require special attention

Important Files Changed

Filename Overview
src/modules/ai.js Added isChannelBlocked() function with proper thread support and error handling
src/modules/events.js Integrated blocklist check before AI responses; correctly handles both mentions and general accumulation
tests/modules/ai.test.js Comprehensive unit tests for isChannelBlocked covering all edge cases including error handling
tests/modules/events.test.js Added integration tests for blocklist in messageCreate handler covering mentions, non-mentions, and threads
web/src/components/dashboard/config-editor.tsx Added ChannelSelector UI for blocklist configuration with proper filtering for text channels only

Last reviewed commit: dcad790

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 2, 2026
@BillChirico
Copy link
Collaborator Author

Superseded by #192 - rebased on latest main to resolve BEHIND status.

@BillChirico BillChirico closed this Mar 2, 2026
@BillChirico BillChirico deleted the feat/issue-180 branch March 2, 2026 01:51
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.

feat: configurable AI channel blocklist

2 participants