Skip to content

About

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

16 Commits

Folders and files

Repository files navigation

πŸ•΅οΈ Duplicate Hunter

AI-assisted duplicate detection for GitHub Issues and Pull Requests.

Duplicate Hunter is a GitHub App for detecting duplicate GitHub issues and pull requests, explaining matching evidence, and helping open-source maintainers review potential duplicates before closing anything.

CI License Node TypeScript

GitHub App Β· GitHub Marketplace Β· Duplicate Issue Detection Β· Duplicate Pull Request Detection Β· AI-assisted Developer Tool

[!IMPORTANT] Core Principle: Duplicate Hunter must never automatically close an issue or pull request based solely on AI analysis.

Workflow: Detect β†’ Explain β†’ Suggest β†’ Maintainer decides


🌟 Key Highlights

  • Explainable Evidence: Instead of an opaque number like Similarity: 93%, Duplicate Hunter explains the exact evidence (matching exception names, stack trace frames, reproduction steps, component names, and environment differences).
  • False-Positive Protection: Prefers "Potentially related" over "This is definitely a duplicate". Never marks issues as duplicate without explicit maintainer confirmation.
  • Bot Idempotency: Checks whether Duplicate Hunter already commented, avoids spamming repeated comments, and updates existing reports only when analysis materially changes.
  • Provider-Independent AI: Works out of the box with zero external network dependencies using built-in deterministic subword feature hashing, and optionally supports OpenAI (text-embedding-3-small) or local Ollama instances.
  • Security-First Architecture: Treats all issue content as untrusted input. Protects against prompt injection attacks, delimiter hijacking, and ReDoS.
  • Modern Maintainer Dashboard: Next.js + React + Tailwind CSS dashboard providing overview metrics, recent detections, live maintainer review buttons, interactive test simulator, and one-click GDPR data deletion.

πŸ’¬ Example Comment Generated by Duplicate Hunter

When a new issue is opened, Duplicate Hunter posts a structured, developer-focused comment:

### πŸ•΅οΈ Duplicate Hunter

I found **2 potentially related issues**.

#### #1927 β€” Crash during CSV import

**Confidence: High**

Matching signals:

* βœ“ Same CSV import operation
* βœ“ Similar crash description
* βœ“ Same `NullReferenceException`
* βœ“ Similar reproduction steps
* βœ“ Same affected component

#### #2144 β€” Application crashes with large CSV files

**Confidence: Medium**

Matching signals:

* βœ“ CSV import
* βœ“ Large file handling
* βœ“ Application crash

### Difference

The new issue reports Windows 11, while #1927 was reported on Windows 10.

⚠️ **This may be a duplicate. Please review before closing.**

