claude-code - ✅(Solved) Fix Auto-close duplicate workflow replaces existing issue labels [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#60656Fetched 2026-05-20 03:52:51
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1labeled ×1

The duplicate auto-close workflow currently closes an issue by PATCHing the issue with labels: ["duplicate"] together with state: "closed" and state_reason: "duplicate".

GitHub Update an issue API treats the labels field as a replacement for the issue label set, not an additive operation. As a result, when the workflow closes an issue as a duplicate, it can erase existing labels such as platform, area, priority, or lifecycle metadata.

Root Cause

The duplicate auto-close workflow currently closes an issue by PATCHing the issue with labels: ["duplicate"] together with state: "closed" and state_reason: "duplicate".

GitHub Update an issue API treats the labels field as a replacement for the issue label set, not an additive operation. As a result, when the workflow closes an issue as a duplicate, it can erase existing labels such as platform, area, priority, or lifecycle metadata.

Fix Action

Fix / Workaround

The duplicate auto-close workflow currently closes an issue by PATCHing the issue with labels: ["duplicate"] together with state: "closed" and state_reason: "duplicate".

Do not include labels in the issue PATCH used to close the issue. Close the issue first, then add the duplicate label via the additive labels endpoint (POST /repos/{owner}/{repo}/issues/{issue_number}/labels) so existing labels are preserved.

PR fix notes

PR #60659: Preserve labels when auto-closing duplicates

Description (problem / solution / changelog)

Fixes #60656

Summary

  • Close duplicate issues without replacing their labels
  • Add the duplicate label through the additive issue labels endpoint
  • Preserve existing platform, area, priority, and lifecycle labels when the workflow closes a duplicate

Validation

  • npm exec --yes --package typescript -- tsc --noEmit --target ES2022 --module ESNext --lib ES2022,DOM --skipLibCheck scripts/auto-close-duplicates.ts
  • git diff --check

Changed files

  • scripts/auto-close-duplicates.ts (modified, +9/-1)
RAW_BUFFERClick to expand / collapse

Summary

The duplicate auto-close workflow currently closes an issue by PATCHing the issue with labels: ["duplicate"] together with state: "closed" and state_reason: "duplicate".

GitHub Update an issue API treats the labels field as a replacement for the issue label set, not an additive operation. As a result, when the workflow closes an issue as a duplicate, it can erase existing labels such as platform, area, priority, or lifecycle metadata.

Impact

Duplicate issues can lose useful triage metadata at the same time they are closed. That metadata can still matter for routing, reporting, duplicate analysis, and future auditing.

Suggested fix

Do not include labels in the issue PATCH used to close the issue. Close the issue first, then add the duplicate label via the additive labels endpoint (POST /repos/{owner}/{repo}/issues/{issue_number}/labels) so existing labels are preserved.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - ✅(Solved) Fix Auto-close duplicate workflow replaces existing issue labels [1 pull requests, 1 comments, 2 participants]