Skip to content

pr-issue-linkage: negation-blind closing-keyword match both passes the gate and auto-closes the issue #521

Closed

Description

@kyle-sexton

The pr-issue-linkage gate's CLOSING_KEYWORD regex is negation-blind, in the same way GitHub's own linkage parser is, and the two failure modes compound into a trap that is easy to fall into and hard to notice. The gate accepts a PR body when it matches roughly /\b(close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s*:?\s*(?:[\w.-]+\/[\w.-]+)?#\d+\b/i or the no (linked|related) issue opt-out. Because neither the gate nor GitHub looks at the words around the keyword, a PR that states in prose that it deliberately does not close an issue — the exact sentence an author writes when a linked issue is human-gated, carries a needs-human label, or must be retired by an automated watcher rather than by the merge — simultaneously (a) registers a live closing reference on that issue, so merging silently auto-closes it, and (b) satisfies this required check because of that same phrase. The disclaimer is what makes the gate pass, and the disclaimer is what closes the issue. We hit this live on melodic-software/dotfiles#583: the body said it did not close a needs-human issue, closingIssuesReferences returned that issue anyway, and a fresh-context verifier caught it only because it queried GraphQL directly rather than trusting the prose. The first attempted fix quoted the offending phrase verbatim to explain it and re-registered the reference a second time — a Markdown backslash-escape on the # renders correctly but does not stop the parser. The underlying gap is that the convention has no way to express "references an issue, deliberately does not close it"; the only passing escape is the No linked issue marker, which is misleading when the PR plainly does relate to an issue. Two things would help independently: a dedicated non-closing linkage form (something like a Refs:/Relates to: marker the gate accepts as a first-class outcome instead of forcing the "no issue" lie), and a negation guard in the gate so a keyword preceded by not/does not/deliberately does not within a short window fails the match rather than satisfying it. The second alone is not sufficient — it would fix the gate's verdict while leaving GitHub's parser still closing the issue on merge — so the durable fix is the first, with a lint that warns when a body contains a closing keyword whose surrounding text negates it.

Activity

  1. added
    needs-triage
    on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    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