fix(discord): ignore system messages so thread renames don't reach the agent#51
fix(discord): ignore system messages so thread renames don't reach the agent#51scriptease wants to merge 2 commits into
Conversation
…e agent A thread rename emits a messageCreate system message whose content is the new thread name. With no system-message guard it was enqueued to the agent as a bare message. Filter message.system early (also drops pins, joins, etc). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(discord): ignore system messages so thread renames don't reach the agent
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA one-line early-return guard is added to ChangesSystem Message Early-Return Guard
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Problem
When a user renames a Discord thread the AI is working in, Discord emits a
messageCreateevent carrying a system message (MessageType.ChannelNameChange). Itsauthoris the renaming user (not a bot) and itscontentis the new thread name. The handler had no system-message guard, so it passed every check and enqueued a bare message containing just the new thread name to the agent.Fix
One-line guard in
src/providers/discord/messageCreate.ts:message.systemistruefor all Discord system messages (thread renames, pins, member joins, etc.), so this also filters other system-message noise that should never reach the agent.Tests
Added regression test
handleMessageCreate ignores system messages (e.g. thread rename). All 212 tests pass.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests