Skip to content

feat(pr): opt out of closing keywords — Refs #N for issues a PR should not close #1197

Closed

Description

@admarble

Epic: field-2026-09-28 (downstream non-Node adoption) Tier: mechanical Graph: tracker #1203

Problem. buildAutomatedPRBody always writes Fixes #N (worktree-manager.ts:1629), and the exec skill template always writes Closes #<issue> (exec/SKILL.md:998, both copies). No setting, flag or label changes this. Multi-PR issues, issues with a post-merge AC and tracking issues close on merge unless someone edits the PR body by hand. Incidental keywords too. GitHub parses a closing keyword anywhere in a PR body, table cells included. In the field, an issue was closed on merge by an agent-written AC-mapping row that began with the closing verb and the issue number. The PR's own summary said it delivered only part of the issue.

Unsettled: does a closing reference survive the keyword being edited out? GitHub's docs say editing it out removes the link. One field observation reported that the reference survived an edit, but that PR shows no closing reference today, and its target was already closed, so the case doesn't settle it. Either way, guard before gh pr create and check again before merge; don't rely on after-the-fact edits.

Check first: does state reconcile (#1044, isIssueMergedIntoMain) depend on the closing link? If so, refs mode needs its own merge detection.

AC

  • AC-1: A setting run.prIssueLink: "closes" | "refs" (default closes) controls the keyword in buildAutomatedPRBody. Evidence: npx vitest run src/lib/workflow/worktree-manager.test.ts
  • AC-2: An issue carrying a configurable label (default no-autoclose) gets Refs #N whatever the setting. Evidence: npx vitest run src/lib/workflow/worktree-manager.test.ts
  • AC-3: The exec skill's PR template follows the same rule, in all three skill copies. Evidence: grep -n "Refs #" .claude/skills/exec/SKILL.md skills/exec/SKILL.md templates/skills/exec/SKILL.md
  • AC-4: In refs mode, or for a labelled issue, the automated PR path rewrites every <closing verb> #N for the linked issue anywhere in the generated body (including tables) to Refs #N before gh pr create. Evidence: npx vitest run src/lib/workflow/worktree-manager.test.ts
  • AC-5: /merger and /fullsolve query closingIssuesReferences before merging and stop, naming the issue, when it lists an issue that isn't meant to close. Evidence: grep -n "closingIssuesReferences" skills/merger/SKILL.md skills/fullsolve/SKILL.md

Graph metadata

  • No dependency edges; frontier from wave 1.

May touch

  • src/lib/workflow/worktree-manager.ts
  • src/lib/settings.ts
  • .claude/skills/merger/SKILL.md
  • skills/merger/SKILL.md
  • templates/skills/merger/SKILL.md
  • .claude/skills/fullsolve/SKILL.md
  • skills/fullsolve/SKILL.md
  • templates/skills/fullsolve/SKILL.md
  • .claude/skills/exec/SKILL.md
  • skills/exec/SKILL.md
  • templates/skills/exec/SKILL.md

File overlap (don't run in the same wave; merge one first):

Activity

  1. added
    enhancement
    graph-2026-09-field
    on Sep 28, 2026
  2. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    Context for wave 2 (graph-run #1203) — checked against the merged worktree-manager.ts (after #1196 / PR #1212 and #1193 / PR #1211; the file changed +96/−46). buildAutomatedPRBody is now at worktree-manager.ts:1666, with the Fixes #${issueNumber} line at :1679, and its caller is at :1791. The exec skill's Closes #<issue> is at exec/SKILL.md:997 in all three copies (.claude/skills, skills, templates/skills), not two. The issue's approach still applies to the merged file; nothing in #1196 touched the PR-body path.

    Launch constraints (read before starting) — all phases, including the qa phase:

    • The exec and qa phases must NOT run the full npm test. Every MCP phase has a hard 30-minute wall, and wave-1 exec phases ran 25–29 min. Run only the AC Evidence commands and the test files next to the code you change, in the foreground with timeout. CI runs the full suite.
    • Commit WIP early and often (at least every ~10 minutes). Committed work survives a phase timeout; uncommitted work does not.
    • Mutation markers: the failedTest field in <!-- SEQUANT_MUTATION: … --> must start with the test file path (src/…/x.test.ts > describe > case). A describe name or bare test title there floors /qa §6i to AC_NOT_MET.
    • Tracker reference: refer to the graph tracker as Refs #1203 or "tracker tracker(graph): field report 2026-09-28 — downstream non-Node adoption gaps (10 nodes) #1203". Never put a closing verb (Fixes/Closes/Resolves) next to tracker(graph): field report 2026-09-28 — downstream non-Node adoption gaps (10 nodes) #1203 anywhere in the PR body, tables included. The PR should close only this issue.
  3. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    @/tmp/existing_comment.md

  4. added
    planned
    on Sep 29, 2026
  5. added a commit that references this issue on Sep 29, 2026
  6. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_NOT_MET

    AC coverage: 4/4 met

    Gaps:

    • AC-5 guard never flags the PR's own issue when it is in refs mode or carries the no-autoclose label, so the motivating field incident still merges and closes the issue
    • rewriteClosingKeywordsToRefs misses colon, bold, and owner/repo#N forms; GitHub documents the repo-prefixed form as closing
    • Declared evidence command is vacuous for the feature (passes on base); real tests are in a sibling file
    • The AC-5 guard compares against the PR's own issue number without checking the refs/label rule (details in the AC table). Both skills need this: if run.prIssueLink == "refs" or the issue carries run.prNoCloseLabel, the expected set is empty, and finding <issue-number> in the list must stop the merge.

    Suggestions:

    • Extend the scrub to the other forms I tested, which it currently leaves as written: a colon after the verb (Fixes: #1197), bold (**Fixes** #1197), and a repo prefix (Fixes owner/repo#1197). GitHub's docs list the repo-prefixed form as closing; I didn't confirm the colon and bold forms against GitHub. The merge guard is the backstop here, which makes the AC-5 gap matter more.
  7. added a commit that references this issue on Sep 29, 2026
  8. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    Runner follow-up (graph-run #1203) — QA verdict AC_NOT_MET (AC-5). Fixed on PR #1215 @ 3b30dbaa:

    • AC-5: /merger and /fullsolve (3 copies each) now compute the allowed set from run.prIssueLink, run.prNoCloseLabel and the issue's labels. In refs/label mode it's empty, so the PR's own issue in closingIssuesReferences stops the merge. Snippet run against this issue: default gave [1197]; refs mode gave []; label mode gave [].
    • The scrub now also rewrites Fixes owner/repo#N (prefix kept). The colon and bold forms are left to the merge guard, and the function comment says so.
    • The AC-1/2/4 Evidence file worktree-manager.test.ts now holds #1197 cases, so the command fails on base.

    Executed: npx vitest run src/lib/workflow/worktree-manager.test.ts src/lib/workflow/worktree-manager.build-pr-body.test.ts src/lib/workflow/config-resolver.pr-issue-link.test.ts → 33/33; AC-3/AC-5 greps match. Mutation markers in the PR body.

  9. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_NOT_MET

    AC coverage: 4/4 met

    Gaps:

    • AC-5 merge guard silently reads refs mode as closes (and custom prNoCloseLabel as the default) because jq cannot parse the JSONC settings file sequant init writes, so a refs-mode PR still auto-closes its own issue
    • The skill-level settings read has no test against the canonical JSONC format
  10. added a commit that references this issue on Sep 29, 2026
  11. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    QA Verdict: NEEDS_VERIFICATION

    AC coverage: 5/5 met

    Gaps:

    • Required CI check still running; verdict pending CI
  12. admarble commented on Sep 29, 2026

    @admarble
    ContributorAuthor

    Runner verification, round 2 (graph-run #1203): NEEDS_VERIFICATION discharged. The second QA pass found that the AC-5 guard read the JSONC .sequant/settings.json with raw jq, which silently fell back to closes. Fixed on PR #1215 @ 030afbe6: whole-line // comments are stripped before jq, and a parse error fails closed. I ran the snippet for issue 1197 against a generateSettingsJsonc file:

    • no file → [1197]
    • JSONC refs → []
    • JSONC label override → []
    • JSONC closes → [1197]
    • broken file → warning, []
    • this repo's settings → [1197]

    The third QA pass returned 5/5 met; its only gap was the pending CI test check, which is now success at 030afbe6. The PR still closes only [1197].

  13. added a commit that references this issue on Sep 29, 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

    enhancementgraph-2026-09-fieldplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions