Skip to content

Replace %v with %w for error wrapping in fmt.Errorf calls - #17472

Merged
pelikhan merged 2 commits into
mainfrom
copilot/replace-v-with-w-errors
Feb 21, 2026
Merged

Replace %v with %w for error wrapping in fmt.Errorf calls#17472
pelikhan merged 2 commits into
mainfrom
copilot/replace-v-with-w-errors

Conversation

Copilot AI commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

Nine fmt.Errorf call sites used %v for error arguments, discarding the original error type and breaking errors.Is() / errors.As() traversal for callers.

Changes

  • pkg/workflow/frontmatter_error.go, pkg/workflow/schema_validation.go: %v%w
  • pkg/cli/logs_command.go (2 sites), pkg/cli/enable.go (2 sites): %v%w
  • pkg/parser/tools_merger.go (2 sites): %v%w
  • pkg/workflow/compiler_orchestrator_frontmatter.go: %v retained — existing tests explicitly assert that *fs.PathError must not appear in the error chain (intentional abstraction boundary). Updated comment to make the intent explicit:
// Intentionally not wrapping to avoid exposing internal path details
return nil, fmt.Errorf("failed to read file: %v", 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://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GOMOD 64/bin/go infocmp -1 xterm-color go ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -json GO111MODULE 64/bin/go ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw x_amd64/vet /usr/bin/git git -C /tmp/gh-aw-test-runs/20260221-122625-30597/test-2977002718/.github/workflows rev-parse e/git gh-aw/actions/segit 64/pkg/tool/linurev-parse /usr/bin/git e/git (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw git /usr/bin/git git ortc�� --show-toplevel stmain.go ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet --show-toplevel l /usr/bin/git ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (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 runs/20260221-122542-26628/test-1120090588/.github/workflows /tmp/go-build2410617521/b080/vet.cfg .cfg l GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -uns�� -unreachable=false /tmp/go-build2410617521/b210/vet.cfg /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet 628936/b354/_pkggit GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --show-toplevel /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile /usr/bin/git /tmp/go-build241git -trimpath /usr/bin/git git rev-�� --show-toplevel git ache/node/24.13.0/x64/bin/node --show-toplevel -dwarf=false /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/mkdir --show-toplevel git /usr/bin/git mkdir (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 se 0617521/b015/vet.cfg ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet env 2542-26628/test-1312602913/.github/workflows GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel ingutil.test /usr/bin/git se 0617521/b377/vetrev-parse /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git runs/20260221-12git /tmp/go-build241rev-parse /opt/hostedtoolc--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel /opt/hostedtoolcrev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git 3349291576 eea1b6738730c90erev-parse 0/x64/bin/node git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha 48 GOPROXY /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -uns�� runs/20260221-122542-26628/test-3623639954/.github/workflows /tmp/go-build2410617521/b063/vet.cfg 0617521/b333/vet.cfg g/mathutil/mathugit g/mathutil/mathurev-parse 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha log.showsignature=false log Name,createdAt,startedAt,updated-test.short=true -n1 --format=format:rev-parse 95b62d3fa19c52cc--show-toplevel 64/pkg/tool/linux_amd64/vet -uns�� -unreachable=false .cfg 0617521/b362/vet.cfg g/sliceutil/slicgit g/sliceutil/slicrev-parse 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha /tmp/go-build2410617521/b425/timeutil.test -importcfg /usr/bin/git -s -w -buildmode=exe git rev-�� --git-dir -extld=gcc /usr/bin/git -json GO111MODULE x_amd64/vet git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha ty-test.md .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha ons-test1433502048 -buildtags ache/node/24.13.0/x64/bin/node -errorsas -ifaceassert -nilfunc git t-10�� bility_SameInputSameOutput3974506830/001/stability-test.md -tests /usr/bin/git che/go-build/bf/git GOPROXY 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel x_amd64/vet /usr/bin/git -json GO111MODULE x_amd64/vet git conf�� --get remote.origin.url /usr/bin/gh -json GO111MODULE x_amd64/vet gh (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 data/action_pins.json..." GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go node /hom�� --check scripts/**/*.js 64/bin/go .prettierignore --write 64/bin/go go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha prettier --check 64/bin/go --ignore-path .prettierignore 64/bin/go go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha "prettier" --che-errorsas GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go go 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 vaScript290218832/001/test-compl-p 0617521/b359/vet.cfg /opt/hostedtoolcache/go/1.25.0/x-lang=go1.25 GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.0/x-dwarf=false -uns�� 2542-26628/test-30031085 /tmp/go-build2410617521/b099/vet-c=4 /opt/hostedtoolcache/go/1.25.0/x-nolocalimports l GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x/tmp/go-build2410617521/b430/_testmain.go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel /usr/bin/git ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet --get-regexp (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/tr --show-toplevel git /usr/bin/git tr (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 /ref/tags/v8 GOPROXY Name,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -uns�� -unreachable=false /tmp/go-build2410617521/b092/vet.cfg 0617521/b332/vet.cfg g/repoutil/repougit g/repoutil/repourev-parse 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel infocmp ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet xterm-color /opt/hostedtoolc-1 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git auto-triage-issugit ROOT" ] && expo /usr/bin/git git rev-�� --show-toplevel git /usr/bin/bash --show-toplevel git /usr/bin/git bash (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuremote.origin.url (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 e/git /usr/bin/git --show-toplevel -tests 0617521/b405/vet--show-toplevel git rev-�� --show-toplevel git ache/go/1.25.0/x64/bin/bash --get remote.origin.urrev-parse /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/pkg/tool/linu-test.short=true GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuTest User estl�� -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuorigin (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 ache/go/1.25.0/x64/pkg/tool/linux_amd64/link /usr/bin/git 0617521/b425/timgit -importcfg 0617521/b425/imp--show-toplevel git rev-�� 2625-30597/test-4176403329/.github/workflows iiEtxJ64HjgrP/g5FpiJ9ENbZatjTay5oJ/BhqTCoRMGewfss9ZXZGY/X4XoDkfiiEtxJ64HjgrP /usr/bin/git ry=1 remote.origin.urrev-parse 0617521/b425/_pk--show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json .cfg 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 /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git bility_SameInputgit -buildtags /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel -tests /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_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 run download 2 --dir test-logs/run-2 git /usr/bin/git --show-toplevel -tests /usr/bin/git git rev-�� tags/v5 git ache/node/24.13.0/x64/bin/bash /tmp/gh-aw-test-git rev-parse /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 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/linuremote.origin.url (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 0/x64/bin/node /usr/bin/git -stringintconv -tests /usr/bin/git git rev-�� 2625-30597/test-3089340499/.github/workflows git k/_temp/ghcca-node/node/bin/bash /tmp/gh-aw-test-git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/pkg/tool/linu-buildmode=exe GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu/tmp/go-build2410617521/b113/vet.cfg 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 run download 4 --dir test-logs/run-4 0/x64/bin/node /usr/bin/git /tmp/go-build241git -trimpath /usr/bin/git git rev-�� 2625-30597/test-3089340499/.github/workflows git /usr/bin/git --show-toplevel -dwarf=false /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE 64/pkg/tool/linu-lang=go1.25 GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu-goversion env -json GO111MODULE 64/pkg/tool/linu-importcfg GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu/home/REDACTED/work/gh-aw/gh-aw/pkg/timeutil/format_test.go (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 git 0/x64/bin/node r/repo.git test@example.comrev-parse /usr/bin/git git t-ha�� brave.md git cal/bin/bash --show-toplevel sh /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path prettier --check 64/bin/go **/*.ts **/*.json --ignore-path kXp6pAimNyCI -o /tmp/go-build782--property=MemoryAccounting=yes -trimpath 64/bin/go -p github.com/githu-atomic -lang=go1.25 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 github.com/githu-atomic -lang=go1.25 go env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 GOMOD GOMODCACHE x_amd64/compile env -json .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json .cfg 64/pkg/tool/linu-nolocalimports GOINSECURE GOMOD GOMODCACHE IKEP8dB/iAJz33n4qBSgoBRlrikz env 3541644971/.github/workflows 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 -v x_amd64/vet 0/x64/bin/node -json GO111MODULE 64/pkg/tool/linu--show-toplevel git 0/x6�� --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git -json .cfg 64/pkg/tool/linu--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel ache/go/1.25.0/xrev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel 4e3b3623a200c174rev-parse /usr/bin/git git (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 matter-with-arrays.md .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env 1312602913/.github/workflows .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/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha -v x_amd64/vet /usr/bin/git -json GO111MODULE x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git -json GO111MODULE 64/pkg/tool/linu--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel git /usr/lib/git-core/git --show-toplevel ache/go/1.25.0/xrev-parse /usr/bin/git /usr/lib/git-core/git main�� run --auto /usr/bin/git --detach 4e3b3623a200c174rev-parse /usr/bin/git git (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json .cfg ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion bility_SameInputgit -test.v=true /usr/bin/git git rev-�� --show-toplevel git ache/go/1.25.0/x64/pkg/tool/linux_amd64/link path.sh' '' && egit config /tmp/go-build241--git-dir ache/go/1.25.0/x64/pkg/tool/linux_amd64/link (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcsecurity -o /tmp/go-build782OUTPUT -trimpath 64/bin/go -p github.com/pmeza-unsafeptr=false -lang=go1.16 go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOSUMDB GOWORK 64/bin/go bN-GiB6lFYr9 -o /tmp/go-build782OUTPUT -trimpath 64/bin/go -p github.com/ayman-atomic -lang=go1.23 go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo /usr/bin/git on GO111MODULE 64/pkg/tool/linu--show-toplevel kExEsjqO1cfS rev-�� --show-toplevel 64/pkg/tool/linux_amd64/vet eb0c36d4795c2601-d -json .cfg 64/pkg/tool/linuextensions.objectformat git (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build2410617521/b380/cli.test /tmp/go-build2410617521/b380/cli.test -test.testlogfile=/tmp/go-build2410617521/b380/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE sh -c "prettier" --che-errorsas GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go go (http block)
    • Triggering command: /tmp/go-build2946656162/b360/cli.test /tmp/go-build2946656162/b360/cli.test -test.testlogfile=/tmp/go-build2946656162/b360/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.short=true -test.run=^Test --json /usr/bin/git --workflow nonexistent-workrev-parse --limit git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/link /usr/bin/git -json GO111MODULE 64/pkg/tool/linu--show-toplevel git (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name prettier --check 64/bin/go **/*.ts **/*.json --ignore-path git -c log.showsignature=false log 64/bin/go -d --format=format:-atomic 95b62d3fa19c go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name --show-toplevel x_amd64/vet /usr/bin/git -json GO111MODULE 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linutest@example.com /usr/bin/git -json .cfg x_amd64/link git (http block)

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

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Replace %v with %w for error wrapping in fmt.Errorf calls</issue_title>
<issue_description>## Objective

Replace %v with %w for error arguments in fmt.Errorf calls across 5 production files to enable proper error chain traversal via errors.Is() / errors.As().

Context

Identified in Sergo audit discussion github/gh-aw#17303. Nine call sites use %v to format errors instead of %w, which discards the original error type and prevents structured error handling by callers.

Note: Dual-fallback patterns in pkg/cli/download_workflow.go and pkg/parser/remote_fetch.go that use %v for the secondary error in Go 1.20+ multi-error patterns are intentional and should be left unchanged.

Locations to Fix

File Line(s) Current Pattern
pkg/workflow/frontmatter_error.go 94 fmt.Errorf("%s: %v", filePath, err)
pkg/workflow/compiler_orchestrator_frontmatter.go 40 fmt.Errorf("failed to read file: %v", err)
pkg/workflow/schema_validation.go 144 fmt.Errorf("%v. %s", err, example)
pkg/cli/logs_command.go 168, 177 fmt.Errorf("invalid ... format '%s': %v", ...)
pkg/cli/enable.go 66, 93 fmt.Errorf("no workflow files found to %s: %v", ...)
pkg/parser/tools_merger.go 120, 223 fmt.Errorf("MCP tool conflict ...: %v", err)

Approach

For each location, change the error argument verb from %v to %w:

// Before
return nil, fmt.Errorf("failed to read file: %v", err)

// After
return nil, fmt.Errorf("failed to read file: %w", err)

For schema_validation.go:144 where the error is the first argument ("%v. %s", err, example), rewrite to keep %w as the error verb while preserving the message format.

If any call site has a comment explaining that wrapping is intentionally avoided (e.g., to hide internals), preserve that intent and add a clearer comment like // Intentionally not wrapping to avoid exposing internal path details.

Acceptance Criteria

  • All 9 listed call sites use %w for the error argument (or have an explicit comment explaining why %v is intentional)
  • go build ./... succeeds with no compile errors
  • go test ./pkg/workflow/... ./pkg/parser/... ./pkg/cli/... passes
  • make agent-finish passes (build + test + lint + fmt)
  • No test expectations break due to changed error string format

Generated by Plan Command for issue #discussion #17303

  • expires on Feb 23, 2026, 12:17 PM UTC

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update error formatting to use %w for error wrapping Replace %v with %w for error wrapping in fmt.Errorf calls Feb 21, 2026
@pelikhan
pelikhan marked this pull request as ready for review February 21, 2026 12:36
Copilot AI review requested due to automatic review settings February 21, 2026 12:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 by replacing %v with %w in fmt.Errorf calls to enable proper error chain traversal via errors.Is() and errors.As(). One intentional exception is preserved in compiler_orchestrator_frontmatter.go where existing tests require that os.PathError not be exposed in the error chain.

Changes:

  • Updated 8 fmt.Errorf call sites to use %w for error wrapping instead of %v
  • Improved comment clarity for the intentional %v usage in compiler_orchestrator_frontmatter.go
  • Removed duplicate empty file check in enable.go

Reviewed changes

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

Show a summary per file
File Description
pkg/workflow/schema_validation.go Changed error formatting from %v to %w to preserve error chain in schema validation
pkg/workflow/frontmatter_error.go Changed error formatting from %v to %w in frontmatter error fallback path
pkg/workflow/compiler_orchestrator_frontmatter.go Updated comment to clarify intentional use of %v to avoid exposing internal path details
pkg/parser/tools_merger.go Changed error formatting from %v to %w in two MCP tool conflict cases
pkg/cli/logs_command.go Changed error formatting from %v to %w for date validation errors
pkg/cli/enable.go Changed error formatting from %v to %w and removed duplicate empty file check

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

@pelikhan
pelikhan merged commit 612385d into main Feb 21, 2026
118 of 120 checks passed
@pelikhan
pelikhan deleted the copilot/replace-v-with-w-errors branch February 21, 2026 12:39
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.

[plan] Replace %v with %w for error wrapping in fmt.Errorf calls

3 participants