Skip to content

work-items open-linked-PR filter: closing-keyword regex matches fenced-code-block examples #654

Description

@kyle-sexton

Context

Surfaced by a Codex P2 review thread on PR #643 (thread PRRT_kwDOTCGFQM6SLf9b, plugins/work-items/tools/work-item-tracker/adapters/github/README.md). Filed per the triage rule as a design question rather than fixed inline.

Problem

The "Open linked PRs" filter (new in #643) runs its closing-keyword jq test(...) over the raw PR body:

"(?i)(?<!\w)(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved):?[ \t]+#\($n)(?![0-9])"

GitHub treats fenced code blocks as inert for auto-close linkage — documented in this same repo at plugins/source-control/skills/pull-request/reference/create.md ("Fenced code blocks ARE inert, so example snippets are safe"). The raw-body regex does not share that awareness: an open PR whose body contains a fenced example such as

```text
Closes #<N>
```

matches true and drops the still-ready issue #<N> from the pickable frontier, even though GitHub will not auto-close it on merge.

Why this is a design question, not a small inline fix

Making the match fence-aware in a jq/shell one-liner is not small or bounded: it requires tracking fence state (opening/closing fences, variable backtick counts, ~~~ fences, indented fences) before the keyword test. That is a real complexity-vs-precision tradeoff on a comparatively rare edge case (an open PR body carrying a fenced Closes #<specific-N> for the exact issue under test), so it does not qualify as a VALID-small-own-path inline fix under the triage rule.

Root-cause candidate to evaluate (do not assume)

Rather than layering fence-stripping onto a raw-body heuristic, the authoritative signal may be GitHub's own computed linkage: the GraphQL PullRequest.closingIssuesReferences connection returns the issues GitHub will auto-close from the body. To verify: confirm whether closingIssuesReferences honors fence-inertness (and HTML-comment behavior) as expected; if so, it sidesteps both the fenced-block and the word-boundary heuristics entirely. This would be a design change to the filter, out of scope for the #643 triage.

Related

  • Note the same fence-blindness pattern also exists in the pre-create gate's line-anchored KEYWORD_REGEX (create.md); worth considering whether any chosen approach should be applied consistently across both matchers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: lowNice-to-have, cosmetic, or speculative; opportunistic.status: readyTriaged, unblocked, and fully specified; eligible to pick up.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions