Repository navigation
feat(#1197): opt out of closing keywords — Refs #N for issues a PR should not close - #1215
Merged
admarble merged 5 commits intoSep 29, 2026
Conversation
Co-Authored-By: Claude Sonnet 5 <[email protected]> Entire-Checkpoint: 26a2e88a8078
…n rejects the field Verified live against this branch's own PR #1215: gh CLI 2.66.1 errors 'Unknown JSON field' on gh pr view --json closingIssuesReferences, but the GraphQL query resolves correctly and confirmed the PR closes only #1197 (not the Refs #1203 tracker mention). Co-Authored-By: Claude Sonnet 5 <[email protected]> Entire-Checkpoint: 94c9d209e6ff
…ode; scrub owner/repo#N; tests in the Evidence file Entire-Checkpoint: c0a7d8be823b
…sed on a parse error Entire-Checkpoint: e366a37c6c02
…opt-out-of-closing-keywords-refs-n-for-iss
admarble
deleted the
feature/1197-feat-pr-opt-out-of-closing-keywords-refs-n-for-iss
branch
September 29, 2026 15:15
This was referenced Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run.prIssueLink("closes"default,"refs") andrun.prNoCloseLabel(defaultno-autoclose) control whether the automated PR path (buildAutomatedPRBody/createPRinworktree-manager.ts) emitsFixes #NorRefs #N. The label always wins over the setting (resolvePrLinkMode).refsmode, the assembled PR body is scrubbed for any other closing-verb + issue-number combination (close/fix/resolve, any tense, table cells included) viarewriteClosingKeywordsToRefs, so an AC-table row that happens to start with a closing verb can't slip an auto-close past the setting./exec's manual PR-creation template (all three mirrored copies) now resolves the same keyword before runninggh pr create./mergerand/fullsolvequeryclosingIssuesReferences(via GraphQL — see note below) before merging and stop, naming the issue, if it lists anything the PR is not allowed to close. In refs mode, or for ano-autoclose-labelled issue, that is every number, the PR's own issue included.Resolved the issue's open question:
isIssueMergedIntoMain(pr-status.ts) detects a merge via branch-tip ancestry andMerge #Ncommit-message grep — neither depends on GitHub's closing-issue link. State reconciliation (#1044) does not need arefs-mode-specific merge detector.Field finding:
gh pr view --json closingIssuesReferenceserrorsUnknown JSON fieldon gh CLI 2.66.1 (the version in this environment) — that field isn't exposed throughgh pr view --json, only through the GraphQL API directly. AC-5's skill text usesgh api graphqlwith the{owner}/{repo}magic placeholders instead; verified live against this PR (#1215) — the query correctly returns only1197, not1203(theRefs #1203tracker mention in this body does not count as closing, confirming AC-4's scrub also behaves as intended).AC Verification
run.prIssueLinksetting controls the keywordsrc/lib/settings.ts(schema+defaults),src/lib/workflow/worktree-manager.tsbuildAutomatedPRBody/resolvePrLinkMode,src/lib/workflow/worktree-manager.build-pr-body.test.ts,src/lib/workflow/config-resolver.pr-issue-link.test.tsno-autoclose-labelled issue always getsRefs #NresolvePrLinkModeinworktree-manager.ts;worktree-manager.build-pr-body.test.ts.claude/skills/exec/SKILL.md,skills/exec/SKILL.md,templates/skills/exec/SKILL.md(identical)rewriteClosingKeywordsToRefsinworktree-manager.ts;worktree-manager.build-pr-body.test.ts; live-verified on this PR (see Field finding above)/merger//fullsolvecheckclosingIssuesReferences, halt naming the issueskills/merger/SKILL.mdStep 1a,skills/fullsolve/SKILL.md§5.3 (all 3 copies each); command fixed to GraphQL after live verification failed ongh pr view --jsonRunner follow-up (graph-run #1203, commit
3b30dbaa)QA returned
AC_NOT_METon AC-5. Fixed here:{<issue-number>}unconditionally, so a refs-mode orno-autocloseissue whose body still carriedFixes #N(the field incident) would pass and close./mergerStep 1a and/fullsolve§5.3 (3 copies each) now readrun.prIssueLink/run.prNoCloseLabelfrom.sequant/settings.jsonand the issue's labels (gh api …/issues/N). In either mode the allowed set is empty. Ran the snippet against this repo for issue 1197: no settings gaveexpected=[1197];{"run":{"prIssueLink":"refs"}}gaveexpected=[];{"run":{"prNoCloseLabel":"enhancement"}}(a label feat(pr): opt out of closing keywords —Refs #Nfor issues a PR should not close #1197 carries) gaveexpected=[].rewriteClosingKeywordsToRefsnow also rewritesFixes owner/repo#N, keeping the prefix, since GitHub documents that form as closing.Fixes: #Nand**Fixes** #Nare still not rewritten (the function comment says so); the merge guard catches them.worktree-manager.test.ts) passed on base, so it tested nothing. It now holds a#1197describe block (AC-1, AC-2, AC-4) that cannot pass on base.Mutation-verified: AC-4 — reverted the repo-prefix group in the scrub regex;
src/lib/workflow/worktree-manager.test.ts > #1197 PR issue link: closes vs refs > AC-4: refs mode rewrites closing verbs in tables and the owner/repo#N formfailed (1/10); restored.Mutation-verified: AC-4 — scrub replacement made a no-op; same test failed (1/10); restored.
Evidence-command note (superseded by the follow-up above): the issue's AC-1/AC-2/AC-4 evidence names
src/lib/workflow/worktree-manager.test.ts, butbuildAutomatedPRBody/resolvePrLinkModeare actually tested in the sibling fileworktree-manager.build-pr-body.test.ts(where the pre-existing #749/#817 tests for the same function already lived) plus the newconfig-resolver.pr-issue-link.test.tsfor the settings→ExecutionConfigwiring. Ran both;worktree-manager.test.tsitself passes unaffected (unrelated tests).Runner follow-up, round 2 (commit
030afbe6)The second QA pass found that the AC-5 guard read
.sequant/settings.jsonwith rawjq.sequant initwrites that file as JSONC, sojqfailed and the|| echo closesfallback silently ran refs mode as closes. The six guard blocks now strip whole-line//comments beforejq(only whole-line, sincedevUrlcontains//). On a parse error the guard fails closed: it prints a warning and treats every closing reference as unexpected. I ran the snippet for issue 1197 against agenerateSettingsJsoncfile:expected=[1197]prIssueLink: "refs"expected=[]prNoCloseLabel: "enhancement"expected=[]closesexpected=[1197]{ nopeexpected=[]expected=[1197]Still no automated test of the skill's bash. It's prose in SKILL.md, so the table above is the evidence.
Test plan
npx vitest run src/lib/workflow/worktree-manager.build-pr-body.test.ts— 18 passednpx vitest run src/lib/workflow/config-resolver.pr-issue-link.test.ts— 5 passednpx vitest run src/lib/workflow/worktree-manager.test.ts— runner re-run at3b30dbaa: 10 passed, including the 3 new#1197casesnpx vitest run src/lib/workflow/execution-config-parity.test.ts— passed (newExecutionConfigfields inherited, not a second producer)npx vitest run src/lib/workflow/batch-executor.test.ts src/lib/workflow/batch-executor.model-ladder.test.ts src/lib/workflow/model-ladder.test.ts src/lib/workflow/ready-gate-run.test.ts— 183 passed (createPR call-site change)npx vitest run src/commands/init.test.ts— 54 passed (settings docs generators)npm run build— passednpm run lint— passednpx tsx scripts/lint-skill-calls.ts— no violationsgh api graphqlcommand against this PR: returns1197only3b30dbaa: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— 3 files, 33/33 passed;npx tsc --noEmitclean;npm run lint:skill-callsno violationsgrep -n "Refs #"across the 3 exec copies and AC-5grep -n "closingIssuesReferences"in merger/fullsolve — all matchFull
npm testintentionally not run in this phase per the issue's launch constraints (30-min MCP phase wall); CI runs it.Pre-PR Confidence Check
rewriteClosingKeywordsToRefsis a regex over the assembled body text, not an AST/markdown-aware pass — it will catch verb+#Ncombinations correctly for the documented cases (including table cells) but a sufficiently adversarial body (e.g. verb and number split across a line-wrap inside a code fence) could evade it. Scoped tightly to the linked issue number only, by design.createPRandGitHubProvider.createPRCliSyncthemselves aren't unit-tested (pre-existing — no test invokes the realghCLI path); the pure logic they call (buildAutomatedPRBody,resolvePrLinkMode) is fully covered.Quality Plan Alignment: N/A — no quality plan in issue comments (mechanical-tier graph issue).
Refs #1203 (graph tracker)
Closes #1197
🤖 Generated with Claude Code