[View #1927](https://github.com/org/repo/issues/1927) [View #2144](https://github.com/org/repo/issues/2144)

πŸ”„ Detection Modes

  1. Issue β†’ Issue: Finds potentially duplicate existing open issues.
  2. Issue β†’ PR: Detects whether an existing pull request already addresses the reported issue ("πŸ’‘ This issue may already be addressed by PR #782").
  3. PR β†’ PR: Detects overlapping or duplicate pull requests across contributors.
  4. Issue β†’ Closed Issue: Identifies solved historical issues and links to the resolving release tag.

πŸ“ Architecture & Monorepo Structure

duplicate-hunter/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/               # Next.js 14 Maintainer Dashboard, Simulator & REST API
β”‚   └── github-app/        # Standalone GitHub App webhook listener & worker service
β”‚
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ core/              # Domain models, scoring weights, constants & types
β”‚   β”œβ”€β”€ config/            # YAML parser & schema validator for .github/duplicate-hunter.yml
β”‚   β”œβ”€β”€ similarity/        # Signal extractors (errors, stack traces, OS, repro steps) & scoring
β”‚   β”œβ”€β”€ ai/                # Embedding & Analysis providers (Local, OpenAI, Ollama, Sanitizer)
β”‚   β”œβ”€β”€ github/            # Octokit wrapper, HMAC webhook verification, comment formatter & checks
β”‚   └── database/          # Persistent store, PostgreSQL schema, stats, and privacy deletion
β”‚
β”œβ”€β”€ docs/                  # Architecture, security model, privacy policy, and setup guides
β”œβ”€β”€ tests/                 # Comprehensive unit & integration test suites
β”œβ”€β”€ .github/               # Issue templates, workflows, and default repository config
β”œβ”€β”€ docker-compose.yml     # Multi-container production deployment with pgvector
β”œβ”€β”€ Dockerfile             # Multi-stage production container image
β”œβ”€β”€ LICENSE                # Apache 2.0
└── README.md

βš™οΈ Configuration (.github/duplicate-hunter.yml)

Repositories can customize Duplicate Hunter by committing .github/duplicate-hunter.yml:

enabled: true

issues:
  enabled: true
  threshold: 0.78            # Minimum score to consider an issue related (0.1 - 1.0)
  searchClosedIssues: true    # Compare against solved historical issues
  maxLookbackIssues: 500     # Number of recent issues to evaluate

pullRequests:
  enabled: true
  threshold: 0.80            # Minimum score for PR duplicate matching

maxCandidates: 5             # Maximum candidate matches to report

comment:
  enabled: true
  minConfidence: medium      # Options: high | medium | low
  header: "### πŸ•΅οΈ Duplicate Hunter"

labels:
  enabled: true
  label: possible-duplicate  # Automatically applied label (never definitive 'duplicate')
  reviewLabel: duplicate-review

checks:
  enabled: true
  failureMode: neutral       # Options: neutral | failure | success

confidenceWeights:
  semantic: 0.35
  error: 0.20
  component: 0.15
  reproduction: 0.10
  environment: 0.08
  version: 0.05
  label: 0.04
  referencedCode: 0.03

ai:
  provider: local            # Options: local | openai | ollama
  # model: text-embedding-3-small

retentionDays: 90

πŸ“Š Maintainer Dashboard

The web dashboard (apps/web) provides maintainers with:

  • Overview Metrics: Issues analyzed, potential duplicates, confirmed duplicates, false positives, issues saved.
  • Recent Detections Table: Review candidates, inspect signal checklists and differences, and record decisions:
    • Confirmed Duplicate
    • Related
    • Not Related
    • False Positive
  • Interactive Simulator: Test any two issues or stack traces in real time before deployment.
  • Repository Settings Editor: Adjust thresholds, AI providers, and labels with instant preview.
  • Privacy & Security Controls: Review data transmission policy and trigger one-click permanent repository data deletion.

πŸš€ Quick Start & Local Development

Prerequisites

  • Node.js 20.x or higher
  • npm 10.x or higher

1. Install Dependencies

npm install

2. Run Test Suite

npm test

Duplicate Hunter includes a complete test suite covering webhook signature validation, prompt injection defense, signal extraction, similarity fixtures, bot idempotency, and maintainer reviews.

3. Start Web Dashboard

npm run dev:web

Open http://localhost:3000 in your browser.

4. Start Standalone GitHub Bot Server

npm run dev:bot

The webhook listener will run at http://localhost:3001/api/webhook.


πŸ”’ Security & Privacy

  • Untrusted Input Sanitization: All issue descriptions and comments are sanitized to neutralize prompt injection attacks (IGNORE PREVIOUS INSTRUCTIONS, [INST], <|system|>).
  • Cryptographic Signature Verification: Webhook payloads are verified with crypto.timingSafeEqual and HMAC-SHA256.
  • Zero Third-Party Leaks by Default: The default local provider executes 100% offline with zero external network calls.
  • Data Deletion Mechanism: Permanent deletion API available at DELETE /api/repositories/:id/data.

For full details, see docs/security.md and docs/privacy.md.


πŸ—ΊοΈ Future Roadmap

  • v1.0: Issue β†’ Issue duplicate detection with explainable signals
  • v1.1: Closed issue historical detection & release tag matching
  • v1.2: Issue β†’ Pull Request resolution suggestion
  • v1.3: PR β†’ PR overlap detection
  • v1.4: GitHub Checks API integration
  • v1.5: Maintainer Feedback Review loop & Web Dashboard
  • v2.0: Repository-wide duplicate graph & cluster visualizer
  • v2.1: Adaptive weight auto-tuning from maintainer feedback
  • v2.2: Abstract Syntax Tree (AST) code-aware similarity
  • v2.3: Cross-repository duplicate detection for multi-repo orgs
  • v3.0: Full repository AI intelligence & automated triage

πŸ“„ License

Licensed under the Apache License, Version 2.0.

About

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages