Skip to content

feat(safe-outputs): add duplicate state_reason to close-issue#18257

Merged
pelikhan merged 3 commits intomainfrom
copilot/update-close-issue-duplicate
Feb 25, 2026
Merged

feat(safe-outputs): add duplicate state_reason to close-issue#18257
pelikhan merged 3 commits intomainfrom
copilot/update-close-issue-duplicate

Conversation

Copy link
Contributor

Copilot AI commented Feb 25, 2026

The close-issue safe output had no way to close issues as duplicate — the only supported state reasons were completed, not_planned, and reopened. This made it impossible to build agentic workflows that properly triage and close duplicate issues.

Changes

  • MCP tool spec (safe_outputs_tools.json): Added state_reason field to close_issue schema with enum ["completed", "not_planned", "duplicate"], enabling AI agents to specify the close reason per-item in their output
  • Handler (close_issue.cjs): Reads state_reason from the item (agent output) with fallback to config-level default, then "completed". Passes it as state_reason to github.rest.issues.update()
  • Go config (close_entity_helpers.go, compiler_safe_outputs_config.go): Added StateReason string (yaml:"state-reason") to CloseEntityConfig; wired into the handler config builder so workflow authors can set a default in frontmatter
  • Docs: Updated state reasons list to include duplicate; added state-reason to the config YAML example

Usage

Agent output (per-item):

{"type": "close_issue", "body": "Duplicate of #50", "state_reason": "duplicate"}

Workflow frontmatter default (applies to all closes):

safe-outputs:
  close-issue:
    state-reason: "duplicate"

Item-level state_reason takes precedence over the config default.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw nonexistent-workinit --limit /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile t-80�� k/gh-aw/gh-aw/.github/workflows/bot-detection.md -trimpath /usr/bin/git -p main -lang=go1.25 git (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw x_amd64/vet /opt/hostedtoolcrun go test�� -v -run 64/bin/go ./pkg/workflow/.sh x_amd64/vet /usr/bin/infocmp"prettier" --check 'scripts/**/*.js' --ignore-path .prettierignore go (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw x_amd64/vet /opt/hostedtoolcrun /opt/hostedtoolclint:cjs -V=f�� x_amd64/vet node 64/bin/go /home/REDACTED/worsh x_amd64/vet /usr/bin/git go (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha ry=1 /tmp/go-build2396098722/b095/vet.cfg 6098722/b390/_pkg_.a 80bf13b2620176ebgit GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linu/tmp/go-build2396098722/b434/_testmain.go -uns�� -unreachable=false (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683 --jq .object.sha re GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha sole.test GO111MODULE ortcfg.link GOINSECURE 8aba66790bd3d49erev-parse GOMODCACHE 8r-fzkKmfn9l_srSHn/RUuDQiLFz-j_oDvWw_zH/mJwZhEfTxPpXJwOGVu5f (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha -json GO111MODULE Name,createdAt,startedAt,updated-buildmode=exe GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/x-extld=gcc -uns�� runs/20260225-045047-29598/test-442557532/.github/workflows /tmp/go-build2396098722/b036/vet.cfg 6098722/b342/vet.cfg GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha -json GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link -uns�� ipts.test /tmp/go-build2396098722/b048/vet.cfg ortcfg.link GOSUMDB GOWORK 64/bin/go U8IGZ3xsiiK_VzgSGT/jqXiqKS2mm7rG7KRlb0f/T36gUPQZXFjOiSQ6baL5 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha run --auto /usr/bin/git --detach GO111MODULE nch,headSha,disp--show-toplevel git conf�� user.name Test User /usr/bin/git -json GO111MODULE x_amd64/vet git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha 180852961/.github/workflows .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -bool -buildtags /usr/bin/git -errorsas -ifaceassert -nilfunc git rev-�� --show-toplevel -tests /usr/bin/git che/go-build/f9/git GOPROXY 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -c x_amd64/vet /usr/bin/git -json GO111MODULE x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/gh -json GO111MODULE x_amd64/vet gh (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha --show-toplevel git 64/bin/go add origin /usr/bin/gh go buil�� ./... gh 64/bin/go download 12346 /usr/bin/git go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha --show-toplevel git 64/bin/go --show-toplevel x_amd64/vet /usr/bin/git git -c log.showsignatur**/*.json log 64/bin/go -n1 --format=format:/home/REDACTED/.npm/_npx/b388654678d519d9/node_modules/.bin/prettier e8965fb4c2c3f494--check go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha npx prettier --cGOSUMDB GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go sh -c "prettier" --che-errorsas /bin/sh 64/bin/go tierignore (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha prettier --check 64/bin/go --ignore-path .prettierignore 64/bin/go go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha "prettier" --check 'scripts/**/*GOINSECURE node 64/bin/go --write ../../../pkg/wor-unsafeptr=false 64/bin/go _9LLtYheNxUI env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE r: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha vaScript1316168834/001/test-complex-frontmatter-with-tools.md GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -uns�� -unreachable=false /tmp/go-build2396098722/b067/vet.cfg 6098722/b346/vet.cfg GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha ath ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env re GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha --show-toplevel git 64/bin/go tup/sh/sanitize_go x_amd64/vet /usr/bin/git bash --no�� --noprofile git 64/bin/go --git-dir x_amd64/vet /usr/bin/git go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha --show-toplevel git 64/bin/go --show-toplevel x_amd64/vet /opt/hostedtoolc"prettier" --check '**/*.cjs' '**/*.ts' '**/*.json' --ignore-path ../../../.prettierignore bash --no�� --noprofile /opt/hostedtoolcGOWORK 64/bin/go env.NODE_VERSIONbash x_amd64/vet /usr/bin/git go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha --show-toplevel git 64/bin/go GOMODCACHE x_amd64/vet /usr/bin/git make lint�� x_amd64/vet /usr/bin/git 64/bin/go -v x_amd64/vet 64/bin/node go (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x-test.short=true GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -uns�� runs/20260225-045047-29598/test-442557532/.github/workflows /tmp/go-build2396098722/b050/vet.cfg 6098722/b345/vet.cfg GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha --show-toplevel git 64/bin/go tup/sh/sanitize_go x_amd64/vet /usr/bin/git bash --no�� --noprofile git 64/bin/go --show-toplevel x_amd64/vet /usr/bin/git go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha --show-toplevel git 64/bin/go --show-toplevel x_amd64/vet /usr/bin/gh bash --no�� --noprofile gh 64/bin/go list --json /usr/bin/git go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha -json GO111MODULE es/.bin/node GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/anchore/sbom-action/git/ref/tags/v0
    • Triggering command: /usr/bin/gh gh api /repos/anchore/sbom-action/git/ref/tags/v0 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE r: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha --noprofile infocmp 64/bin/go xterm-color x_amd64/vet /usr/bin/git go env h ../../../.prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/docker/build-push-action/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE odules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/docker/login-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE _modules/.bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/docker/metadata-action/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE r: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE r: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet estl�� -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuorigin (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet estl�� -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuTest User (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link env -json GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link env aw.test GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuTest User env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE s9ZXZGY/X4XoDkfiiEtxJ64HjgrP (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path tions-lock.json pkg/workflow/data/action_pins.json; \ echo "��� Action pins synced successfully/opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet --check 64/bin/go **/*.ts **/*.json --ignore-path git conf�� extensions.objec-errorsas sh 64/bin/go -d (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 github.com/davec-atomic -lang=go1.16 go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/pkg/tool/linu-test.short=true GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha --noprofile /usr/bin/git 64/bin/go -v x_amd64/vet /usr/bin/git go env h ../../../.pret.prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE 64/pkg/tool/linu-nilfunc GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu-tests env 1363474341/.github/workflows .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha ath ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env re GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha tmatter-with-nested-objects.md rty 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolc-buildtags -V=f�� git sh 64/bin/go -d (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOSUMDB GOWORK run-script/lib/n-bool /opt/hostedtoolc-buildtags -V=f�� output_builder.g-errorsas sh 64/bin/go -d (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build2396098722/b381/cli.test /tmp/go-build2396098722/b381/cli.test -test.testlogfile=/tmp/go-build2396098722/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOSUMDB GOWORK run-script/lib/n-bool sh -c "prettier" --che-errorsas node 64/bin/go --write ../../../pkg/wor-atomic 64/bin/go go (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name prettier --check 64/bin/go **/*.ts **/*.json --ignore-path go env -json GOMOD 64/bin/go tierignore (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>close-issue safe output missing state_reason: duplicate</issue_title>
<issue_description>Currently, we can close issues as completed, not_planned, reopened,
but there is no way to close an issue as a duplicate.

This makes it impossible to create an Agentic Workflow which can close duplicate issues properly. </issue_description>

Comments on the Issue (you are @copilot in this section)

@pelikhan Update the spec about close issue with duplicate value, then update implementation.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Add state_reason field to close_issue MCP tool spec (safe_outputs_tools.json)
  with enum values: completed, not_planned, duplicate
- Update close_issue.cjs to read state_reason from item (AI output) or
  config (workflow frontmatter), defaulting to 'completed'
- Add StateReason field to CloseEntityConfig Go struct
- Include state_reason in close_issue handler config builder
- Update documentation to list duplicate as a valid state reason
- Add tests for state_reason functionality in close_issue.test.cjs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update close issue functionality to handle duplicates feat(safe-outputs): add duplicate state_reason to close-issue Feb 25, 2026
@pelikhan
Copy link
Contributor

@copilot review the required payload in the GitHub APIs when the close reason is duplicate

Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot review the required payload in the GitHub APIs when the close reason is duplicate

Checked the GitHub REST API (PATCH /repos/{owner}/{repo}/issues/{issue_number}). The state_reason field is described as "The reason for the state change. Ignored unless state is changed." All four values — completed, not_planned, duplicate, reopened — are handled the same way: just pass state: "closed" and state_reason: "duplicate". No additional fields (e.g. duplicate_of) are required or supported. The current implementation is correct.

@pelikhan pelikhan marked this pull request as ready for review February 25, 2026 05:07
Copilot AI review requested due to automatic review settings February 25, 2026 05:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for closing issues as duplicate via the close-issue safe output, enabling workflows/agents to provide an explicit close reason.

Changes:

  • Extended the close_issue MCP tool schema to allow state_reason (completed, not_planned, duplicate).
  • Updated the close_issue handler to read state_reason (item-level override, config default, then completed) and pass it to github.rest.issues.update().
  • Added Go frontmatter config support (state-reason) and updated docs/tests accordingly.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/workflow/compiler_safe_outputs_config.go Passes state_reason from compiled safe-outputs config into the close-issue handler config.
pkg/workflow/close_entity_helpers.go Adds state-reason to typed close-entity configuration (issues only).
docs/src/content/docs/reference/safe-outputs.md Documents state-reason config and updates supported reasons to include duplicate.
actions/setup/js/safe_outputs_tools.json Updates the close_issue MCP tool schema to accept state_reason including duplicate.
actions/setup/js/close_issue.cjs Uses item/config state_reason when closing issues via REST update.
actions/setup/js/close_issue.test.cjs Adds test coverage for default/config/item-level state_reason behavior.
Comments suppressed due to low confidence (1)

docs/src/content/docs/reference/safe-outputs.md:223

  • This line says the close reason can be set “per-item in agent output”, but it doesn’t specify the JSON field name (state_reason). Since the YAML key is state-reason, readers may assume the same name applies to agent output and produce invalid tool output. Consider adding the exact field name and/or a small JSON example here.
**State Reasons**: `completed`, `not_planned`, `duplicate` (default: `completed`). Can also be set per-item in agent output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 135 to 139
},
"state_reason": {
"type": "string",
"enum": ["completed", "not_planned", "duplicate"],
"description": "The reason for closing the issue. Use 'completed' for resolved issues, 'not_planned' for issues that won't be addressed, or 'duplicate' for duplicate issues. Defaults to 'completed'."
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two safe outputs tool schema copies in this repo. This change updates actions/setup/js/safe_outputs_tools.json, but the embedded schema used by the Go compiler/CLI is pkg/workflow/js/safe_outputs_tools.json (see pkg/workflow/js.go / pkg/workflow/safe_outputs_config.go). Please update the close_issue tool in that file as well, otherwise state_reason will still be rejected/unknown in the generated MCP tools list.

Suggested change
},
"state_reason": {
"type": "string",
"enum": ["completed", "not_planned", "duplicate"],
"description": "The reason for closing the issue. Use 'completed' for resolved issues, 'not_planned' for issues that won't be addressed, or 'duplicate' for duplicate issues. Defaults to 'completed'."

Copilot uses AI. Check for mistakes.
@kdehl16-web

This comment has been minimized.

@github-actions github-actions bot added the spam label Feb 25, 2026
@pelikhan pelikhan merged commit 5118202 into main Feb 25, 2026
48 checks passed
@pelikhan pelikhan deleted the copilot/update-close-issue-duplicate branch February 25, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

close-issue safe output missing state_reason: duplicate

4 participants