mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 15:19:10 +02:00
Update dedupe logic (#1460)
This commit is contained in:
parent
5e52010cff
commit
26a2c2ed62
4 changed files with 23 additions and 12 deletions
|
|
@ -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
|
||||
|
||||
---
|
||||
---
|
||||
|
|
|
|||
6
.github/workflows/claude-dedupe-issues.yml
vendored
6
.github/workflows/claude-dedupe-issues.yml
vendored
|
|
@ -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 }}"
|
||||
|
|
|
|||
2
.github/workflows/marvin.yml
vendored
2
.github/workflows/marvin.yml
vendored
|
|
@ -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 }}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue