OpenAPI request director sends multipart/form-data and form-urlencoded as JSON, drops cookies #902
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@v6 | |
| - 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 }}. | |
| Follow these steps precisely: | |
| 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. Then, launch 3 parallel agents using the Task tool to search GitHub for duplicates of this issue, using diverse keywords and search approaches, using the summary from step 2 | |
| 4. Next, consider the results from steps 2 and 3 and filter out false positives that are likely not actually duplicates of the original issue. Be conservative — only flag issues that describe the same underlying problem, not issues that merely share keywords or involve the same subsystem. 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). If there are no duplicates, DO NOT COMMENT. Just exit. 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 (eg. don't use other MCP servers, file edit, etc.) | |
| - Make a todo list first | |
| - Never include this issue as a duplicate of itself | |
| 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 |