Skip to content

fix: nested reduce in release.md to prevent null accumulator when no PRs have closing issue references#22726

Merged
pelikhan merged 2 commits intomainfrom
copilot/investigate-failure-issue-another-one
Mar 24, 2026
Merged

fix: nested reduce in release.md to prevent null accumulator when no PRs have closing issue references#22726
pelikhan merged 2 commits intomainfrom
copilot/investigate-failure-issue-another-one

Conversation

Copy link
Contributor

Copilot AI commented Mar 24, 2026

The Release workflow's "Setup release environment" step was failing because jq's reduce sets the accumulator to null when the update body produces zero outputs — which happens when none of the fetched PRs have closingIssuesReferences. The || echo "{}" fallback only catches non-zero exit codes, so null was written to the file and the subsequent jq 'keys | length' call crashed.

Fix

Replace the flat reduce (which uses []? as a generator in the update body) with a nested reduce pattern — already used and commented in daily-community-attribution.md:

-reduce .[] as $pr (
-  {};
-  $pr.closingIssuesReferences[]? as $issue |
-  ($issue.number | tostring) as $key |
-  .[$key] = (.[$key] // []) + [$pr.number]
-)
+# Use a nested reduce so the outer body always returns the accumulator,
+# even when closingIssuesReferences is empty (avoids jq setting acc to null).
+reduce .[] as $pr (
+  {};
+  reduce ($pr.closingIssuesReferences // [])[] as $issue (
+    .;
+    ($issue.number | tostring) as $key |
+    .[$key] = (.[$key] // []) + [$pr.number]
+  )
+)

The outer reduce body now always emits exactly one value (the inner reduce result), keeping the accumulator as {} rather than null.

  • release.md — patched jq expression
  • release.lock.yml — recompiled

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 (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 -Bw7m-6KTLXR (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 cfg 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git ternal/tools/actgit rkflow/js/**/*.jrev-parse ache/go/1.25.0/x--show-toplevel git (http block)
  • https://api.github.com/orgs/test-owner/actions/secrets
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name ithub/workflows user.name _modules/.bin/sh-lang=go1.17 (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 user.name Test User /usr/bin/git '**/*.ts' '**/*.git (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 773584/b441/_pkg_.a k/gh-aw/gh-aw/pkg/fileutil/tar.go ache/node/24.14.0/x64/bin/node -errorsas -ifaceassert -nilfunc git t-97�� bility_SameInputSameOutput227642207/001/stability-test.md -tests /usr/bin/git --local credential.helperev-parse /usr/bin/git 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 graphql -f 64/pkg/tool/linux_amd64/vet -f owner=github r 64/pkg/tool/linux_amd64/vet -C te '../../../**/*.json' '!../../../pkg/workflow/-errorsas rev-parse x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha github.event.issue.number x_amd64/vet /usr/bin/git *.json' '!../../git rev-parse 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linustatus /usr/bin/git y-test.md (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel ache/go/1.25.0/x64/pkg/tool/linuremote.origin.url /usr/bin/git "prettier" --wrigit (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 /tmp/go-build633773584/b443/_pkg_.a -trimpath /usr/bin/git -p main -lang=go1.25 git -C nt/action/git/ref/tags/v999.999.999 status /usr/bin/git .github/workflowgit -c=4 -nolocalimports git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha /tmp/TestCompileErrorFormatting2461070446/001 rev-parse /usr/bin/git ../pkg/workflow/git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git se 773584/b035/vet.rev-parse cfg git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git "prettier" --wrigit if 'closing' rev-parse ache/go/1.25.0/x--show-toplevel git (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 ithub/workflows user.email repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha json' --ignore-p-errorsas 8b865fb7420c3ca9-ifaceassert me: String!) { -nilfunc (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ithub/workflows main (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 /tmp/go-build633773584/b447/_pkg_.a -trimpath /usr/bin/git -p main -lang=go1.25 git add .github/workflows/test.md -dwarf=false /usr/bin/git go1.25.0 -c=4 -nolocalimports git (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 /tmp/TestHashConsistency_GoAndJavaScript2678104987/001/test-frontmatter-with-arrays.md bash /usr/bin/git ../pkg/workflow/git (http block)
  • https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha -unreachable=false /tmp/go-build633773584/b084/vet.cfg 0/x64/bin/node submodules | heagit (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 (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .visibility (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq .object.sha jpq_JbW5I /tmp/go-build633773584/b105/vet.cfg 773584/b384/vet.cfg l (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha 5738-15012/test-1205916852 /tmp/go-build633773584/b092/vet.cfg 773584/b383/vet.cfg l (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 (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 (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 rev-parse 64/pkg/tool/linux_amd64/vet ignore (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 (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 rev-parse 64/pkg/tool/linux_amd64/vet ignore (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 -f x_amd64/vet ignore owner=github -f x_amd64/vet -C rite '**/*.cjs' '**/*.ts' '**/*.json' --ignore-p-errorsas cfg x_amd64/link remote.origin.urnode (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 config 64/pkg/tool/linux_amd64/vet ignore (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path ithub/workflows pull.rebase es/.bin/sh (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 (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 (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 xterm-color cfg At,event,headBranch,headSha,displayTitle (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v2.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha k/gh-aw/gh-aw/.g-errorsas (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha th .prettierigno-errorsas (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v3.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq .object.sha th .prettierigno-errorsas (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 (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 xterm-color cfg 64/pkg/tool/linu-nolocalimports (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 nore (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 odules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/sh (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo ache/go/1.25.0/x64/pkg/tool/linux_amd64/link (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build633773584/b402/cli.test /tmp/go-build633773584/b402/cli.test -test.testlogfile=/tmp/go-build633773584/b402/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true (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 ithub/workflows user.name ode_modules/.bin-lang=go1.16 (http block)

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…closing_refs_by_issue

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/06fb0692-f7dd-4bdc-8f2d-6a93cbd052d0
Copilot AI changed the title [WIP] Investigate failure in GitHub Actions run fix: nested reduce in release.md to prevent null accumulator when no PRs have closing issue references Mar 24, 2026
Copilot AI requested a review from pelikhan March 24, 2026 17:03
@pelikhan pelikhan marked this pull request as ready for review March 24, 2026 17:07
Copilot AI review requested due to automatic review settings March 24, 2026 17:07
@pelikhan pelikhan merged commit f10a842 into main Mar 24, 2026
49 checks passed
@pelikhan pelikhan deleted the copilot/investigate-failure-issue-another-one branch March 24, 2026 17: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

Fixes a jq reduce edge case in the Release workflow where the accumulator could become null (and later crash) when none of the merged PRs include any closingIssuesReferences.

Changes:

  • Update the jq expression in release.md to a nested reduce so the outer reducer always yields the accumulator.
  • Regenerate release.lock.yml to reflect the updated compiled workflow.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/release.md Switches closing-issue index construction to a nested jq reduce pattern to avoid null accumulator/output when no closing refs exist.
.github/workflows/release.lock.yml Recompiled lockfile reflecting the updated workflow script and metadata hash.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants