Skip to content

perf: eliminate reflection in validateSafeOutputsMax (4.3x faster)#30701

Merged
pelikhan merged 3 commits into
mainfrom
copilot/fix-validation-performance-regression-again
May 7, 2026
Merged

perf: eliminate reflection in validateSafeOutputsMax (4.3x faster)#30701
pelikhan merged 3 commits into
mainfrom
copilot/fix-validation-performance-regression-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

validateSafeOutputsMax used reflect.FieldByName to iterate all 42 SafeOutputsConfig fields on every validation call. CPU profiling showed this consumed 74% of BenchmarkValidation time, even for workflows with no safe-outputs configured — because SafeOutputsConfig is always initialized to a non-nil empty struct by the compiler orchestrator.

Changes

  • safe_outputs_max_validation.go: Replace the reflection loop with direct struct field access (same pattern as hasAnySafeOutputEnabled). Extract a checkMaxField helper to keep per-field code concise. Remove reflect import and the sortedSafeOutputMaxFieldNames init-time slice.

  • safe_outputs_max_validation_test.go: Add TestValidateSafeOutputsMaxFieldCoverage — uses reflection in test code to assert that every field in safeOutputFieldMapping (except DispatchRepository) triggers an error on invalid max, guarding against future omissions when new safe output types are added.

Before / After

BenchmarkValidation  ~7,345 ns/op  →  ~1,709 ns/op  (4.3× faster)

