auto-close-duplicates wipes an issue's existing labels when closing it as a duplicate

Status Open
Maintainer reply None cached
Activity 0 comments · opened Sep 29, 2026

closeIssueAsDuplicate in scripts/auto-close-duplicates.ts closes the issue with a PATCH /repos/{owner}/{repo}/issues/{number} that includes labels: ['duplicate']:

https://github.com/anthropics/claude-code/blob/dec92bc87ab6fe9c7be0fcba1f97966f902dd243/scripts/auto-close-duplicates.ts#L73-L82

On that endpoint the labels parameter will "replace the set of labels on this issue" (Update an issue), so every issue closed by the auto-close job loses its existing area/platform/triage labels and keeps only duplicate.

Suggested fix: keep the PATCH for state: 'closed' / state_reason: 'duplicate', and add the label with POST /repos/{owner}/{repo}/issues/{number}/labels ({ labels: ['duplicate'] }), which adds rather than replaces (Add labels to an issue). The workflow already grants issues: write.

A ready commit with this change (+8/−2): https://github.com/gypsy5oul/claude-code/commit/7b12a6f

I tried to open it as a PR, but PR creation is restricted on this repository, so I'm filing it here instead.

View original on GitHub ↗