Skip to content

Support native duplicate marking in close-issue safe output (link canonical issue instead of a comment) #43150

Description

@labudis

Problem

When an agentic triage workflow closes an issue as a duplicate, the close-issue safe output can only:

  1. set state-reason: duplicate (the "closed this as duplicate" event), and
  2. post its body as a plain comment.

There's no way to tell it which issue is the canonical original, so GitHub's native "marked this as a duplicate of #X" relationship is never created. The linkage survives only as free text in a comment.

Current behavior (from a real triage run in github/issues)

Our triage agent closed a duplicate and the timeline showed:

  • a comment: Duplicate of #22853
  • a separate event: github-actions closed this as duplicate

No native duplicate relationship — just a comment plus a generic duplicate close.

Root cause

The close_issue handler (actions/setup/js/close_issue.cjs) does roughly:

await github.rest.issues.update({ ..., state: "closed", state_reason: "duplicate" });
// and, if a body is present:
await github.rest.issues.createComment({ ..., body });

issues.update records that an issue is a duplicate but not of what. There is no duplicate-of / canonical-issue parameter, and no call to the native duplicate mutation.

Proposed

Add an optional duplicate-of parameter (canonical issue number or URL) to the close-issue safe output. When set together with state-reason: duplicate, create the native duplicate relationship (via the duplicate GraphQL mutation) so it produces a marked_as_duplicate timeline event linking the canonical issue, instead of (or in addition to) posting a comment.

Benefit

  • Proper native duplicate graph (dedup, related-issues UI, analytics).
  • Cleaner timeline — no separate "Duplicate of #X" comment noise.
  • Matches how a human marks a duplicate in the UI.

Context

The github/issues repo uses an agentic triage workflow that closes high-confidence duplicates. Native duplicate marking would let it link duplicates properly rather than leaving a text comment.

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions