Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(github): the board asks why an issue is closed
reviewa6ad531c007a
diff --git a/src/core/github/client.test.ts b/src/core/github/client.test.tsindex ed8224d94..83a5d4716 100644--- a/src/core/github/client.test.ts+++ b/src/core/github/client.test.ts@@ -326,4 +326,35 @@ describe('GitHubIssuesClient', () => {})})})+ describe('close reason', () => {+ const capture = () => {+ const bodies: unknown[] = []+ const client = new GitHubIssuesClient({+ token: 'secret',+ fetch: async (_url, init) => {+ bodies.push(JSON.parse(String(init?.body)))+ return response(issue(42, { state: 'closed', state_reason: 'not_planned' }))+ }+ })+ return { client, bodies }+ }++ it('sends state_reason alongside the state change', async () => {+ const { client, bodies } = capture()+ await client.updateIssue('nodeterm/nodeterm', 42, { state: 'closed', stateReason: 'not_planned', labels: [] })+ expect(bodies).toEqual([{ state: 'closed', state_reason: 'not_planned', labels: [] }])+ })++ it.each([+ ['a reason without a state change', { stateReason: 'completed', labels: [] }],+ ['a reason GitHub does not know', { state: 'closed', stateReason: 'wontfix', labels: [] }],+ ['a close reason on a reopen', { state: 'open', stateReason: 'not_planned', labels: [] }],+ ['reopened on a close', { state: 'closed', stateReason: 'reopened', labels: [] }]+ ])('refuses %s without sending anything', async (_name, input) => {+ const { client, bodies } = capture()+ await expect(client.updateIssue('nodeterm/nodeterm', 42, input as never))+ .rejects.toMatchObject({ code: 'invalid-request' })+ expect(bodies).toEqual([])+ })+ })})diff --git a/src/core/github/client.ts b/src/core/github/client.tsindex 5170b6a70..65262421a 100644--- a/src/core/github/client.ts+++ b/src/core/github/client.ts@@ -162,6 +162,15 @@ function issueFrom(value: unknown): GitHubIssue | null {}}+/** A reason only rides a state change, and only one that fits it: GitHub rewrites `state_reason` on+ * any write carrying `state`, so a reason sent without one — or the wrong kind — is a caller bug. */+function validStateReason(input: UpdateIssueInput): boolean {+ if (input.stateReason === undefined) return true+ if (input.state === 'closed') return input.stateReason === 'completed' || input.stateReason === 'not_planned'+ if (input.state === 'open') return input.stateReason === 'reopened'+ return false+}+function nextPage(link: string | null): number | undefined {if (!link) return undefinedfor (const part of link.split(',')) {@@ -339,12 +348,14 @@ export class GitHubIssuesClient {safeRepository(repository)if (!positiveInteger(issueNumber, Number.MAX_SAFE_INTEGER) ||(input.state !== undefined && input.state !== 'open' && input.state !== 'closed') ||+ !validStateReason(input) ||(input.labels !== undefined && (!Array.isArray(input.labels) || input.labels.length > 100 ||input.labels.some((label) => !string(label, 50) || !label.trim())))) {throw new GitHubClientError('invalid-request')}const body = {...(input.state ? { state: input.state } : {}),+ ...(input.stateReason ? { state_reason: input.stateReason } : {}),...(input.labels ? { labels: input.labels } : {})}const response = await this.request(`/repos/${repository}/issues/${issueNumber}`, {diff --git a/src/core/github/handlers.ts b/src/core/github/handlers.tsindex fa9dcbd2f..cba0f945e 100644--- a/src/core/github/handlers.ts+++ b/src/core/github/handlers.ts@@ -2,6 +2,7 @@ import type { CorePlatform } from '../platform'import { IPC } from '../../shared/ipc'import type {CreateMappedLabelsResult,+ GitHubCloseReason,GitHubIssuePage,GitHubIssueQuery,GitHubMutationResult@@ -17,6 +18,7 @@ export interface GitHubIssueHandlerService {issueNumber: numbertoColumnId: string | nullexpectedUpdatedAt: string+ closeReason?: GitHubCloseReason}): Promise<GitHubMutationResult>createMissingLabels(request: { projectId: string }): Promise<CreateMappedLabelsResult>clearCache(request: { projectId: string }): Promise<void>diff --git a/src/core/github/service.test.ts b/src/core/github/service.test.tsindex 71fe0ec04..970f9fec7 100644--- a/src/core/github/service.test.ts+++ b/src/core/github/service.test.ts@@ -17,7 +17,8 @@ import type {IssueHeartbeatResult,IssuePageResult,ListIssueOptions,- NormalisedProjectKanbanGitHub+ NormalisedProjectKanbanGitHub,+ UpdateIssueInput} from '../../shared/github-issues'let userDataDir: string@@ -52,7 +53,9 @@ const issue = (number: number, over: Partial<GitHubIssue> = {}): GitHubIssue =>class FixtureClient implements GitHubIssuesClientLike {issues = new Map<number, GitHubIssue>()- updates: Array<{ number: number; input: { state?: 'open' | 'closed'; labels?: string[] } }> = []+ updates: Array<{ number: number; input: UpdateIssueInput }> = []+ /** What GitHub records as the reason when the write names none, or overrides the one asked for. */+ recordedReason?: GitHubIssue['stateReason']repositoryLabels: Array<{ id: number; name: string; color: string; description: null }> = []createdLabels: Array<{ name: string; color: string }> = []@@ -87,13 +90,18 @@ class FixtureClient implements GitHubIssuesClientLike {async updateIssue(_repository: string,number: number,- input: { state?: 'open' | 'closed'; labels?: string[] }+ input: UpdateIssueInput) {this.updates.push({ number, input: structuredClone(input) })const current = this.issues.get(number)!const updated = {...current,- ...(input.state ? { state: input.state } : {}),+ ...(input.state ? {+ state: input.state,+ stateReason: this.recordedReason !== undefined+ ? this.recordedReason+ : input.stateReason ?? (input.state === 'closed' ? 'completed' as const : 'reopened' as const)+ } : {}),...(input.labels ? {labels: input.labels.map((name, index) => ({ id: index + 1, name, color: '8b5cf6' }))} : {}),@@ -633,7 +641,7 @@ describe('GitHubIssueService', () => {})expect(result.status).toBe('confirmed')expect(client.updates).toEqual([{ number: 42, input: {- state: 'open', labels: ['bug', 'status:todo']+ state: 'open', stateReason: 'reopened', labels: ['bug', 'status:todo']} }])})@@ -1182,3 +1190,84 @@ describe('GitHubIssueService rate budget', () => {.toEqual({ until: 2_000_000, kind: 'rate-limited' })})})++describe('GitHubIssueService close reason', () => {+ async function ready(issues: GitHubIssue[]) {+ const client = new FixtureClient(issues)+ const cache = new GitHubIssueCache(userDataDir)+ await cache.bind('local-1', 'project-1', 'o/r', 'user-1')+ await cache.saveComplete('user-1', 'o/r', {+ issues, etags: {}, lastSuccessfulRefreshAt: 1, lastFullReconciliationAt: 1+ })+ const service = new GitHubIssueService({+ cache, coordinator: new GitHubRequestCoordinator(),+ contextForProject: async () => context(client), now: () => 10_000+ })+ return { client, service }+ }+ const todo = [{ id: 1, name: 'status:todo', color: '0a84ff' }]+ const done = [{ id: 3, name: 'status:done', color: '30d158' }]++ it('closes with the reason the user chose', async () => {+ const shown = issue(1, { labels: todo })+ const { client, service } = await ready([shown])+ const result = await service.moveIssue({+ projectId: 'project-1', issueNumber: 1, toColumnId: 'done',+ expectedUpdatedAt: shown.updatedAt, closeReason: 'not_planned'+ })+ expect(result.status).toBe('confirmed')+ expect(client.updates[0].input).toEqual({+ state: 'closed', stateReason: 'not_planned', labels: ['status:done']+ })+ })++ it('closes as completed when no reason was given, which is what GitHub does on its own', async () => {+ const shown = issue(1, { labels: todo })+ const { client, service } = await ready([shown])+ await service.moveIssue({+ projectId: 'project-1', issueNumber: 1, toColumnId: 'done', expectedUpdatedAt: shown.updatedAt+ })+ expect(client.updates[0].input.stateReason).toBe('completed')+ })++ it('reopens with state_reason reopened, whatever close reason the caller sent', async () => {+ const shown = issue(1, { state: 'closed', stateReason: 'not_planned', labels: done })+ const { client, service } = await ready([shown])+ await service.moveIssue({+ projectId: 'project-1', issueNumber: 1, toColumnId: 'todo',+ expectedUpdatedAt: shown.updatedAt, closeReason: 'not_planned'+ })+ expect(client.updates[0].input).toEqual({ state: 'open', stateReason: 'reopened', labels: ['status:todo'] })+ })++ it('sends no reason for a move that does not change the state', async () => {+ const shown = issue(1, { labels: todo })+ const { client, service } = await ready([shown])+ await service.moveIssue({+ projectId: 'project-1', issueNumber: 1, toColumnId: 'doing',+ expectedUpdatedAt: shown.updatedAt, closeReason: 'not_planned'+ })+ expect(client.updates[0].input).toEqual({ labels: ['status:doing'] })+ })++ it('refuses a reason it does not know without writing anything', async () => {+ const shown = issue(1, { labels: todo })+ const { client, service } = await ready([shown])+ const result = await service.moveIssue({+ projectId: 'project-1', issueNumber: 1, toColumnId: 'done',+ expectedUpdatedAt: shown.updatedAt, closeReason: 'wontfix' as never+ })+ expect(result.status).toBe('invalid-target')+ expect(client.updates).toEqual([])+ })++ it('does not report a close as confirmed when GitHub recorded a different reason', async () => {+ const shown = issue(1, { labels: todo })+ const { client, service } = await ready([shown])+ client.recordedReason = 'completed'+ await expect(service.moveIssue({+ projectId: 'project-1', issueNumber: 1, toColumnId: 'done',+ expectedUpdatedAt: shown.updatedAt, closeReason: 'not_planned'+ })).rejects.toThrow('mutation-not-confirmed')+ })+})diff --git a/src/core/github/service.ts b/src/core/github/service.tsindex c5618a30b..728398c1f 100644--- a/src/core/github/service.ts+++ b/src/core/github/service.ts@@ -6,6 +6,7 @@ import type {GitHubIssuePage,GitHubIssueQuery,GitHubMutationResult,+ GitHubCloseReason,GitHubRepositoryLabel,GitHubThrottle,IssueHeartbeatResult,@@ -385,7 +386,14 @@ export class GitHubIssueService {issueNumber: numbertoColumnId: string | nullexpectedUpdatedAt: string+ closeReason?: GitHubCloseReason}): Promise<GitHubMutationResult> {+ // Reachable from the renderer and from a relay guest: an unknown reason is refused here, before+ // anything is read or written, rather than forwarded for GitHub to reject after a round trip.+ if (request.closeReason !== undefined &&+ request.closeReason !== 'completed' && request.closeReason !== 'not_planned') {+ return Promise.resolve({ status: 'invalid-target' })+ }const operationId = ++this.operationSequencereturn mutationChain(this.issueChains, `${request.projectId}:${request.issueNumber}`, async () => {const captured = await this.options.contextForProject(request.projectId)@@ -446,7 +454,12 @@ export class GitHubIssueService {// 'not_planned' (wontfix) into 'completed'. Closed issues all map into the completion// column, so a drag that lands one back where it already sits is a no-op the user never// meant as a state change — and it must not be one on GitHub either.- ...(latest.state === desiredState ? {} : { state: desiredState }),+ // When it DOES change, the reason travels with it: the one the user picked for a close+ // (GitHub's own default, `completed`, when none was given), and `reopened` for a reopen.+ ...(latest.state === desiredState ? {} : {+ state: desiredState,+ stateReason: desiredState === 'closed' ? request.closeReason ?? 'completed' : 'reopened'+ }),labels}if (capturedEpoch !== epoch(await this.options.contextForProject(request.projectId))) {@@ -466,7 +479,9 @@ export class GitHubIssueService {label.name.normalize('NFKC').toLocaleLowerCase('en-US')))const expectedLabels = new Set(labels.map((label) =>label.normalize('NFKC').toLocaleLowerCase('en-US')))- if (updated.state !== desiredState || confirmedLabels.size !== expectedLabels.size ||+ if (updated.state !== desiredState ||+ (input.state === 'closed' && updated.stateReason !== input.stateReason) ||+ confirmedLabels.size !== expectedLabels.size ||[...expectedLabels].some((label) => !confirmedLabels.has(label))) {throw new Error('mutation-not-confirmed')}diff --git a/src/renderer/components/ConfirmDialog.choice.test.tsx b/src/renderer/components/ConfirmDialog.choice.test.tsxnew file mode 100644index 000000000..a8e096dcb--- /dev/null+++ b/src/renderer/components/ConfirmDialog.choice.test.tsx@@ -0,0 +1,47 @@+// @vitest-environment jsdom+import { act } from 'react'+import { createRoot, type Root } from 'react-dom/client'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { ConfirmDialog } from './ConfirmDialog'++;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true++describe('ConfirmDialog choice', () => {+ let root: Root+ let host: HTMLElement+ beforeEach(() => {+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+ })+ afterEach(() => {+ act(() => root.unmount())+ host.remove()+ })++ it('shows every option from the start, with the current value selected', async () => {+ const onChange = vi.fn()+ await act(async () => {+ root.render(+ <ConfirmDialog+ message="Close #7?"+ confirmLabel="Close issue"+ choice={{+ label: 'Close as',+ options: [{ value: 'completed', label: 'Completed' }, { value: 'not_planned', label: 'Not planned' }],+ value: 'completed',+ onChange+ }}+ onConfirm={() => undefined}+ onCancel={() => undefined}+ />+ )+ })+ const radios = [...document.body.querySelectorAll<HTMLInputElement>('.confirm input[type="radio"]')]+ expect(radios.map((radio) => radio.value)).toEqual(['completed', 'not_planned'])+ expect(radios.map((radio) => radio.checked)).toEqual([true, false])+ expect(document.body.querySelector('.confirm [role="radiogroup"]')?.getAttribute('aria-label')).toBe('Close as')+ await act(async () => { radios[1].click() })+ expect(onChange).toHaveBeenCalledWith('not_planned')+ })+})diff --git a/src/renderer/components/ConfirmDialog.tsx b/src/renderer/components/ConfirmDialog.tsxindex 18c33182f..c129ba900 100644--- a/src/renderer/components/ConfirmDialog.tsx+++ b/src/renderer/components/ConfirmDialog.tsx@@ -31,6 +31,15 @@ interface ConfirmDialogProps {scope?: stringonScopeChange?: (scope: string) => void}+ /** A required pick among alternatives, shown from the start with `value` selected (e.g. the reason+ * a GitHub issue is closed). Unlike `option`, there is no "off": the caller always gets a value,+ * so it owns a sensible default. */+ choice?: {+ label: string+ options: { value: string; label: string }[]+ value: string+ onChange: (value: string) => void+ }/*** May Enter confirm this dialog? Default true — the user asked for it. Pass FALSE for a dialog* the app raised on someone ELSE's behalf (an agent verb like `close-worktree`): the user never@@ -73,6 +82,7 @@ export function ConfirmDialog({danger: dangerProp,alert = false,option,+ choice,enterConfirms = true,autoFocusButtons = true,onConfirm,@@ -127,6 +137,22 @@ export function ConfirmDialog({<div className="confirm" ref={boxRef} onClick={(e) => e.stopPropagation()}>{body}<p className="confirm__msg">{message}</p>+ {choice && (+ <div className="confirm__scopes" role="radiogroup" aria-label={choice.label}>+ {choice.options.map((item) => (+ <label key={item.value} className="confirm__scope">+ <input+ type="radio"+ name={`${id}-choice`}+ value={item.value}+ checked={choice.value === item.value}+ onChange={() => choice.onChange(item.value)}+ />+ {item.label}+ </label>+ ))}+ </div>+ )}{option && (<><label className="confirm__option">diff --git a/src/renderer/components/kanban/KanbanView.tsx b/src/renderer/components/kanban/KanbanView.tsxindex fcb047e8d..764fa1b64 100644--- a/src/renderer/components/kanban/KanbanView.tsx+++ b/src/renderer/components/kanban/KanbanView.tsx@@ -22,7 +22,7 @@ import { kanbanSource, sourceVisible } from '../../lib/kanbanSources'import type { ModalSpawn } from './ModalTerminal'import { ContextMenu, type MenuItem } from '../ContextMenu'import { IconAgent, IconExternal, IconNote, IconSwitch, IconTerminal, IconTrash, IconWeb } from '../icons'-import type { GitHubIssueCardView } from '@shared/github-issues'+import type { GitHubCloseReason, GitHubIssueCardView } from '@shared/github-issues'import { useGitHubIssues } from '../../state/githubIssues'import { useAgentStatus } from '../../state/agentStatus'import { useSession } from '../../session/session'@@ -163,9 +163,13 @@ export const KanbanView = memo(function KanbanView({>(null)const [githubRetry, setGitHubRetry] = useState(0)// A move that would close or reopen the issue on GitHub waits here for an explicit confirmation.- const [pendingGitHubMove, setPendingGitHubMove] = useState<- { issue: GitHubIssueCardView; columnId: string | null; confirmation: GitHubMoveConfirmation } | null- >(null)+ const [pendingGitHubMove, setPendingGitHubMove] = useState<{+ issue: GitHubIssueCardView+ columnId: string | null+ confirmation: GitHubMoveConfirmation+ /** The reason picked in the dialog, for a close; starts at the confirmation's default. */+ closeReason?: GitHubCloseReason+ } | null>(null)// Primitive selectors (not one object) — an object selector would re-render on every store set.const projectId = useProjects((s) => s.activeProjectId)const projectName = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId)?.name)@@ -332,7 +336,7 @@ export const KanbanView = memo(function KanbanView({if (intent.kind === 'noop') returnconst confirmation = githubMoveConfirmation(issue, columnId, completion)if (confirmation) {- setPendingGitHubMove({ issue, columnId, confirmation })+ setPendingGitHubMove({ issue, columnId, confirmation, closeReason: confirmation.defaultCloseReason })return}void moveGitHubState(api.githubIssues, projectId, issue.number, columnId, issue.updatedAt)@@ -717,12 +721,21 @@ export const KanbanView = memo(function KanbanView({message={pendingGitHubMove.confirmation.message}confirmLabel={pendingGitHubMove.confirmation.confirmLabel}danger={pendingGitHubMove.confirmation.danger}+ choice={pendingGitHubMove.confirmation.closeReasons && pendingGitHubMove.closeReason+ ? {+ label: 'Close as',+ options: pendingGitHubMove.confirmation.closeReasons,+ value: pendingGitHubMove.closeReason,+ onChange: (value) => setPendingGitHubMove((current) =>+ current ? { ...current, closeReason: value as GitHubCloseReason } : current)+ }+ : undefined}onCancel={() => setPendingGitHubMove(null)}onConfirm={() => {- const { issue, columnId } = pendingGitHubMove+ const { issue, columnId, closeReason } = pendingGitHubMovesetPendingGitHubMove(null)void moveGitHubState(- api.githubIssues, projectId, issue.number, columnId, issue.updatedAt+ api.githubIssues, projectId, issue.number, columnId, issue.updatedAt, closeReason)}}/>diff --git a/src/renderer/lib/githubIssueMove.test.ts b/src/renderer/lib/githubIssueMove.test.tsindex 25ae60e3c..55363ac46 100644--- a/src/renderer/lib/githubIssueMove.test.ts+++ b/src/renderer/lib/githubIssueMove.test.ts@@ -54,3 +54,18 @@ describe('githubMoveConfirmation', () => {expect(githubMoveConfirmation(closed, 'done', 'done')).toBeNull()})})++describe('close reason', () => {+ it('offers Completed and Not planned when closing, Completed first and preselected', () => {+ const confirmation = githubMoveConfirmation(open, 'done', 'done')+ expect(confirmation?.closeReasons).toEqual([+ { value: 'completed', label: 'Completed' },+ { value: 'not_planned', label: 'Not planned' }+ ])+ expect(confirmation?.defaultCloseReason).toBe('completed')+ })++ it('asks no reason for a reopen, which GitHub records as reopened', () => {+ expect(githubMoveConfirmation(closed, null, 'done')?.closeReasons).toBeUndefined()+ })+})diff --git a/src/renderer/lib/githubIssueMove.ts b/src/renderer/lib/githubIssueMove.tsindex a5357341c..bb61830c3 100644--- a/src/renderer/lib/githubIssueMove.ts+++ b/src/renderer/lib/githubIssueMove.ts@@ -9,6 +9,8 @@// cheap, easily mis-aimed gesture; the outcome is not. So state-changing moves ask first, and// label-only moves stay immediate.+import type { GitHubCloseReason } from '@shared/github-issues'+export type GitHubMoveIntentKind = 'noop' | 'labels-only' | 'close' | 'reopen'export interface GitHubMoveIntent {@@ -19,8 +21,18 @@ export interface GitHubMoveConfirmation {message: stringconfirmLabel: stringdanger: boolean+ /** A close asks WHY: GitHub records a reason on every closed issue, and a board close used to+ * file every one — including the ones being dismissed — as `completed`. Absent for a reopen,+ * which GitHub records as `reopened` on its own. */+ closeReasons?: Array<{ value: GitHubCloseReason; label: string }>+ defaultCloseReason?: GitHubCloseReason}+const CLOSE_REASONS: Array<{ value: GitHubCloseReason; label: string }> = [+ { value: 'completed', label: 'Completed' },+ { value: 'not_planned', label: 'Not planned' }+]+interface MovableIssue {number: numbertitle: string@@ -54,7 +66,9 @@ export function githubMoveConfirmation(return {message: `Close ${name} on GitHub? Everyone watching the issue is notified.`,confirmLabel: 'Close issue',- danger: true+ danger: true,+ closeReasons: CLOSE_REASONS,+ defaultCloseReason: 'completed'}}if (kind === 'reopen') {diff --git a/src/renderer/state/githubIssues.test.ts b/src/renderer/state/githubIssues.test.tsindex 8092ec840..44dfdf172 100644--- a/src/renderer/state/githubIssues.test.ts+++ b/src/renderer/state/githubIssues.test.ts@@ -168,6 +168,17 @@ describe('GitHub issue renderer state', () => {disconnect()})+ it('passes the chosen close reason through to the host', async () => {+ const client = api()+ const disconnect = await useGitHubIssues.getState().connect(client, 'p1', ['todo'])+ await useGitHubIssues.getState().move(client, 'p1', 2, 'done', '2026-08-09T00:00:00Z', 'not_planned')+ expect(client.moveIssue).toHaveBeenCalledWith({+ projectId: 'p1', issueNumber: 2, toColumnId: 'done',+ expectedUpdatedAt: '2026-08-09T00:00:00Z', closeReason: 'not_planned'+ })+ disconnect()+ })+it('catches a failed move so fire-and-forget UI calls do not reject', async () => {const client = api()const disconnect = await useGitHubIssues.getState().connect(client, 'p1', ['todo'])diff --git a/src/renderer/state/githubIssues.ts b/src/renderer/state/githubIssues.tsindex bb283f966..3cf43d310 100644--- a/src/renderer/state/githubIssues.ts+++ b/src/renderer/state/githubIssues.ts@@ -1,5 +1,6 @@import { create } from 'zustand'import type {+ GitHubCloseReason,GitHubIssuePage,GitHubIssueQuery,GitHubIssuesApi,@@ -36,7 +37,8 @@ interface GitHubIssuesState {projectId: string,issueNumber: number,toColumnId: string | null,- expectedUpdatedAt: string+ expectedUpdatedAt: string,+ closeReason?: GitHubCloseReason): Promise<GitHubMutationResult>}@@ -283,7 +285,7 @@ export const useGitHubIssues = create<GitHubIssuesState>((set, get) => ({})},- async move(api, projectId, issueNumber, toColumnId, expectedUpdatedAt) {+ async move(api, projectId, issueNumber, toColumnId, expectedUpdatedAt, closeReason) {const generation = get().projects[projectId]?.generationset((state) => {const project = state.projects[projectId]@@ -296,7 +298,9 @@ export const useGitHubIssues = create<GitHubIssuesState>((set, get) => ({}})try {- const result = await api.moveIssue({ projectId, issueNumber, toColumnId, expectedUpdatedAt })+ const result = await api.moveIssue({+ projectId, issueNumber, toColumnId, expectedUpdatedAt, ...(closeReason ? { closeReason } : {})+ })const status = result.status === 'confirmed'? 'Synced with GitHub.': result.status === 'refresh-pending'diff --git a/src/shared/github-issues.ts b/src/shared/github-issues.tsindex 92594f03a..2767d2360 100644--- a/src/shared/github-issues.ts+++ b/src/shared/github-issues.ts@@ -162,8 +162,14 @@ export interface IssueHeartbeatResult {etag?: string}+/** Why an issue is closed, as GitHub records it. A board close used to send none, so GitHub filed+ * every one of them as `completed` — including the ones the user was dismissing. */+export type GitHubCloseReason = 'completed' | 'not_planned'+export interface UpdateIssueInput {state?: 'open' | 'closed'+ /** Sent only WITH a state change: a close reason on a close, `reopened` on a reopen. */+ stateReason?: GitHubCloseReason | 'reopened'labels?: string[]}@@ -256,6 +262,8 @@ export interface GitHubIssuesApi {issueNumber: numbertoColumnId: string | nullexpectedUpdatedAt: string+ /** Used only when the move closes the issue; absent = `completed`, GitHub's own default. */+ closeReason?: GitHubCloseReason}): Promise<GitHubMutationResult>createMissingLabels(projectId: string): Promise<CreateMappedLabelsResult>clearCache(projectId: string): Promise<void>