Skip to content

perf: fix BenchmarkValidation regression (+275.9%) by caching repeated expensive operations#28406

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-validation-performance-regression
Apr 25, 2026
Merged

perf: fix BenchmarkValidation regression (+275.9%) by caching repeated expensive operations#28406
pelikhan merged 2 commits intomainfrom
copilot/fix-validation-performance-regression

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 25, 2026

validateWorkflowData was re-executing three expensive operations on every invocation, causing a 275.9% slowdown (227μs vs 60μs historical). Profiling showed:

  • 29.9% CPU: NewPermissionsParser(workflowData.Permissions).ToPermissions() — full YAML unmarshal on every call
  • 17.9% CPU: extractConcurrencyGroupFromYAML — backtracking regex on every call
  • 13.6% CPU: yaml.Unmarshal(workflowData.On) in validateWorkflowRunBranches — even when no workflow_run trigger present

Changes

  • WorkflowData — two new cache fields: CachedPermissions *Permissions and ConcurrencyGroupExpr string

  • applyDefaultsdefer populates both caches after all permission/concurrency mutations are applied (this is the final stage that mutates these fields, so the cached values are always correct):

    defer func() {
        data.CachedPermissions = NewPermissionsParser(data.Permissions).ToPermissions()
        data.ConcurrencyGroupExpr = extractConcurrencyGroupFromYAML(data.Concurrency)
    }()
  • validatePermissions — uses CachedPermissions with nil-check fallback for code paths that bypass applyDefaults (e.g. direct test construction)

  • validateToolConfiguration — uses ConcurrencyGroupExpr instead of calling the regex extractor each time

  • validateWorkflowRunBranchesstrings.Contains fast-path before yaml.Unmarshal, covering the empty case too:

    if !strings.Contains(workflowData.On, "workflow_run") {
        return nil
    }

Result

BenchmarkValidation: 35,423 → 6,722 ns/op (−81%), allocations 337 → 40/op. On CI (≈6× slower hardware) this projects to ~40,000 ns/op, below the 60,542 ns/op 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 x_amd64/link GOINSECURE setup/js/node_modules/flatted/goconfig GOMODCACHE x_amd64/link ortc�� 2455-35799/test-source-field-variant-2463688306/.github/workflows om/goccy/go-yaml@v1.19.2/lexer/lexer.go ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 7029504/b087/ GOMODCACHE N_/MhA652aEkSuR8NKQxPfr/feDwSjXStImIOC-NY5wN (http block)
    • Triggering command: /usr/bin/gh gh repo view owner/repo 6615�� ortcfg b-AbBFuh- ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile env ortcfg GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE fips140deps/godeconfig GOMODCACHE ache/go/1.25.8/x^remote\..*\.gh-resolved$ (http block)
    • Triggering command: /usr/bin/gh gh repo view owner/repo env g_.a S-MkVro-o ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE ole GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile env efaultBranchFromLsRemoteWithRealGitmain_branch214473813/001' efaultBranchFromLsRemoteWithRealGitmain_branch214473813/001' ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ortcfg (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 -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 /orgs/test-owner/actions/secrets --jq .secrets[].name -json GO111MODULE de GOINSECURE GOMOD GOMODCACHE go /pre�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 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, .object.type] | @tsv view 12345 /usr/bin/git nonexistent/repogit --json status,conclusio--show-toplevel git rev-�� --show-toplevel ache/go/1.25.8/x64/pkg/tool/linuTest User /usr/bin/git g_.a GO111MODULE ache/go/1.25.8/xinstall git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq [.object.sha, .object.type] | @tsv waysRecompiles2905832473/001 epo}/actions/runs/1/artifacts /usr/bin/git e GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE ache/go/1.25.8/xinstall 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 xterm-color 1586992/b466/_testmain.go /usr/bin/unpigz -json GO111MODULE x_amd64/compile /usr/bin/unpigz -d -c x_amd64/compile /usr/bin/git -json GO111MODULE x_amd64/compile git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq [.object.sha, .object.type] | @tsv /tmp/compile-all-instructions-test-1098762473/.github/workflows config (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 7029504/b202/_pkg_.a eFae/0ahu769BnKYz-hV-eFae outil.test GOINSECURE GOMOD GOMODCACHE outil.test 6615�� 7029504/b042/importcfg 79XR/6YQuLpx94_gDFryr79XR /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu-importcfg (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv --show-toplevel ache/go/1.25.8/x--jq /usr/bin/git sRemoteWithRealGtr sRemoteWithRealG\n ache/go/1.25.8/x: git rev-�� --show-toplevel ache/go/1.25.8/xsh /usr/bin/git ExpressionCompilgit 3NxN/fOrMapTM_Strev-parse ceutil.test 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 ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile /usr/bin/infocmp ithub/workflows/git /home/REDACTED/go/rev-parse 1586992/b459=> infocmp -1 xterm-color git /usr/bin/git BHBh/Mm0ui0x2Iv4git go /usr/bin/infocmp--show-toplevel git (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 /tmp/TestGuardPolicyTrustedUsersExpressionCompiledOutput1652038497/001 remote /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -json GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -ato�� -bool -buildtags ache/node/24.14.1/x64/bin/node -errorsas -ifaceassert -nilfunc /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 ets.TOKEN }} my-default /usr/bin/git -json GO111MODULE 64/bin/go git -C /tmp/TestGuardPolicyBlockedUsersnonexistent/repo config om/owner/repo.git remote.origin.urgit GO111MODULE 64/bin/go 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, .object.type] | @tsv --show-toplevel verutil.test /usr/bin/git t0 EuIi/QLX65JRSUvp/tmp/gh-aw-test-runs/20260425-062514-38477/test-patch-priority-29700�� (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 go /usr/bin/git 2859-60910/test-bash GO111MODULE ache/go/1.25.8/x64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git -json GO111MODULE e/git git (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 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv get .cfg 64/pkg/tool/linux_amd64/vet credential.helpegit (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv -goversion go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build3587029504/b257/importcfg -pack env -json GO111MODULE 64/bin/go 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, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv GOMODCACHE _x/hwAYtf38lH4QlCkKBmUk/M1MenA5m4Si70HeSRX27 /usr/bin/git g_.a GO111MODULE 64/pkg/tool/linu--show-toplevel /usr/bin/git remo�� -v 64/pkg/tool/linurev-parse /usr/bin/gh 1653201272/.githgit 8kq6Gg-gh 64/pkg/tool/linu--show-toplevel gh (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 x_amd64/link /usr/bin/git ub/workflows GO111MODULE 64/bin/go git rev-�� --show-toplevel JX/24c6N3nCfPzRvconfig /usr/bin/git -json GO111MODULE 23dba6cac2b4e534--show-toplevel 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, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv /tmp/TestGuardPolicyTrustedUsersRequiresMinIntegrity505715062/001 config /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile remote.origin.urgit GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile -o /tmp/go-build1661586992/b446/_pkg_.a -trimpath /usr/bin/git -p github.com/githurev-parse -lang=go1.25 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 64/pkg/tool/linu-test.v=true /usr/bin/git g_.a GO111MODULE 64/pkg/tool/linu--show-toplevel /usr/bin/git remo�� -v 64/pkg/tool/linu/tmp/go-build1661586992/b447/_testmain.go /usr/bin/gh g_.a h00yucQ7c -d gh (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 ons-test1098077745 /tmp/go-build1661586992/b413/_testmain.go 9effc1cf86c104818dbca22211fa4aeda50a29013eba7c84-d -json GO111MODULE 64/bin/go git conf�� --get remote.origin.url 64/pkg/tool/linux_amd64/vet -json GO111MODULE x_amd64/compile 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel -tests /usr/bin/git -json GO111MODULE /sh git -C /tmp/gh-aw-test-runs/20260425-062859-60910/test-3795172878/.github/workflows (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, .object.type] | @tsv user.email ings.cjs odules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/git cjs st/suppress-warn-o 64/bin/node forks.js rev-�� HEAD st/suppress-warnmain _modules/.bin/gi-lang=go1.25 --bare full mode test k/gh-aw/gh-aw/ac--require st/dist/workers//home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv . tions/setup/js/node_modules/vite--stdout $name) { hasDiscussionsEnabled } } /tmp/bare-incremgit gin/full-mode-brcommit tions/setup/node-m git init�� -q (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv . tions/setup/js/node_modules/vite--stdout bin/git /tmp/bare-increm/opt/hostedtoolcache/node/24.14.1/x64/bin/node . ode-gyp-bin/git fRvBdJv/_eY_QlAF/home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs init�� -q st/suppress-warn--conditions k/node_modules/.development -m ode_modules/viteapi n-dir/git st/dist/workers/-f (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch user.email tions/setup/js/node_modules/viteowner=github 64/pkg/tool/linux_amd64/link modules/@npmcli/git git bin/git 64/pkg/tool/linuconfig bran�� -M t-patch-utils-hKCyRE/.diffsize.tmp repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } --is-ancestor k/gh-aw/gh-aw/ac-C es/.bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch ithub/workflows k/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /opt/hostedtoolcache/node/24.14.1/x64/bin/node r/work/gh-aw/gh-git /home/REDACTED/wor-C run-script/lib/n/home/REDACTED/work/gh-aw/gh-aw k/gh-aw/gh-aw/acshow 4792�� ithub/workflows test-Kia1YP/error.go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/link node --conditions ed } } /opt/hostedtoolcconfig (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 --get remote.origin.url /usr/bin/gh y-test.md GO111MODULE 64/pkg/tool/linu--show-toplevel gh api --paginate repos/{owner}/{repo}/actions/runs/12345/artifacts /usr/bin/infocmp .artifacts[].namgit Fs27lbYse aw.test infocmp (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 git /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git LsRemoteWithRealgit LsRemoteWithRealrev-parse nch,headSha,disp--show-toplevel 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 --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� ub/gh-aw.git go ng.md -json GO111MODULE x_amd64/compile git (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 git-upload-pack '/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitmain_branch4025713147/001' git-upload-pack '/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitmain_branch4025713147/001' /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/gh yphen3865193975/infocmp yphen3865193975/-1 64/bin/go gh (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 /tmp/TestGuardPolicyMinIntegrityOnlymin-integrity_with_explicit_repo3554666130/0remote.origin.urgit config /usr/bin/git remote.origin.urgit GO111MODULE 64/bin/go git rev-�� --show-toplevel go ache/node/24.14.1/x64/bin/node -json GO111MODULE layTitle 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 --pack_header=2,3 (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 yVIFwLdjv 64/pkg/tool/linux_amd64/vet GOINSECURE a20poly1305 GOMODCACHE 64/pkg/tool/linux_amd64/vet env 412181670/.github/workflows R30X4Bcts ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 3GMM57Ps3 64/pkg/tool/linux_amd64/vet GOINSECURE pproxy GOMODCACHE 64/pkg/tool/linux_amd64/vet env 146113776 O_2Lfc9jA ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE s GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linurev-parse (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/1/artifacts --jq .artifacts[].name GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE erignore env -json GO111MODULE /opt/hostedtoolcache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE o fix."; \ exit 1; \ fi (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 Fs27lbYse aw.test GOINSECURE GOMOD GOMODCACHE aw.test 6615�� ortcfg CLJOlIPxV ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/xremote.origin.url (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 V3gqgd2UJ 64/pkg/tool/linux_amd64/compile GOINSECURE a20 GOMODCACHE 64/pkg/tool/linux_amd64/compile env g_.a GFI5vTWRl k GOINSECURE til (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12345/artifacts --jq .artifacts[].name GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go k/gh�� 2859-60910/test-719121055/.github/workflows GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD erignore ache/go/1.25.8/x64/pkg/tool/linu--jq (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 Hi02xO8a- 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuTest User (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 ne_constants.go x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env g_.a S-MkVro-o ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE ole GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12346/artifacts --jq .artifacts[].name GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go k/gh�� 2859-60910/test-719121055/.github/workflows GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD erignore ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (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 QyquJZDcH 64/pkg/tool/linux_amd64/compile GOINSECURE /norm GOMODCACHE ylQP4Z8/vCNYLdc7D8RXanEmFBss env 412181670/.github/workflows aTWjRYknE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 ortcfg 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link ortc�� util.test kTMme1tRE ortcfg.link GOINSECURE iment GOMODCACHE QBat1TqtOugs5kA4FK/4S-KjLZhAbqjPremote (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/2/artifacts --jq .artifacts[].name GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE erignore env ExpressionCompiledOutput2722643608/001 GO111MODULE /opt/hostedtoolcache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 GO111MODULE 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD abis 64/pkg/tool/linux_amd64/compile env g_.a 5Hh4AuvTv ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu-importcfg (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 sNGC5r73k 64/pkg/tool/linu-nilfunc GOINSECURE pguts GOMODCACHE 64/pkg/tool/linu-tests env 39/001/test-simple-frontmatter.m-p N5EVshPW9 ache/go/1.25.8/x64/pkg/tool/linu-lang=go1.25 GOINSECURE 7029504/b007/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu-goversion (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE erignore env ExpressionCompiledOutput2722643608/001 GO111MODULE /opt/hostedtoolcache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 GO111MODULE 64/pkg/tool/linu-nolocalimports GOINSECURE GOMOD abis 64/pkg/tool/linu/tmp/go-build1661586992/b466/_testmain.go env 811608/b001/exe/a.out Ffa_H-Eee ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 2LozJ61OcTuKs/Farev-parse GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 34i--fWCy 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuTest User env plorer.md GO111MODULE ortcfg.link GOINSECURE 7029504/b013/ GOMODCACHE 1tjYVSqOEP82kiP9ch/8p_7IHIf_31YRshow (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/4/artifacts --jq .artifacts[].name efaultBranchFromLsRemoteWithRealGitbranch_with_hyphen3865193975/001' 1/x64/bin/node GOINSECURE GOMOD GOMODCACHE erignore t-ha�� ithub/workflows/agent-persona-explorer.md GO111MODULE eTags}} GOINSECURE GOMOD GOMODCACHE go (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 06SIChxms 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link env 412181670 Y9sJvruy0 ortcfg.link GOINSECURE GOMOD GOMODCACHE 3RI-OUvcyJlIpS7G73/L1Wa7eeJiw1ne-trimpath (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 k1Ubnk-ff 64/pkg/tool/linux_amd64/compile GOINSECURE til GOMODCACHE 64/pkg/tool/linux_amd64/compile env g_.a GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuconfig (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE erignore env ExpressionCompiledOutput2722643608/001 GO111MODULE }} {{context.Compiler}} GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path -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 run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 GOMOD GOMODCACHE x_amd64/asm env 211664819/.github/workflows GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (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 _js_wasm.o 64/src/runtime/r--git-dir 64/pkg/tool/linux_amd64/vet env -json Q8gElMZ6A x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build1661586992/b404/cli.test /tmp/go-build1661586992/b404/cli.test -test.testlogfile=/tmp/go-build1661586992/b404/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true -nolocalimports -importcfg /tmp/go-build3587029504/b226/importcfg -pack env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /tmp/go-build3696606198/b404/cli.test /tmp/go-build3696606198/b404/cli.test -test.testlogfile=/tmp/go-build3696606198/b404/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 ache/go/1.25.8/x64/pkg/tool/linuremote.origin.url /usr/bin/git Onlymin-integritgit qrnP/bIu9B-2Kyy2rev-parse 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linucurrent (local changes) /usr/bin/git ts.test zLU2/r48K25Cv2sX-lh 1/x64/bin/node git (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 2859-60910/test-4131489477 go /usr/bin/git DefaultBranchFrogit DefaultBranchFrorev-parse 1/x64/bin/node git rev-�� --show-toplevel go /usr/bin/git ithub/workflows/ls GO111MODULE ache/go/1.25.8/x/tmp/gh-aw/aw-feature-branch.patch 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 7029504/b027/_pkg_.a ortcfg ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linutest@example.com env ons/secrets Kvb3/T8LknBZDeixV0s1bKvb3 ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE /go-yaml/scannerrev-parse GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuremote.origin.url (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 tion-kit.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ub/workflows GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (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 -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env lGitmain_branch4025713147/001' lGitmain_branch4025713147/001' 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (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 d d x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env Gitmaster_branch1907706639/001' Gitmaster_branch1907706639/001' x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (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 -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json gset/set.go x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (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 (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 -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/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 XAe_-DMg6 om/goccy/go-yaml@v1.19.2/printer/color.go ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE /maps GOMODCACHE ortcfg env (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 PjsNEKRNUYRmlDRr/tmp/js-hash-test-4200424871/test-hash.js GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuTest User env g_.a GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 7029504/b036/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env ithub-script/git/ref/tags/v9 GO111MODULE 1/x64/bin/node GOINSECURE GOMOD GOMODCACHE 1/x64/bin/node (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 GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --repo owner/repo --json name,path,state ache/go/1.25.8/x64/pkg/tool/linu-buildmode=exe GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/xremote.origin.url env ron.daily; } GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/xrepos/{owner}/{repo}/actions/runs/12345/artifacts (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE go /pre�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 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 -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/test-owner/test-repo/actions/secrets --jq .secrets[].name -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env orts,XTestImpor GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/test/repo
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch g_.a GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuconfig ortc�� P82kiP9ch g/gitutil/gitutil.go ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD 7029504/b007/symdownload ache/go/1.25.8/x2 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch --pack_header=2,3 l /usr/bin/git -json GO111MODULE 64/bin/go git -C /tmp/TestGuardPolicyMinIntegrityOnlymin-integrity_only_defaults_repo2602856876/0remote.origin.urgit (http block)
  • invalid.example.invalid
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin https://invalid.example.invalid/nonexistent-repo.git git conf�� '/tmp/bare-incremental-3ge6Ih' '/tmp/bare-incremental-3ge6Ih' cal/bin/git user.email test@example.com--git-dir=/tmp/bare-incremental-RmbMCp ode-gyp-bin/git git comm�� -m Initial commit k/gh-aw/gh-aw/node_modules/.bin/git --bare --initial-branchadd in/git git (dns block)

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

…ve BenchmarkValidation regression

- Add CachedPermissions *Permissions and ConcurrencyGroupExpr string to WorkflowData
- Populate both caches in applyDefaults via defer (safe because applyDefaults is the
  final stage that mutates Permissions and Concurrency)
- Use CachedPermissions in validatePermissions instead of re-parsing YAML every call
- Use ConcurrencyGroupExpr in validateToolConfiguration instead of regex extraction
- Add strings.Contains fast-path in validateWorkflowRunBranches to skip yaml.Unmarshal
  when the On field cannot contain a workflow_run trigger

BenchmarkValidation: 35,423 ns/op (337 allocs) → 6,722 ns/op (40 allocs): -81%
On CI (6x slower machine): ~227,548 ns/op → ~40,000 ns/op (below 60,542 ns/op historical)

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e12d8c4d-acfe-471b-8d70-c3a062083c37

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 perf: fix BenchmarkValidation regression (+275.9%) by caching repeated expensive operations Apr 25, 2026
Copilot AI requested a review from gh-aw-bot April 25, 2026 06:36
@pelikhan pelikhan marked this pull request as ready for review April 25, 2026 10:16
Copilot AI review requested due to automatic review settings April 25, 2026 10:16
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

Improves validateWorkflowData performance by caching repeatedly computed permissions and concurrency-group values on WorkflowData, and avoiding unnecessary YAML unmarshalling for workflow_run validation.

Changes:

  • Cache parsed permissions (CachedPermissions) and extracted concurrency group expression (ConcurrencyGroupExpr) during applyDefaults.
  • Update permission and concurrency validators to reuse cached values instead of re-parsing/extracting each call.
  • Add a strings.Contains fast-path to skip YAML unmarshalling when workflow_run can’t be present.
Show a summary per file
File Description
pkg/workflow/tools.go Populate permission + concurrency caches via defer at the end of defaults application.
pkg/workflow/compiler_validators.go Reuse cached permissions and cached concurrency-group expression during validation.
pkg/workflow/compiler_types.go Add cache fields to WorkflowData (CachedPermissions, ConcurrencyGroupExpr).
pkg/workflow/agent_validation.go Skip YAML unmarshal in validateWorkflowRunBranches unless workflow_run is present.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (1)

pkg/workflow/compiler_validators.go:265

  • validateToolConfiguration now relies solely on workflowData.ConcurrencyGroupExpr. If applyDefaults wasn’t run (e.g., tests calling validateToolConfiguration directly, or other programmatic construction paths), ConcurrencyGroupExpr will be empty and the concurrency group expression validation will be skipped even when workflowData.Concurrency is set. Consider adding a fallback to extractConcurrencyGroupFromYAML(workflowData.Concurrency) (and optionally populate the cache) when ConcurrencyGroupExpr is empty but Concurrency is non-empty, similar to the CachedPermissions fallback in validatePermissions.
	if workflowData.Concurrency != "" {
		// Use the cached concurrency group expression extracted during applyDefaults to avoid
		// repeated regex-based extraction on every validateWorkflowData call.
		groupExpr := workflowData.ConcurrencyGroupExpr
		if groupExpr != "" {
			if err := validateConcurrencyGroupExpression(groupExpr); err != nil {
				return formatCompilerError(markdownPath, "error", "workflow-level concurrency validation failed: "+err.Error(), err)
			}
		}
	}
  • Files reviewed: 4/4 changed files
  • Comments generated: 0

@pelikhan pelikhan merged commit 70e10f6 into main Apr 25, 2026
119 checks passed
@pelikhan pelikhan deleted the copilot/fix-validation-performance-regression branch April 25, 2026 10:55
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: +275.9% slower

4 participants