Skip to content

fix(errors): replace fmt.Errorf("%s") with errors.New and preserve error chains in pkg/workflow + pkg/parser#29197

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-error-wrapping-issues
Apr 29, 2026
Merged

fix(errors): replace fmt.Errorf("%s") with errors.New and preserve error chains in pkg/workflow + pkg/parser#29197
pelikhan merged 3 commits intomainfrom
copilot/fix-error-wrapping-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

~37% of fmt.Errorf calls in pkg/workflow and pkg/parser discarded the original error, breaking errors.Is/errors.As chains. This addresses the highest-impact cases.

Changes

fmt.Errorf("%s", msg)errors.New(msg) (8 workflow files)

Where a string was pre-built via fmt.Sprintf/strings.Builder and then passed to fmt.Errorf with %s, replaced with the idiomatic errors.New:

// Before
errMsg := fmt.Sprintf("invalid engine: %s. Valid engines are: %s...", id, enginesStr)
return nil, fmt.Errorf("%s", errMsg)

// After
return nil, errors.New(errMsg)

Affected: engine_validation, engine_definition, runtime_validation, template_injection_utils, permissions_validation, dangerous_permissions_validation, safe_update_enforcement, tools_validation_github_toolsets

Preserve error chain via FormattedParserError (2 parser files)

Cases where the original error was converted to a formatted string and then dropped from the chain, using the codebase's established FormattedParserError pattern to carry both the human-readable message and the unwrappable cause:

  • frontmatter_content.go: YAML parse error was formatted via FormatYAMLError but original err was lost
  • import_error.go (FormatImportCycleError): *ImportCycleError was not preserved as cause
// Before — err lost, errors.As(result, &yamlErr) always fails
formattedErr := FormatYAMLError(err, 2, frontmatterYAML)
return nil, fmt.Errorf("failed to parse frontmatter:\n%s", formattedErr)

// After — formatted message retained, err accessible via Unwrap
return nil, &FormattedParserError{formatted: "failed to parse frontmatter:\n" + formattedErr, cause: err}

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://github.com/__api/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 GO111MODULE ache/go/1.25.8/x--show-toplevel git rev-�� --show-toplevel ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git se 6250290/b067/vetrev-parse ache/go/1.25.8/x--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name ache/go/1.25.8/x64/pkg/tool/linu-lang=go1.25 GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu-dwarf=false ortc�� -json om/goccy/go-yaml@v1.19.2/printer-c=4 ache/go/1.25.8/x64/pkg/tool/linu-nolocalimports GOINSECURE 2845169/b047/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu/tmp/go-build2793759714/b466/_testmain.go (http block)
    • Triggering command: /usr/bin/gh gh repo view owner/repo ns-l�� 01/test2.md DFryr79XR x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env ortcfg GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu^remote\..*\.gh-resolved$ (http block)
  • https://github.com/__api/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)
  • https://github.com/__api/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 x_amd64/vet /usr/bin/git -json GO111MODULE x_amd64/vet git rev-�� --show-toplevel x_amd64/vet ache/node/24.14.1/x64/bin/node -json GO111MODULE 64/pkg/tool/linuinstall ache/node/24.14.--package-lock-only (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq [.object.sha, .object.type] | @tsv user.email test@example.com /usr/bin/git y_with_repos=pubgit BytXhgNOP 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linuTest User /usr/bin/git g_.a GO111MODULE .cfg git (http block)
  • https://github.com/__api/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 vaScript225194/001/test-frontmatter-with-nested-objects.md -buildtags /opt/hostedtoolcache/go/1.25.8/x64/bin/git -errorsas -ifaceassert -nilfunc git chec�� copilot/fix-error-wrapping-issues e_update_enforcement.go cal/bin/bash -json GO111MODULE 64/bin/go bash (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq [.object.sha, .object.type] | @tsv 5317-61853/test-3903007328 /home/REDACTED/work/gh-aw/gh-aw/pkg/stringutil/identifiers.go /usr/bin/git -json GO111MODULE x_amd64/compile git remo�� GOMODCACHE x_amd64/compile /usr/bin/git -json 1.5.0/internal/jrev-parse x_amd64/compile git (http block)
  • https://github.com/__api/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 -json 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)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git -json .cfg 64/pkg/tool/linu: git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/gh -json GO111MODULE 64/pkg/tool/linu--show-toplevel gh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git r-wrapping-issuegit /tmp/go-build123rev-parse ache/node/24.14.--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git -bool -buildtags k/_temp/uv-pytho--show-toplevel git (http block)
  • https://github.com/__api/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 -json GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv se 6250290/b072/vet.cfg ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet --no�� --noprofile GOPROXY /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv --noprofile sh ndor/bin/bash npx prettier --cgit GOPROXY 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -uns�� -unreachable=false /tmp/go-build1236250290/b154/vet.cfg ache/go/1.25.8/x64/bin/bash --check scripts/**/*.js 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
  • https://github.com/__api/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 64/pkg/tool/linu-goversion /usr/bin/git -json .cfg /opt/hostedtoolc--oneline git rev-�� --show-toplevel go ache/node/24.14.1/x64/bin/node -json GO111MODULE ache/go/1.25.8/x--show-toplevel ache/node/24.14.1/x64/bin/node (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/linutest@example.com /usr/bin/infocmp y7jX/Ah6NlSoTexsgit -trimpath /opt/hostedtoolc--oneline infocmp -1 xterm-color /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
  • https://github.com/__api/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 ithub/workflows/audit-workflows.md go 1/x64/bin/node t.md GO111MODULE x_amd64/vet 1/x64/bin/node --no�� --noprofile x_amd64/vet /usr/bin/git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv --tags --always /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/link -json GO111MODULE x_amd64/vet /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/link -o /tmp/go-build136910175/b371/parser.test -importcfg /usr/bin/git -s -w -buildmode=exe git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv --porcelain go /tmp/go-build136910175/b001/workflow.test -json GO111MODULE x_amd64/vet /tmp/go-build136910175/b001/workflow.test -tes�� -test.paniconexit0 -test.timeout=10m0s /usr/bin/git -json GO111MODULE x_amd64/vet git (http block)
  • https://github.com/__api/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 actions/setup-cli/install.sh go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/link e-expressions-ingit GO111MODULE x_amd64/vet /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/link -o /tmp/go-build136910175/b001/workflow.test -importcfg ache/node/24.14.1/x64/bin/node -s -w -buildmode=exe 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 Dk/Exs2fuW_hbdM5test@example.com /usr/bin/infocmp g_.a QWGZF_tJr 64/pkg/tool/linu--show-toplevel infocmp -1 xterm-color 64/pkg/tool/linurev-parse /usr/bin/git 903896069/.githugit bbyq8rTOi 64/pkg/tool/linu--show-toplevel git (http block)
  • https://github.com/__api/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 -unreachable=false /tmp/go-build1236250290/b094/vet.cfg ache/go/1.25.8/x64/bin/bash log.showsignaturgit log 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -ato�� -bool -buildtags ache/uv/0.11.8/x86_64/bash -errorsas -ifaceassert -nilfunc bash (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv 910175/b370/embedcfg go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -json GO111MODULE x_amd64/vet /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -ato�� -bool -buildtags /opt/hostedtoolcache/node/24.14.1/x64/bin/node -errorsas -ifaceassert -nilfunc node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv /tmp/gh-aw-test-runs/20260429-215317-61853/test-2184867523/.github/workflows rev-parse /usr/bin/git -json GO111MODULE 64/bin/go git remo�� GOMODCACHE go /usr/bin/git -json GO111MODULE x_amd64/compile git (http block)
  • https://github.com/__api/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 -json GO111MODULE n-dir/git GOINSECURE GOMOD GOMODCACHE ache/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 -json GO111MODULE 86_64/bash GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet --no�� --noprofile GOPROXY 6250290/b124/vet.cfg GOSUMDB GOWORK 64/bin/go /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 or.md sh nfig/composer/vendor/bin/bash npx prettier --cgit GOPROXY CgoFiles,CXXFile--show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linuc -uns�� -unreachable=false /tmp/go-build1236250290/b104/vet.cfg 1/x64/bin/node --check scripts/**/*.js 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
  • https://github.com/__api/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 celain --ignore-submodules | head -n 10 /tmp/go-build1236250290/b187/vet.cfg 6250290/b327/vet.cfg k/gh-aw/gh-aw/pkgit k/gh-aw/gh-aw/pkrev-parse 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu-tests -uns�� -unreachable=false /tmp/go-build1236250290/b166/vet.cfg nfig/composer/vendor/bin/bash /tmp/go-build131git -trimpath 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/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 r-test2608668316/test1.md r-test2608668316/test2.lock.yml ache/node/24.14.1/x64/bin/node remote.origin.urgit GO111MODULE 64/bin/go ache/node/24.14.1/x64/bin/node s-35�� ub/gh-aw.git -buildtags ng.md -errorsas -ifaceassert layTitle git (http block)
  • https://github.com/__api/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 . st/dist/workers/forks.js $name) { hasDiscussionsEnabled } } 3583b0789f78542f/opt/hostedtoolcache/node/24.14.1/x64/bin/node origin modules/@npmcli/--require git diff�� --binary 279a91d1da3afd38--conditions ache/go/1.25.8/xdevelopment 0b7c587c..HEAD ode_modules/vite-C /home/REDACTED/go//home/REDACTED/work/gh-aw/gh-aw/.github/workflows git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv . st/dist/workers/forks.js bin/git 3583b0789f78542fgit git-receive-packconfig k/gh-aw/gh-aw/nouser.email git diff�� --binary (http block)
  • https://github.com/__api/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch -output.go git r: $owner, name: $name) { hasDiscussionsEnabled } } -e be1a899860d7ad0c-C k/gh-aw/node_mod/home/REDACTED/work/gh-aw/gh-aw 1/x64/bin/node ve . tions/setup/js/node_modules/vitest/suppress-warnings.cjs r: $owner, name: $name) { hasDiscussionsEnabled } } -exist mp 94a394799f8382e7/home/REDACTED/work/gh-aw/gh-aw tions/setup/js/nshow (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch k/gh-aw/gh-aw main ed.lock.yml --quiet git ed } } go run k/gh-aw/gh-aw/.github/workflows git me: String!) { repository(owne-f l ings.cjs ed } } /opt/hostedtoolcshow (http block)
  • https://github.com/__api/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 --noprofile go 1/x64/bin/node -json GO111MODULE x_amd64/vet 1/x64/bin/node --no�� --noprofile x_amd64/vet /usr/bin/git -json GO111MODULE x_amd64/vet 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 64/pkg/tool/linux_amd64/compile /usr/bin/gh g_.a rotocol/go-sdk@vrev-parse x_amd64/compile gh run download 1 /usr/bin/git test-logs/run-1 l_test.go ache/go/1.25.8/x--show-toplevel git (http block)
  • https://github.com/__api/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 -unreachable=false /tmp/go-build1236250290/b136/vet.cfg r-wrapping-issues "prettier" --chegit bash 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu-tests -uns�� -unreachable=false /tmp/go-build1236250290/b207/vet.cfg 1/x64/bin/node -json GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (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 /tmp/gh-aw-test-runs/20260429-215317-61853/test-903896069/.github/workflows remote /usr/bin/git ith-tools.md GO111MODULE 64/bin/go git conf�� user.email test@example.com /usr/bin/gh -json GO111MODULE x_amd64/compile gh (http block)
  • https://github.com/__api/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 -unreachable=false /tmp/go-build1236250290/b156/vet.cfg r-wrapping-issues "prettier" --chegit find 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu-tests -uns�� -unreachable=false /tmp/go-build1236250290/b203/vet.cfg p/bin/bash -json GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (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 /tmp/gh-aw-test-runs/20260429-215317-61853/test-903896069/.githu.github/workflows/test.md rev-parse /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE x_amd64/compile git (http block)
  • https://github.com/__api/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-22 GOMOD GOMODCACHE 64/pkg/tool/linu-extld=gcc env hub/workflows GO111MODULE 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuTest User (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-03-30 GOMOD GOMODCACHE 64/pkg/tool/linutest@example.com env g_.a GO111MODULE tartedAt,updatedAt,event,headBranch,headSha,displayTitle GOINSECURE bug GOMODCACHE 64/pkg/tool/linufeature-branch (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-01-29 GOMOD GOMODCACHE YU/UimiJ_lt2omPMremote.origin.url estl�� e-analyzer.md GO111MODULE 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/compile (http block)
  • https://github.com/__api/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 ne_constants.go 64/pkg/tool/linux_amd64/compile GOINSECURE a20 GOMODCACHE 64/pkg/tool/linu--json env edOutput42082771--limit GFI5vTWRl ache/go/1.25.8/x--created GOINSECURE til GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linutest@example.com (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 l_test.go ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE go-sdk/internal/config GOMODCACHE ache/go/1.25.8/xtest@example.com env 7DvO3RCYu GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile wc -c < gh-aw.wagit GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
  • https://github.com/__api/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 DW6KATJ4J 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env mpiledOutput1138482566/001 FSSLThW2J x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 Zf4ikgLhb 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE N_/MhA652aEkSuR8NKQxPfr/feDwSjXS-trimpath (http block)
  • https://github.com/__api/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 GO111MODULE 64/pkg/tool/linux_amd64/compile GOINSECURE go-sdk/internal/rev-parse abis 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/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 dAR9m3zY_ aw.test GOINSECURE GOMOD GOMODCACHE aw.test 7937�� mpiledOutput810242894/001 CHrYwEuIi 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 (http block)
  • https://github.com/__api/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 06SIChxms 64/pkg/tool/linux_amd64/link GOINSECURE rm GOMODCACHE 64/pkg/tool/linu--json env rity1957980521/0--limit BIoY6_isA outil.test GOINSECURE %H %ct %D (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE x_amd64/compile GOINSECURE age GOMODCACHE x_amd64/compile ortc�� YnTZR3KAf 64/src/internal/poll/fd.go k GOINSECURE 2845169/b007/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuorigin (http block)
  • https://github.com/__api/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/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu^remote\..*\.gh-resolved$ ortc�� me) pKmvAbdZx ser.test GOINSECURE GOMOD GOMODCACHE ser.test (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 LamLkoYmy ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linurev-parse estl�� ortcfg eJpt1zLU2 ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE eader GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
  • https://github.com/__api/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 l_test.go 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/compile env edOutput4208277180/001 1iP8YSgUm x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 JytyNgNV_ ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE v3 GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linurev-parse env UHnj43LIy GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuremote.origin.url (http block)
  • https://github.com/__api/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 V3gqgd2UJ 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/compile env edOutput4208277180/001 vZBL1k16k ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE %H %ct %D (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 InX8DV7o_ ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linurev-parse env iCGQRg9lJ GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 2845169/b013/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linutest@example.com (http block)
  • https://github.com/__api/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/compile er_b�� -json nal.go x_amd64/compile GOINSECURE GOMOD chacha8rand/chac/tmp/TestGuardPolicyTrustedUsersExpressionCompiledOutput4208277180/001 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 GOMOD abis x_amd64/link env -json diXaaNED5 ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm GOINSECURE GOMOD GOMODCACHE x2/zg1-jwF1IRoPatest@example.com (http block)
  • https://github.com/__api/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build2793759714/b404/cli.test /tmp/go-build2793759714/b404/cli.test -test.testlogfile=/tmp/go-build2793759714/b404/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true -nolocalimports -importcfg /tmp/go-build1562845169/b223/importcfg -pack env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://github.com/__api/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 64/pkg/tool/linu-goversion /opt/hostedtoolcache/node/24.14.1/x64/bin/node GoFiles,Export,Dgit ort 64/pkg/tool/linu--show-toplevel node /tmp�� /home/REDACTED/work/gh-aw/gh-aw/.github/workflows/api-consumption-report.md 64/pkg/tool/linu-pack /usr/bin/git -json GO111MODULE ache/go/1.25.8/x/tmp/gh-aw/aw-feature-branch.patch 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 --show-toplevel ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile /usr/bin/git 5317-61853/test-git ho52/RILG8Ja3npvrev-parse 2845169/b225=> git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu^remote\..*\.gh-resolved$ /usr/bin/git 2845169/b064/impdu tlUh/9pw3AB5m6U_-k /opt/hostedtoolc/tmp/gh-aw/aw-feature-branch.patch git (http block)
  • https://github.com/__api/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 -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 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/github/gh-aw/git/ref/tags/v1.0.0 --jq [.object.sha, .object.type] | @tsv 400629498 _wTXDDAYc ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 2845169/b029/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile env sRemoteWithRealGitcustom_branch510463185/001 sRemoteWithRealGitcustom_branch510463185/002/work ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD 2845169/b029/sym--show-toplevel ache/go/1.25.8/x64/pkg/tool/linuremote.origin.url (http block)
  • https://github.com/__api/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 ." GOMOD GOMODCACHE x_amd64/compile env phen2644279874/001 phen2644279874/002/work 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://github.com/__api/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/asm GOINSECURE GOMOD GOMODCACHE x_amd64/asm env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (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 iant-1223074471/.github/workflows arm.go x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (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 go x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE VAsfaec/Pi1C9UClrev-parse (http block)
  • https://github.com/__api/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 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
  • https://github.com/__api/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 -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 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/nonexistent/action/git/ref/tags/v999.999.999 --jq [.object.sha, .object.type] | @tsv 400629498 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE lite GOMODCACHE 64/pkg/tool/linux_amd64/vet ortc�� architecture-guardian.md rg/x/oauth2@v0.35.0/internal/doc.go ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuorigin (http block)
  • https://github.com/__api/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile env 400629498 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE lite GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://github.com/__api/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 x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • 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 x_amd64/asm GOINSECURE GOMOD GOMODCACHE x_amd64/asm (http block)
    • Triggering command: /usr/bin/gh gh workflow list --repo owner/repo --json name,path,state x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env ortcfg GO111MODULE 1/x64/bin/node GOINSECURE 2845169/b078/ GOMODCACHE ache/go/1.25.8/xrepos/{owner}/{repo}/actions/runs/12346/artifacts (http block)
  • https://github.com/__api/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build2793759714/b435/importcfg -pack /tmp/go-build2793759714/b435/_testmain.go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://github.com/__api/repos/test/repo
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch /001/noflag-a.md GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE er GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile ortc�� 2845169/b118/_pkg_.a om/modelcontextprotocol/go-sdk@v1.5.0/jsonrpc/js-test.run=^Test ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu--auto (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 e/git init�� ndor/bin/git git ode_modules/.bin/git =receive test@example.com--git-dir=/tmp/bare-incremental-0FOrm4 /git (dns 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 April 29, 2026 21:57
…r chains

- Replace fmt.Errorf(\"%s\", stringVar) with errors.New(stringVar) in
  pkg/workflow: engine_validation, engine_definition, runtime_validation,
  template_injection_utils, permissions_validation,
  dangerous_permissions_validation, safe_update_enforcement,
  tools_validation_github_toolsets
- Fix pkg/parser/import_error.go to return FormattedParserError with
  the ImportCycleError as the cause, preserving the errors.Is/As chain
- Fix pkg/parser/frontmatter_content.go to use FormattedParserError
  with the original YAML parse error as cause, preserving error chain
- Add missing \"errors\" import to workflow files that now use errors.New
- Remove unused \"fmt\" import from safe_update_enforcement.go

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/2733c632-f175-4db5-8ef4-d49320fb3e8a

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing %w in error wrapping across packages fix(errors): replace fmt.Errorf("%s") with errors.New and preserve error chains in pkg/workflow + pkg/parser Apr 29, 2026
Copilot AI requested a review from gh-aw-bot April 29, 2026 21:59
@github-actions github-actions Bot mentioned this pull request Apr 29, 2026
@pelikhan pelikhan marked this pull request as ready for review April 29, 2026 22:43
Copilot AI review requested due to automatic review settings April 29, 2026 22:43
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 improves error handling in pkg/workflow and pkg/parser by removing non-idiomatic fmt.Errorf("%s", msg) usage and (in select parser paths) preserving underlying causes so errors.Is/errors.As can traverse error chains.

Changes:

  • Replace fmt.Errorf("%s", preformattedMsg) with errors.New(preformattedMsg) across several workflow validation paths.
  • Update parser formatting helpers to return *FormattedParserError that retains an unwrappable cause (notably import-cycle formatting and frontmatter YAML parse errors).
  • Add errors imports where needed and adjust imports accordingly.
Show a summary per file
File Description
pkg/workflow/tools_validation_github_toolsets.go Use errors.New for prebuilt unknown-tools message.
pkg/workflow/template_injection_utils.go Return errors.New for preformatted template-injection violation report.
pkg/workflow/safe_update_enforcement.go Return errors.New for preformatted safe-update violation summary.
pkg/workflow/runtime_validation.go Use errors.New for a preformatted single-line expression-size failure.
pkg/workflow/permissions_validation.go Use errors.New for preformatted included-permissions failure output.
pkg/workflow/engine_validation.go Use errors.New for preformatted unknown inline-runtime error message.
pkg/workflow/engine_definition.go Use errors.New for preformatted unknown-engine resolution message.
pkg/workflow/dangerous_permissions_validation.go Use errors.New for preformatted dangerous-permissions report.
pkg/parser/import_error.go Preserve *ImportCycleError as the cause via *FormattedParserError.
pkg/parser/frontmatter_content.go Preserve YAML unmarshal error as the cause via *FormattedParserError.

Copilot's findings

Tip

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

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

// FrontmatterStart is 2 (line 2 is where frontmatter content starts after opening ---)
formattedErr := FormatYAMLError(err, 2, frontmatterYAML)
return nil, fmt.Errorf("failed to parse frontmatter:\n%s", formattedErr)
return nil, &FormattedParserError{formatted: "failed to parse frontmatter:\n" + formattedErr, cause: err}
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

New behavior returns a *FormattedParserError that unwraps the underlying YAML unmarshal error, but there isn’t a test covering that the cause is actually reachable via errors.As/errors.Unwrap. Since the PR’s goal is to preserve error chains, please add a regression test that calls ExtractFrontmatterFromContent with invalid YAML and asserts the returned error unwraps to the underlying goccy/go-yaml error type (e.g., yaml.SyntaxError / yaml.TypeError), while still keeping the formatted message prefix.

Suggested change
return nil, &FormattedParserError{formatted: "failed to parse frontmatter:\n" + formattedErr, cause: err}
return nil, fmt.Errorf("failed to parse frontmatter:\n%s: %w", formattedErr, err)

Copilot uses AI. Check for mistakes.
return fmt.Errorf("%s", messageBuilder.String())
return &FormattedParserError{formatted: messageBuilder.String(), cause: err}
}

Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

FormatImportCycleError now returns a *FormattedParserError with cause=err, but there isn’t a test asserting that callers can recover the original *ImportCycleError via errors.As on the formatted error. Please add a regression test that verifies errors.As(FormatImportCycleError(cycleErr), &cycleErrOut) succeeds and that the formatted message is unchanged.

Suggested change
// formatImportCycleErrorRegressionCheck verifies the wrapping contract relied on by callers:
// the formatted message stays stable and the original *ImportCycleError remains discoverable
// via errors.As through the returned *FormattedParserError.
func formatImportCycleErrorRegressionCheck() error {
cycleErr := &ImportCycleError{
Chain: []string{"a.md", "b.md", "a.md"},
WorkflowFile: "workflow.md",
}
formattedErr := FormatImportCycleError(cycleErr)
expectedMessage := "" +
"Import cycle detected\n\n" +
"The following import chain creates a circular dependency:\n\n" +
"a.md (starting point)\n" +
" ↳ imports b.md\n" +
" ↳ a.md ⚠️ cycles back to a.md\n" +
"\nTo fix this issue:\n" +
"1. Review the import dependencies in the files listed above\n" +
"2. Remove one of the imports to break the cycle\n" +
"3. Consider restructuring your workflow imports to avoid circular dependencies\n"
if formattedErr.Error() != expectedMessage {
return fmt.Errorf("unexpected formatted import cycle error message")
}
var cycleErrOut *ImportCycleError
if !errors.As(formattedErr, &cycleErrOut) {
return fmt.Errorf("expected errors.As to recover *ImportCycleError")
}
if cycleErrOut != cycleErr {
return fmt.Errorf("expected recovered *ImportCycleError to match original")
}
return nil
}

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit 0f3f1ea into main Apr 29, 2026
41 checks passed
@pelikhan pelikhan deleted the copilot/fix-error-wrapping-issues branch April 29, 2026 23:00
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.

pkg/workflow + pkg/parser: ~580 fmt.Errorf calls missing %w break errors.Is/As chains

4 participants