Skip to content

Add generate common issues feature from conversations #904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Add generate common issues feature from conversations

Summary

This PR adds a "Generate common issues" feature to the common issues settings page that appears in the empty state. The feature uses AI to analyze existing conversations in the mailbox and automatically suggests common issue categories that can be created.

Key Changes:

  • New AI generation logic (lib/ai/generateCommonIssues.ts) that analyzes conversation subjects and recent messages to identify recurring patterns
  • New tRPC mutation (trpc/router/mailbox/issueGroups.generateFromConversations) that handles the generation flow and creates database records
  • Updated UI (commonIssuesSetting.tsx) with a "Generate common issues" button in the empty state, including loading states and error handling

The feature analyzes up to 50 recent conversations (both open and closed) and uses AI to identify 3-7 common issue categories based on recurring themes, technical problems, billing issues, and other patterns.

Review & Testing Checklist for Human

⚠️ CRITICAL: These changes were NOT tested locally due to database setup issues - thorough testing is essential

  • Test the complete end-to-end flow: Navigate to common issues settings when empty, click "Generate common issues" button, verify issues are created and displayed
  • Verify AI generation quality: Test with real conversation data to ensure generated issue titles and descriptions make sense and are useful
  • Test error scenarios: Verify behavior when no conversations exist, when AI fails, when database operations fail
  • Check performance: Test with mailboxes containing many conversations to ensure reasonable response times
  • Verify UI/UX: Confirm button styling matches design system, loading states work correctly, success/error messages display properly

Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    UI["app/(dashboard)/settings/<br/>common-issues/<br/>commonIssuesSetting.tsx"]:::major-edit
    TrpcRouter["trpc/router/mailbox/<br/>issueGroups.ts"]:::major-edit
    AILogic["lib/ai/<br/>generateCommonIssues.ts"]:::major-edit
    SearchConv["lib/data/conversation/<br/>search.ts"]:::context
    AICore["lib/ai/index.ts<br/>(runAIObjectQuery)"]:::context
    Schema["db/schema/<br/>issueGroups"]:::context

    UI -->|"generateFromConversations<br/>mutation"| TrpcRouter
    TrpcRouter -->|"calls"| AILogic
    AILogic -->|"searches conversations"| SearchConv
    AILogic -->|"makes AI request"| AICore
    TrpcRouter -->|"inserts records"| Schema

    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB  
    classDef context fill:#FFFFFF

    subgraph Legend
        L1["Major Edit"]:::major-edit
        L2["Minor Edit"]:::minor-edit
        L3["Context/No Edit"]:::context
    end
Loading

Notes

  • The AI analysis focuses on conversation subjects and recent message text to identify patterns
  • Uses the same runAIObjectQuery pattern as existing AI features in the codebase
  • Button follows design system guidelines (sentence case: "Generate common issues")
  • Database operations use Promise.all for parallel inserts but lack explicit transaction handling
  • Feature is only shown in empty state to avoid overwhelming users with too many generated issues

Link to Devin run: https://app.devin.ai/sessions/426a880d18a542b18983877207d521d9
Requested by: @slavingia

- Add AI-powered analysis of existing conversations to suggest common issue categories
- Create new tRPC mutation for generating issues from conversation patterns
- Update common issues settings UI with generate button in empty state
- Include loading states and proper error handling

Co-Authored-By: Sahil Lavingia <[email protected]>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor

coderabbitai bot commented Aug 10, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Join our Discord community for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

supabase bot commented Aug 10, 2025

Updates to Preview Branch (devin/1754867311-generate-common-issues) ↗︎

Deployments Status Updated
Database Mon, 11 Aug 2025 00:25:41 UTC
Services Mon, 11 Aug 2025 00:25:41 UTC
APIs Mon, 11 Aug 2025 00:25:41 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Mon, 11 Aug 2025 00:25:41 UTC
Migrations Mon, 11 Aug 2025 00:25:41 UTC
Seeding Mon, 11 Aug 2025 00:25:41 UTC
Edge Functions Mon, 11 Aug 2025 00:25:41 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

Copy link

vercel bot commented Aug 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
helper-marketing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 11, 2025 0:26am

- Update generate button variant to match component type definitions
- Resolves TypeScript compilation error in CI

Co-Authored-By: Sahil Lavingia <[email protected]>
@slavingia
Copy link
Collaborator

Add an approval step where someone can see the issues generated and edit/delete them

And e2e tests

@slavingia slavingia added the $5k label Aug 10, 2025
devin-ai-integration bot and others added 2 commits August 11, 2025 00:03
- Add missing GenerateIssuesDialog import and usage in commonIssuesSetting.tsx
- Improve TypeScript types for generated suggestions
- Add comprehensive e2e tests covering approval dialog functionality
- Complete integration of approval dialog with existing UI
- Addresses user feedback on PR #904 for approval step and e2e tests

Co-Authored-By: Sahil Lavingia <[email protected]>
- Keep generateSuggestions mutation for approval step implementation
- Maintain separation between suggestion generation and issue creation
- Preserve createFromSuggestions mutation for approval workflow

Co-Authored-By: Sahil Lavingia <[email protected]>
- Remove unused X import from lucide-react
- Resolves autofix CI failure

Co-Authored-By: Sahil Lavingia <[email protected]>
@sankalp1999
Copy link
Contributor

Will this bounty go to Devin xD?

@sankalp1999
Copy link
Contributor

@slavingia "Review & Testing Checklist for Human" Is this open for external contributors?

@slavingia
Copy link
Collaborator

It's OSS - anything is open!

@slavingia slavingia added $2.5k and removed $5k labels Aug 11, 2025
@slavingia slavingia removed their assignment Aug 11, 2025
@slavingia slavingia requested review from binary-koan and removed request for slavingia August 11, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants