60e0ffc959
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
132 lines
6.1 KiB
YAML
132 lines
6.1 KiB
YAML
name: Marvin Issue Dedupe
|
|
# description: Automatically dedupe GitHub issues using Marvin
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
workflow_dispatch:
|
|
inputs:
|
|
issue_number:
|
|
description: "Issue number to process for duplicate detection"
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
marvin-dedupe-issues:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Generate Marvin App token
|
|
id: marvin-token
|
|
uses: actions/create-github-app-token@v3
|
|
with:
|
|
app-id: ${{ secrets.MARVIN_APP_ID }}
|
|
private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }}
|
|
|
|
- name: Set dedupe prompt
|
|
id: dedupe-prompt
|
|
run: |
|
|
cat >> $GITHUB_OUTPUT << 'EOF'
|
|
PROMPT<<PROMPT_END
|
|
Find up to 3 likely duplicate issues for GitHub issue ${{ github.repository }}/issues/${{ github.event.issue.number || inputs.issue_number }}.
|
|
|
|
# Core Principle
|
|
Silence is better than noise. A false positive wastes a human's time and erodes trust in every future report. Most runs should end with no comment — that means the system is working.
|
|
|
|
# Steps
|
|
|
|
1. Check if the GitHub issue (a) is closed, (b) does not need to be deduped (eg. because it is broad product feedback without a specific solution, or positive feedback), or (c) already has a duplicates comment that you made earlier. If so, do not proceed.
|
|
|
|
2. View the GitHub issue and produce a summary of the issue.
|
|
|
|
3. Launch 3 parallel agents using the Task tool to search GitHub for duplicates, using diverse keywords and search approaches, using the summary from step 2.
|
|
|
|
4. Filter aggressively for false positives. The bar for "duplicate" is high:
|
|
|
|
A duplicate means the SAME bug or the SAME feature request. Apply this test to every candidate:
|
|
- **Same fix test**: Could the candidate be closed by the exact same code change? If not, not a duplicate.
|
|
- **Same symptom test**: Does the user experience the exact same broken behavior? "Both involve middleware" is not duplication. "Both get TypeError on line 42 of proxy.py when calling mount()" is duplication.
|
|
- **Same request test** (for features): Are they asking for the same specific capability? "Both want better auth" is not duplication. "Both request OAuth PKCE flow for CLI login" is duplication.
|
|
|
|
Candidates found by only one search agent deserve extra scrutiny — a single keyword match is often a false positive.
|
|
|
|
When in doubt, do not flag. A missed duplicate is harmless; a false positive wastes the reporter's time.
|
|
If there are no duplicates remaining, do not proceed — just exit.
|
|
|
|
5. **Quality gate**: Before commenting, re-read each candidate as a skeptical reviewer. For each one, ask: "Would a maintainer who knows this codebase agree this is a duplicate, or would they dismiss it?" If you'd need to hedge with "might" or "possibly," drop it.
|
|
|
|
6. Comment back on the issue with your findings (or exit silently if none remain). Do NOT add any labels — labeling is handled by a later workflow step.
|
|
|
|
# Notes for your agents
|
|
- Use `gh` to interact with GitHub, rather than web fetch
|
|
- Do not use other tools beyond `gh` and Task (no MCP servers, file edit, etc.)
|
|
- Never include this issue as a duplicate of itself
|
|
- When searching, read the FULL body of candidate issues — titles alone are not enough to judge duplication
|
|
|
|
For your comment, follow this format precisely (example with 3 suspected duplicates):
|
|
|
|
---
|
|
Found 3 possible duplicate issues:
|
|
|
|
1. #123: Issue title here
|
|
2. #456: Another issue title
|
|
3. #789: Third issue title
|
|
|
|
This issue will be automatically closed as a duplicate in 3 days.
|
|
|
|
- If your issue is a duplicate, please close it and 👍 the existing issue instead
|
|
- To prevent auto-closure, add a comment or 👎 this comment
|
|
|
|
---
|
|
PROMPT_END
|
|
EOF
|
|
|
|
- name: Clean up stale Claude locks
|
|
run: rm -rf ~/.claude/.locks ~/.local/state/claude/locks || true
|
|
|
|
- name: Run Marvin dedupe command
|
|
uses: anthropics/claude-code-action@v1
|
|
with:
|
|
github_token: ${{ steps.marvin-token.outputs.token }}
|
|
bot_name: "Marvin Context Protocol"
|
|
prompt: ${{ steps.dedupe-prompt.outputs.PROMPT }}
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY_FOR_CI }}
|
|
allowed_non_write_users: "*"
|
|
claude_args: |
|
|
--allowedTools Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh api:*),Bash(gh issue comment:*),Task
|
|
settings: |
|
|
{
|
|
"model": "claude-sonnet-4-6",
|
|
"env": {
|
|
"GH_TOKEN": "${{ steps.marvin-token.outputs.token }}"
|
|
}
|
|
}
|
|
|
|
- name: Add potential-duplicate label if bot commented in this run
|
|
env:
|
|
GH_TOKEN: ${{ steps.marvin-token.outputs.token }}
|
|
run: |
|
|
ISSUE=${{ github.event.issue.number || inputs.issue_number }}
|
|
# Only match bot comments created in the last 10 minutes (this run)
|
|
CUTOFF=$(date -u -d '10 minutes ago' '+%Y-%m-%dT%H:%M:%SZ' 2>/dev/null \
|
|
|| date -u -v-10M '+%Y-%m-%dT%H:%M:%SZ')
|
|
HAS_RECENT=$(gh api "repos/${{ github.repository }}/issues/${ISSUE}/comments?sort=created&direction=desc&per_page=10" \
|
|
--jq "[.[] | select(
|
|
.user.type == \"Bot\" and
|
|
(.body | test(\"possible duplicate issues\"; \"i\")) and
|
|
.created_at >= \"${CUTOFF}\"
|
|
)] | length")
|
|
if [ "$HAS_RECENT" -gt 0 ]; then
|
|
gh issue edit "$ISSUE" --add-label "potential-duplicate" -R "${{ github.repository }}"
|
|
echo "Added potential-duplicate label to #${ISSUE}"
|
|
else
|
|
echo "No recent duplicate comment found, skipping label"
|
|
fi
|