Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Update dedupe logic (#1460)

Jeremiah Lowin26a2c2ed622a
diff --git a/.claude/commands/dedupe.md b/.claude/commands/dedupe.md
index 8f05bb4ca..ab44887c6 100644
--- a/.claude/commands/dedupe.md
+++ b/.claude/commands/dedupe.md
@@ -11,27 +11,29 @@ To do this, follow these steps precisely:
2. Use an agent to view a Github issue, and ask the agent to return a summary of the issue
-3. Then, launch 5 parallel agents to search Github for duplicates of this issue, using diverse keywords and search approaches, using the summary from #1
+3. Then, launch 3 parallel agents to search Github for duplicates of this issue, using diverse keywords and search approaches, using the summary from #1
4. Next, feed the results from #1 and #2 into another agent, so that it can filter out false positives, that are likely not actually duplicates of the original issue. If there are no duplicates remaining, do not proceed.
5. Finally, comment back on the issue with a list of up to three duplicate issues (or zero, if there are no likely duplicates)
Notes (be sure to tell this to your agents, too):
+
- Use `gh` to interact with Github, rather than web fetch
- Do not use other tools, beyond `gh` (eg. don't use other MCP servers, file edit, etc.)
- Make a todo list first
- For your comment, follow the following format precisely (assuming for this example that you found 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
----
\ No newline at end of file
+---
diff --git a/.github/workflows/claude-dedupe-issues.yml b/.github/workflows/claude-dedupe-issues.yml
index 1447c0211..57512b4e0 100644
--- a/.github/workflows/claude-dedupe-issues.yml
+++ b/.github/workflows/claude-dedupe-issues.yml
@@ -11,9 +11,9 @@ on:
type: string
jobs:
- claude-dedupe-issues:
+ marvin-dedupe-issues:
runs-on: ubuntu-latest
- timeout-minutes: 5
+ timeout-minutes: 10
permissions:
contents: read
issues: write
@@ -29,7 +29,7 @@ jobs:
app-id: ${{ secrets.MARVIN_APP_ID }}
private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }}
- - name: Run Marvin slash command
+ - name: Run Marvin dedupe command
uses: anthropics/claude-code-base-action@beta
with:
prompt: "/dedupe ${{ github.repository }}/issues/${{ github.event.issue.number || inputs.issue_number }}"
diff --git a/.github/workflows/marvin.yml b/.github/workflows/marvin.yml
index 703f17266..bee5d5c98 100644
--- a/.github/workflows/marvin.yml
+++ b/.github/workflows/marvin.yml
@@ -39,7 +39,7 @@ jobs:
private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }}
# Marvin Assistant
- - name: Marvin
+ - name: Run Marvin
uses: anthropics/claude-code-action@beta
with:
github_token: ${{ steps.marvin-token.outputs.token }}
diff --git a/scripts/auto_close_duplicates.py b/scripts/auto_close_duplicates.py
index 34732c676..a52349ee4 100644
--- a/scripts/auto_close_duplicates.py
+++ b/scripts/auto_close_duplicates.py
@@ -169,7 +169,7 @@ class GitHubClient:
return reactions
def close_issue(self, issue_number: int, comment: str) -> bool:
- """Close an issue with a comment."""
+ """Close an issue with a comment and add duplicate label."""
# First add the comment
comment_url = f"{self.base_url}/issues/{issue_number}/comments"
with httpx.Client() as client:
@@ -181,6 +181,16 @@ class GitHubClient:
print(f"Failed to add comment to issue #{issue_number}")
return False
+ # Add the duplicate label
+ labels_url = f"{self.base_url}/issues/{issue_number}/labels"
+ with httpx.Client() as client:
+ response = client.post(
+ labels_url, headers=self.headers, json={"labels": ["duplicate"]}
+ )
+
+ if response.status_code not in [200, 201]:
+ print(f"Failed to add duplicate label to issue #{issue_number}")
+
# Then close the issue
issue_url = f"{self.base_url}/issues/{issue_number}"
with httpx.Client() as client:
@@ -194,11 +204,10 @@ class GitHubClient:
def find_duplicate_comment(comments: list[Comment]) -> Comment | None:
"""Find a bot comment marking the issue as duplicate."""
for comment in comments:
- # Check for the specific duplicate message format
- body_lower = comment.body.lower()
+ # Check for the specific duplicate message format from a bot
if (
- "possible duplicate issue" in body_lower
- and "this issue will be automatically closed as a duplicate" in body_lower
+ comment.user_type == "Bot"
+ and "possible duplicate issues" in comment.body.lower()
):
return comment
return None