The reported regression (13,791 → 18,849 ns/op, +36.7%) is resolved; performance is now well below historical baseline.

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 gh repo view --json owner,name --jq .owner.login + "/" + .name k (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 --ignore-path ../../../.pretti--show-toplevel sh sRem�� _Wlv0IiZI x_amd64/compile erutil.test rror .cfg 64/pkg/tool/linu--show-toplevel erutil.test (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 er_test ../../../.prettierignore sh -c uypkflb2T -pack k/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/node get .cfg ode-gyp-bin/sh rtcfg (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 ./../pkg/workflow/js/**/*.json' --ignore-path -buildtags modules/@npmcli/run-script/lib/node-gyp-bin/sh -errorsas -ifaceassert -nilfunc /opt/hostedtoolc-buildtags -ato�� js/**/*.json' ---errorsas -buildtags 1/x64/lib/node_m-nilfunc -errorsas -ifaceassert -nilfunc bash (http block)
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name -b feature-branch (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, .object.type] | @tsv --show-toplevel 615555/b445/stats.test /usr/bin/git /existing.md tmain.go ache/go/1.25.8/x--show-toplevel git rev-�� --show-toplevel ache/go/1.25.8/x--jq /usr/bin/git 4241-15029/test-gh -tests 615555/b463/impo/repos/actions/github-script/git/ref/tags/v9 git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq [.object.sha, .object.type] | @tsv --show-toplevel /opt/hostedtoolc-buildtags /usr/bin/git ithub-script/gitgh -buildtags clusion,workflow/repos/actions/github-script/git/ref/tags/v9.0.0 git rev-�� --show-toplevel git /usr/bin/git thImports1368633gh remote.origin.urapi om/upstream/repo/repos/actions/github-script/git/ref/tags/v9 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, .object.type] | @tsv --get l (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq [.object.sha, .object.type] | @tsv -aw/git/ref/tags/v1.0.0 git bject.type] | @tsv /ref/tags/v9 git sv git rev-�� /ref/tags/v9 git sv heckout/git/ref/git git bject.type] | @t--show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (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, .object.type] | @tsv Imports832562067/001/inlined-b.md 53 e/git ACCEPT 2233841/b031/vetrev-parse ndor/bin/bash e/git -c 3 ache/go/1.25.8/x../../../**/*.json ache/node/24.14.1/x64/bin/node w/js/**/*.json' infocmp 2233841/b163/vet-1 ache/go/1.25.8/xxterm-color /opt/hostedtoolcache/go/1.25.8/x^remote\..*\.gh-resolved$ (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv ithub-script/git/ref/tags/v9 /usr/bin/git bject.type] | @tsv -v /opt/hostedtoolcrev-parse ache/node/24.14.--show-toplevel git rev-�� --show-toplevel ache/node/24.14.1/x64/bin/node /usr/bin/git uts.enforce_all git x_amd64/link /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv --show-toplevel infocmp /usr/bin/git xterm-color bash /usr/bin/git git rev-�� /ref/tags/v9 git sv --show-toplevel node /usr/bin/infocmp--show-toplevel 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, .object.type] | @tsv runs/20260506-234241-15029/test-3475571925 -tests /bin/sh l /tmp/go-build217api cal/bin/bash /bin/sh -c git-receive-pack '/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitbranch_with_-p git-receive-pack '/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitbranch_with_github.com/githurev-parse /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile ./../pkg/workflogit /tmp/go-build217rev-parse x_amd64/compile /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv /tmp/gh-aw-test-runs/20260506-234241-15029/test-2439170101/.github/workflows (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv ansitiveImports1221926038/001 -test.v=true /usr/bin/git -test.timeout=10git -test.run=^Test -test.short=true--show-toplevel git init�� -lang=go1.25 bash /opt/hostedtoolcache/node/24.14.1/x64/bin/node th .prettierignogit kPxqne9Ce1LHx1u_rev-parse /opt/hostedtoolc--show-toplevel /opt/hostedtoolcache/node/24.14.1/x64/bin/node (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, .object.type] | @tsv --show-toplevel docker /usr/bin/git image:v1.0.0 S1tZJmA/SqW9rykMapi (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq [.object.sha, .object.type] | @tsv --show-toplevel ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git --show-toplevel git 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/vet 64/pkg/tool/linux_amd64/vet --get remote.origin.urrev-parse 2879382/b465/vet--show-toplevel 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv json' --ignore-path ../../../.pr**/*.json 64/src/cmd/vendor/golang.org/x/t--ignore-path ache/go/1.25.8/x64/pkg/tool/linu../../../.prettierignore (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv -c=4 -nolocalimports -importcfg /tmp/go-build938615555/b001/importcfg -pack /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/flatted/golang/pkg/flatted/flatted.go /opt/hostedtoolcache/go/1.25.8/x../../../**/*.json /pre�� ./../pkg/workflow/js/**/*.json' --ignore-path -buildtags x_amd64/compile -errorsas -ifaceassert -nilfunc x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv -c=4 -nolocalimports -importcfg /tmp/go-build938615555/b390/importcfg -pack /home/REDACTED/work/gh-aw/gh-aw/internal/tools/actions-build/main.go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -uns�� -unreachable=false /tmp/go-build2172233841/b179/vet.cfg modules/@npmcli/run-script/lib/node-gyp-bin/sh (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9.0.0
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9.0.0 --jq [.object.sha, .object.type] | @tsv json' --ignore-path ../../../.pr**/*.json 64/src/cmd/vendor/github.com/goo--ignore-path ules/.bin/node pkg/workflow/actsh pkg/workflow/act-c pkg/workflow/act"prettier" --write 'scripts/**/*.js' --ignore-path .prettierignore --log-level=error ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile ules�� h ../../../.prettierignore -buildtags cal/bin/bash -errorsas b.com/google/ppr/home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/prettier -nilfunc /opt/hostedtoolc../../../**/*.json (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9.0.0 --jq [.object.sha, .object.type] | @tsv -unreachable=false /tmp/go-build2172233841/b016/vet.cfg x86_64/bash hub/aw/actions-lnode (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9.0.0 --jq [.object.sha, .object.type] | @tsv on' --ignore-path ../../../.pret.prettierignore /tmp/go-build2172233841/b045/vet--log-level=error 64/bin/bash (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, .object.type] | @tsv --show-toplevel util.test /usr/bin/gh 2130331692 64/pkg/tool/linu-1 e/git gh api /repos/actions/github-script/git/ref/tags/v9 --jq /usr/bin/git --write scripts/**/*.js ache/node/24.14.--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel gh /usr/bin/git licyTrustedUsersinfocmp --jq (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, .object.type] | @tsv -lang=go1.25 bash /usr/bin/git ./../pkg/workflogit x3m_6WLdekpXRmMmrev-parse x_amd64/vet git push�� -u origin (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel sh /usr/bin/infocmp ring363629614/00gh 64/pkg/tool/linuapi e/git infocmp -1 xterm-color e/git /usr/bin/git --write scripts/**/*.js /opt/hostedtoolc--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel git /usr/bin/git /tmp/TestGuardPogit remote ps git rev-�� /ref/tags/v9 ps sv git l 64/pkg/tool/linuxterm-color gh (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, .object.type] | @tsv 4241-15029/test-2130331692 -tests bject.type] | @tsv on' --ignore-patgit /tmp/go-build217rev-parse modules/@npmcli/--show-toplevel /usr/lib/git-core/git pack�� 3268678389 --revs /usr/bin/git --thin --delta-base-offrev-parse -q git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv /tmp/gh-aw-test-runs/20260506-23-f l /usr/bin/git w/js/**/*.json' git _test.go iptables git rev-�� --show-toplevel /opt/hostedtoolc--jq /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv ansitiveImports1221926038/001 DIvrJo6ipZht /usr/bin/git /tmp/go-build112git -trimpath ules/.bin/pretti--show-toplevel git conf�� user.email test@example.com /opt/hostedtoolcache/node/24.14.1/x64/bin/node Gitcustom_branchgit Gitcustom_branchrev-parse odules/npm/node_--show-toplevel /opt/hostedtoolcache/node/24.14.1/x64/bin/node (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, .object.type] | @tsv /ref/tags/v9 j5-nw4G/JGSTohN04cdx88MHZRgg sv */*.json' '!../.git pkg/workflow/ k/_temp/uv-pytho--show-toplevel infocmp -1 xterm-color bash /usr/bin/git ../pkg/workflow/git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv remove origin /usr/bin/git b/workflows gh x_amd64/link git rev-�� /ref/tags/v9 x_amd64/link sv xterm-color git /usr/bin/git git (http block)
  • https://api.github.com/repos/aws-actions/configure-aws-credentials/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/aws-actions/configure-aws-credentials/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel git /usr/bin/git ons-test34308795git remote /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile /usr/bin/git /tmp/go-build938gh -trimpath om/other/repo.gistatus git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/aws-actions/configure-aws-credentials/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel node /usr/bin/git /tmp/TestHashStagh /opt/hostedtoolcapi clusion,workflow/repos/actions/github-script/git/ref/tags/v9 git rev-�� /ref/tags/v9 infocmp sv xterm-color 5df862f6 om/owner/repo.gi--show-toplevel infocmp (http block)
    • Triggering command: /usr/bin/gh gh api /repos/aws-actions/configure-aws-credentials/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel 64/pkg/tool/linux_amd64/vet x_amd64/vet --show-current git cfg x_amd64/vet rev-�� --show-toplevel gh /usr/bin/infocmp list --json .cfg infocmp (http block)
  • https://api.github.com/repos/azure/login/git/ref/tags/v2
    • Triggering command: /usr/bin/gh gh api /repos/azure/login/git/ref/tags/v2 --jq [.object.sha, .object.type] | @tsv --show-toplevel ache/node/24.14.1/x64/bin/node /usr/bin/git uts.enforce_all git rev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git mpleWorkflow2923infocmp remote.origin.ur-1 om/myorg/repo.gixterm-color git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/azure/login/git/ref/tags/v2 --jq [.object.sha, .object.type] | @tsv --show-toplevel 64/pkg/tool/linux_amd64/vet (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, .object.type] | @tsv --show-toplevel ache/node/24.14.1/x64/bin/node /usr/bin/git uts.enforce_all git x_amd64/link /usr/bin/git git rev-�� --show-toplevel git /usr/bin/infocmp (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq [.object.sha, .object.type] | @tsv --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git /usr/bin/git git cfg git rev-�� --show-toplevel /usr/bin/git /usr/bin/gh -v git .cfg gh (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0.1.2
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq [.object.sha, .object.type] | @tsv /repos/actions/github-script/git/ref/tags/v9 --jq /usr/bin/gh SameOutput402523infocmp 64/pkg/tool/linu-1 kflows/local-worxterm-color gh api /repos/actions/github-script/git/ref/tags/v9 --jq /usr/bin/git FieldEnforcementinfocmp 64/pkg/tool/linu-1 /home/REDACTED/nodxterm-color git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq [.object.sha, .object.type] | @tsv --show-toplevel -tests /usr/bin/git --show-toplevel git o.git git rev-�� /ref/tags/v9 /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu-ifaceassert sv k/gh-aw/gh-aw/.ggit -buildtags x_amd64/vet git (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, .object.type] | @tsv --get (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq [.object.sha, .object.type] | @tsv list --json .cfg --limit 100 --created ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet rev-�� --git-dir gh ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /repos/actions/ggit --jq /usr/bin/gh ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (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, .object.type] | @tsv user.email test@example.com /opt/hostedtoolcache/node/24.14.1/x64/bin/node Gitmain_branch42git Gitmain_branch42rev-parse 1/x64/bin/bash /opt/hostedtoolcache/node/24.14.1/x64/bin/node /tmp�� github.actor && secrets.TOKEN bash /usr/bin/git ../pkg/workflow/git rsion=ddb2533-direv-parse x_amd64/compile git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq [.object.sha, .object.type] | @tsv WorkflowFiles_AlwaysRecompiles2230210822/001 --json .cfg --limit 100 --created ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet init�� /usr/bin/git x_amd64/vet ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet --show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --limit 100 --created >=2026-04-29 (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --limit 100 --created >=2026-04-06 (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --limit 100 --created >=2026-02-05 (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/1/artifacts --jq .artifacts[].name x_amd64/vet x_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/1/artifacts --jq .artifacts[].name --jq sv --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git ithub-script/gitgit git bject.type] | @t--show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12345/artifacts --jq .artifacts[].name (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 --silent x_amd64/link ignore (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12345/artifacts --jq .artifacts[].name infocmp /usr/bin/git xterm-color git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1234567890
    • Triggering command: /usr/bin/gh gh api repos/{owner}/{repo}/actions/runs/1234567890 --jq {databaseId: .id, number: .run_number, url: .html_url, status: .status, conclusion: .conclusion, workflowName: .name, workflowPath: .path, createdAt: .created_at, startedAt: .run_started_at, updatedAt: .updated_at, event: .event, headBranch: .head_branch, nore --log-level--ignore-path /tmp/go-build217../../../.prettierignore x_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh api repos/{owner}/{repo}/actions/runs/1234567890 --jq {databaseId: .id, number: .run_number, url: .html_url, status: .status, conclusion: .conclusion, workflowName: .name, workflowPath: .path, createdAt: .created_at, startedAt: .run_started_at, updatedAt: .updated_at, event: .event, headBranch: .head_branch, /usr/bin/git git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12346/artifacts --jq .artifacts[].name (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 format:cjs k/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/sh (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12346/artifacts --jq .artifacts[].name git ee5dbc6eb63f40d0479db80b9576d57876942ad6eaf1142f-d --show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/2/artifacts --jq .artifacts[].name (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 x_amd64/vet cal/bin/sh nore (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/2/artifacts --jq .artifacts[].name git bject.type] | @tsv ithub-script/git/usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name cfg in/sh (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 x_amd64/vet /home/node_modules/.bin/node nore (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name git bject.type] | @tsv --show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/4/artifacts --jq .artifacts[].name x_amd64/vet ache/node/24.14.1/x64/lib/node_modules/npm/node_-nilfunc (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/4/artifacts --jq .artifacts[].name git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name x_amd64/vet k/gh-aw/gh-aw/actions/setup/js/node_modules/.bin-buildmode=exe (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 x_amd64/vet er.test nore (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name --jq sv --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git 64/pkg/tool/linux_amd64/vet ithub-script/gitgit git bject.type] | @tuser.name 64/pkg/tool/linuTest User (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path ./../pkg/workflow/js/**/*.json' --ignore-path ../../../.prettierignore /tmp/go-build2172233841/b169/vet.cfg (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 --format=format:remote --end-of-optionsadd node /hom�� 3334/001/stability-test.md **/*.cjs k **/*.json --ignore-path ../../../.pretti--git-dir sh (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build938615555/b404/cli.test /tmp/go-build938615555/b404/cli.test -test.testlogfile=/tmp/go-build938615555/b404/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true (http block)
    • Triggering command: /tmp/go-build2593297391/b404/cli.test /tmp/go-build2593297391/b404/cli.test -test.testlogfile=/tmp/go-build2593297391/b404/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true --show-toplevel /opt/hostedtoolcrev-parse /usr/bin/git gh api /ref/tags/v9 --jq sv --show-toplevel git /usr/bin/git infocmp (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v0.47.4
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq [.object.sha, .object.type] | @tsv --show-toplevel node /usr/bin/git /tmp/TestHashCondu -tests /usr/bin/git git rev-�� --show-toplevel git /usr/bin/infocmp --show-toplevel bash /usr/bin/git infocmp (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq [.object.sha, .object.type] | @tsv --show-toplevel git /opt/hostedtoolcache/go/1.25.8/x64/bin/go remove l ash go test�� /ref/tags/v9 -parallel=4 sv -run=^Test ./... -short git (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, .object.type] | @tsv _Wlv0IiZI x_amd64/compile $name) { hasDiscussionsEnabled } } rror .cfg 64/pkg/tool/linu--show-toplevel erutil.test 3861�� on tmain.go 1/x64/bin/node erignore .cfg 64/pkg/tool/linuxterm-color ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq [.object.sha, .object.type] | @tsv ithub-script/git/ref/tags/v9 gh bject.type] | @tsv /repos/actions/ggit --jq /usr/bin/git gh api /ref/tags/v9 --jq sv --show-toplevel infocmp /usr/bin/git git (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, .object.type] | @tsv */*.json' '!../../../pkg/workflow/js/**/*.json' --ignore-path (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq [.object.sha, .object.type] | @tsv ithub-script/git/ref/tags/v9 --jq bject.type] | @tsv --show-toplevel node /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/gh git (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, .object.type] | @tsv */*.json' '!../../../pkg/workflow/js/**/*.json' --ignore-path (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv --noprofile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv --show-toplevel git /usr/bin/git --show-toplevel /opt/hostedtoolcrev-parse (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, .object.type] | @tsv */*.json' '!../../../pkg/workflow/js/**/*.json' --ignore-path (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 git sv --show-toplevel node /usr/bin/git git rev-�� /ref/tags/v9 git sv ithub-script/gitgit git bject.type] | @tuser.name gh (http block)
  • https://api.github.com/repos/google-github-actions/auth/git/ref/tags/v2
    • Triggering command: /usr/bin/gh gh api /repos/google-github-actions/auth/git/ref/tags/v2 --jq [.object.sha, .object.type] | @tsv --show-toplevel git /usr/bin/git ithub-script/gitgit remote bject.type] | @t--show-toplevel git rev-�� --show-toplevel git /usr/bin/git /tmp/gh-aw-test-git rev-parse /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/google-github-actions/auth/git/ref/tags/v2 --jq [.object.sha, .object.type] | @tsv --show-toplevel 64/pkg/tool/linux_amd64/vet x_amd64/vet test.txt epo}/actions/runrev-parse cfg x_amd64/vet -1 ithub-script/git/ref/tags/v9 infocmp bject.type] | @tsv ithub-script/gitgit git .cfg gh (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, .object.type] | @tsv sRemoteWithRealGitmaster_branch388172625/001 sRemoteWithRealGitmaster_branch388172625/002/work 64/pkg/tool/linux_amd64/compile rror .cfg 64/pkg/tool/linu--show-toplevel 64/pkg/tool/linux_amd64/compile k/gh�� artifacts-summary.md on 64/pkg/tool/linux_amd64/link it} eutil modules/@npmcli/xterm-color 64/pkg/tool/linux_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq [.object.sha, .object.type] | @tsv --show-toplevel gh tartedAt,updatedAt,event,headBranch,headSha,displayTitle /repos/actions/ginfocmp --jq ch gh api /repos/actions/github-script/git/ref/tags/v9 --jq /usr/bin/infocmp ithub-script/git/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet gh bject.type] | @t-bool infocmp (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 (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel /usr/bin/git (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 bin/bash -errorsas -ifaceassert -nilfunc /bin/sh -c js/**/*.json' ---s -tests 1/x64/bin/sh (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo -importcfg /tmp/go-build938615555/b438/importcfg -pack /home/REDACTED/work/gh-aw/gh-aw/pkg/semverutil/semverutil.go /home/REDACTED/work/gh-aw/gh-aw/pkg/semverutil/semverutil_test.go -ato�� js/**/*.json' ---p -buildtags ache/go/1.25.8/x-lang=go1.25 -errorsas -ifaceassert -nilfunc tail (http block)
    • Triggering command: /usr/bin/gh gh workflow list --repo owner/repo --json name,path,state cfg .prettierignore --log-level=errorev-parse 64/pkg/tool/linu--show-toplevel node /hom�� (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 ./../pkg/workflow/js/**/*.json' --ignore-path -buildtags ner_pin_test.go o -ifaceassert -nilfunc tion_test.go _tes�� js/**/*.json' ---errorsas (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name run --auto /usr/bin/gh --detach x_amd64/vet (http block)
  • https://api.github.com/repos/test/repo
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch /ref/tags/v9.0.0 elp_text_test.go sv n_test.go ctions-build/mairev-parse enerate-action-m--show-toplevel ctionpins.go rtcf�� 4241-15029/test-3830350708/.github/workflows tmain.go ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet ignore-path .././usr/lib/git-core/git .cfg 64/pkg/tool/linuREDACTED ache/go/1.25.8/xREDACTED (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch --show-toplevel git /usr/bin/git --show-toplevel /usr/bin/git /usr/bin/git git rev-�� ithub-script/git/ref/tags/v9 git bject.type] | @tsv ithub-script/git/usr/lib/git-core/git git (http block)

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

Copilot AI and others added 2 commits May 6, 2026 23:46
…ccess

The validateSafeOutputsMax function used reflect.FieldByName to iterate
over all 42 safe output fields, consuming ~74% of BenchmarkValidation time
even when SafeOutputsConfig was empty (as in most workflows).

Replace the reflection-based loop with direct struct field access, following
the same pattern as hasAnySafeOutputEnabled. This eliminates all reflection
overhead in the hot path.

Add TestValidateSafeOutputsMaxFieldCoverage to guard against future regressions
when new safe output types are added to safeOutputFieldMapping.

Benchmark improvement: ~7345 ns/op → ~1709 ns/op (4.3x faster)"

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/db0d1d4b-4ed1-4031-8dd0-25714e9f704a

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Use require.Truef, require.Equalf, require.Errorf, and assert.Containsf
so that field/tool names are properly formatted in failure messages.

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/db0d1d4b-4ed1-4031-8dd0-25714e9f704a

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix performance regression in validation by optimizing logic perf: eliminate reflection in validateSafeOutputsMax (4.3x faster) May 6, 2026
Copilot AI requested a review from gh-aw-bot May 6, 2026 23:49
@pelikhan pelikhan marked this pull request as ready for review May 7, 2026 01:27
Copilot AI review requested due to automatic review settings May 7, 2026 01:27
Copy link
Copy Markdown
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

This PR removes reflection from validateSafeOutputsMax to significantly reduce validation overhead on the compilation hot path, while adding a regression test to ensure future safe-output fields don’t get omitted from max validation.

Changes:

  • Replaced the per-call reflection loop with direct SafeOutputsConfig field checks plus a small checkMaxField helper.
  • Preserved deterministic error reporting order by checking fields in sorted struct-field-name order, and kept deterministic ordering for dispatch_repository tools via sorting.
  • Added a reflection-based unit test that enforces coverage of all safeOutputFieldMapping fields (excluding DispatchRepository, which is validated separately).
Show a summary per file
File Description
pkg/workflow/safe_outputs_max_validation.go Removes reflection-based iteration and validates max fields via direct struct-field access for better performance.
pkg/workflow/safe_outputs_max_validation_test.go Adds a coverage test to ensure every mapped safe-output field is validated for invalid max values.

Copilot's findings

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@pelikhan pelikhan merged commit cd077dc into main May 7, 2026
4 checks passed
@pelikhan pelikhan deleted the copilot/fix-validation-performance-regression-again branch May 7, 2026 01:40
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.

[performance] Regression in Validation: 36.7% slower

4 participants