Skip to content

feat: add bot mention stripping and enable cross-channel responses wh…#13

Open
kpj2006 wants to merge 2 commits into
AOSSIE-Org:mainfrom
kpj2006:main
Open

feat: add bot mention stripping and enable cross-channel responses wh…#13
kpj2006 wants to merge 2 commits into
AOSSIE-Org:mainfrom
kpj2006:main

Conversation

@kpj2006

@kpj2006 kpj2006 commented Jun 27, 2026

Copy link
Copy Markdown
Member

…en tagged

Addressed Issues:

Fixes #(issue number)

Screenshots/Recordings:

Additional Notes:

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

  • Bug Fixes
    • Bot mentions are now removed from thread history and current questions, making replies cleaner and more accurate.
    • New thread titles now use cleaned, truncated message text instead of raw mentions.
    • The bot now responds more reliably in configured channel threads and when explicitly mentioned, while ignoring unrelated messages.
    • Error and fallback handling now use the cleaned user message for clearer logging and better context.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@kpj2006, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 30 minutes and 16 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a2f65ddc-4348-41b2-9345-f4b0bb3acf92

📥 Commits

Reviewing files that changed from the base of the PR and between db56eee and ef3aeb9.

📒 Files selected for processing (1)
  • bot.py

Walkthrough

The PR adds bot-mention stripping to thread context, thread titles, routing, prompt selection, and failure logs. Messages are now processed when they match the configured channel context or explicitly mention the bot, and cleaned text is used throughout the question flow.

Changes

Bot mention handling and cleaned query flow

Layer / File(s) Summary
Mention cleanup and thread context
bot.py
Adds clean_bot_mention and applies it to thread history formatting and new thread titles.
Message routing and prompt input
bot.py
Updates message gating to honor explicit bot mentions and passes cleaned_query into prompt selection.
Cleaned-query logging
bot.py
Switches thread-creation, insufficient-info, fallback, and error logs to record cleaned_query.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • AOSSIE-Org/SkillBot issue 7: The PR changes process_message trigger conditions for threads and explicit bot mentions, matching the issue’s routing-related scope.

Suggested labels

Python Lang

Poem

🐰 I hopped through threads with a nose so keen,
I shaved off mentions, neat and clean.
My questions now are trimmed just right,
and logs stay tidy in the night.
Hop-hop—replying feels so bright!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: stripping bot mentions and allowing responses when the bot is tagged.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added no-issue-linked PR is not linked to any issue backend Changes to backend code python Python code changes size/S Small PR (11-50 lines changed) repeat-contributor PR from an external contributor who already had PRs merged needs-review labels Jun 27, 2026
@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor
Messages
📖

⚠️ PR Template Check

These are non-blocking, but please fix:

  • Please replace the placeholder Fixes #(issue number) with the actual issue number (e.g. Fixes #42).

  • Some required checklist items are not completed:

  • My PR addresses a single issue

  • My code follows the project's code style

  • My changes generate no new warnings or errors

Generated by 🚫 dangerJS against ef3aeb9

@kpj2006

kpj2006 commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

@CodeRabbit

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

@kpj2006 I'll review the changes on this PR.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bot.py`:
- Around line 39-43: The cleanup in clean_bot_mention is removing every bot
mention token anywhere in the message; change it so only a leading invocation
mention/prefix is stripped and any later <`@bot`> occurrences remain intact.
Update the mention handling logic in clean_bot_mention (and the related call
sites that rely on it) to match only the start of the content, preserving
in-body mention syntax for the model.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d734fae2-bea5-4e03-b50a-f3261f2f2d63

📥 Commits

Reviewing files that changed from the base of the PR and between 5a8b4bc and db56eee.

📒 Files selected for processing (1)
  • bot.py

Comment thread bot.py
@kpj2006 kpj2006 added the gsoc label Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Changes to backend code gsoc needs-review no-issue-linked PR is not linked to any issue python Python code changes repeat-contributor PR from an external contributor who already had PRs merged size/S Small PR (11-50 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant