Devr.AI icon indicating copy to clipboard operation
Devr.AI copied to clipboard

feat: Proactive contributor assistance with lightweight pattern detection

Open mahek2016 opened this issue 9 months ago β€’ 3 comments

Closes #258

πŸ“ Description

This PR introduces a proactive contributor assistance layer to Devr.AI.

Before calling the LLM for every message, the system now performs lightweight pattern-based detection to identify common contributor intents such as greetings, onboarding questions, and issue discovery queries.

This improves responsiveness, reduces unnecessary LLM API calls, and provides a smoother onboarding experience for new contributors.

The implementation is modular and can be extended later with caching, fuzzy matching, or advanced intent detection.

πŸ”§ Changes Made

  • Added _simple_pattern_match() in classification_router.py
  • Implemented lightweight intent detection before LLM invocation
  • Added proactive response handling in discord/bot.py
  • Reduced unnecessary LLM calls for simple messages
  • Maintained backward compatibility with existing classification flow

πŸ“· Screenshots or Visual Changes (if applicable)

N/A – Backend and bot behavior enhancement (no UI changes)

🀝 Collaboration

Collaborated with: N/A

βœ… Checklist

  • [x] I have read the contributing guidelines.
  • [ ] I have added tests that prove my fix is effective or that my feature works.
  • [x] I have added necessary documentation (if applicable).
  • [x] Any dependent changes have been merged and published in downstream modules.

Summary by CodeRabbit

  • New Features

    • Add a public endpoint and in-app command to fetch beginner-friendly "good first issue" suggestions from GitHub.
    • Discord bot now processes messages directly and delivers multi-part, faster responses with updated greetings.
  • Improvements

    • Introduces lightweight rule-based intent detection for quicker, deterministic triage and clearer fallback handling.
    • More consistent error responses and logging for GitHub issue lookups.

mahek2016 avatar Feb 18 '26 18:02 mahek2016

πŸ“ Walkthrough

Walkthrough

Replaces LLM-driven triage with lightweight rule-based and service-backed flows across the devrel stack: adds private pattern/fallback triage helpers, swaps Discord queue/agent execution for direct GitHubToolkit calls, introduces IssueSuggestionService and new GitHub API endpoints/routes, and updates main app and requirements accordingly.

Changes

Cohort / File(s) Summary
Classification Router
backend/app/classification/classification_router.py
Adds _simple_pattern_match() and _fallback_triage() helpers; updates should_process_message() to include a disabled pattern-match Step 1 and retains LLM fallback; changes prompt/context formatting and JSON-block parsing with a dedicated LLM fallback path.
Discord bot β€” direct toolkit execution
backend/integrations/discord/bot.py
Removes queue/agent integration and AsyncQueueManager usage; constructor signature simplified to __init__(**kwargs); on_message now directly invokes GitHubToolkit and returns toolkit results to users; removes queue handler registration and related methods.
GitHub toolkit & intent changes
backend/app/agents/devrel/github/github_toolkit.py
Replaces LLM-based classification with rule-based keyword classifier in classify_intent; integrates IssueSuggestionService for find_good_first_issues; expands execute flow to handle new intent branches and returns structured results.
Issue suggestion service (new)
backend/app/agents/devrel/github/services/issue_suggestion_service.py, backend/services/github/issue_suggestion_service.py
Adds IssueSuggestionService to query GitHub Search Issues API for "good first issue" results, parse items, and return simplified issue lists; handles auth and non-200 responses.
API additions & routes
backend/app/api/router.py, backend/app/api/v1/github.py, backend/routes.py
Registers new /v1/github router and adds /beginner-issues endpoints; initializes IssueSuggestionService with token and exposes beginner-issues handlers with error handling.
Application bootstrap & deps
backend/main.py, backend/requirements.txt
Removes agent/queue/weaviate boot paths, simplifies background task lifecycle to Discord bot only, relaxes CORS to "*", and substantially trims/updates Python dependencies list.

Sequence Diagram(s)

sequenceDiagram
    participant User as User (Discord)
    participant Bot as Discord Bot
    participant Toolkit as GitHubToolkit
    participant Service as IssueSuggestionService
    participant GitHub as GitHub API

    User->>Bot: message (question / request)
    Bot->>Toolkit: classify_intent / execute(message)
    Toolkit->>Toolkit: rule-based intent classification
    alt find_good_first_issues
        Toolkit->>Service: fetch_global_beginner_issues(query)
        Service->>GitHub: GET /search/issues (Bearer token)
        GitHub-->>Service: search results (JSON)
        Service-->>Toolkit: list of simplified issues
        Toolkit-->>Bot: structured result with issues
    else other intents
        Toolkit->>Toolkit: dispatch to appropriate handler (web_search, contributor_recommendation, etc.)
        Toolkit-->>Bot: structured result or placeholder
    end
    Bot->>User: send formatted response (issues or handler output)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • AOSSIE-Org/Devr.AI#110: Modifies the devrel GitHub toolkit’s classification/execute flow; likely overlaps with the new rule-based classifier and issue-suggestion paths.
  • AOSSIE-Org/Devr.AI#131: Also edits backend/app/agents/devrel/github/github_toolkit.py; may conflict with intent handling or execution branching.
  • AOSSIE-Org/Devr.AI#90: Touches ClassificationRouter and triage flow changes similar to this PR’s additions.

Suggested reviewers

  • smokeyScraper

Poem

🐰 I hopped through code, my whiskers twitching bright,
I sniffed out issues that welcome a first-time bite,
With tiny paws I fetch the helpful links you need,
No bulky LLMs β€” just a nimble rabbit speed,
Hop on, contribute β€” I’ll point you to the seed 🌱

πŸš₯ Pre-merge checks | βœ… 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Pull request includes in-scope pattern matching and rule-based classification alongside significant out-of-scope changes: complete queue system replacement, APIRouter introduction, dependency restructuring, and Discord bot refactoring unrelated to proactive assistance feature. Separate queue system removal, API route changes, and dependency updates into distinct pull requests; keep this PR focused on pattern matching and proactive response handling only.
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive Implementation partially addresses issue #258 objectives: adds pattern-based intent detection and proactive response handling, but lacks conversation tracking across platforms, maintainer analytics, feedback loops, and structured onboarding guidance. While lightweight pattern detection is implemented, consider a roadmap for platform tracking, analytics dashboard, feedback mechanisms, and structured onboarding flows mentioned in the feature request for future phases.
βœ… Passed checks (2 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title accurately reflects the main changes: introduces lightweight pattern detection for proactive contributor assistance, which is the primary technical addition across the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • [ ] πŸ“ Generate docstrings (stacked PR)
  • [ ] πŸ“ Generate docstrings (commit on current branch)
πŸ§ͺ Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

[!TIP] Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

coderabbitai[bot] avatar Feb 18 '26 18:02 coderabbitai[bot]

@coderabbitai Thanks for the review!

  • Removed the unreachable acknowledgment branch.
  • Replaced the Unicode apostrophe with an ASCII apostrophe for consistency.

All review suggestions have been addressed. Please let me know if anything else needs improvement.

mahek2016 avatar Feb 19 '26 09:02 mahek2016

Update: Phase 2 enhancements added.

This PR now includes:

  • Global beginner issue search
  • GitHub API integration
  • Rule-based issue classification
  • Real-time issue suggestions via Discord

Ready for review. πŸš€

mahek2016 avatar Feb 21 '26 09:02 mahek2016