Skip to content

refactor: resolve 4 semantic function clustering findings#19799

Merged
pelikhan merged 2 commits intomainfrom
copilot/refactor-semantic-function-clustering-53b8f0b4-b41a-4962-835b-fb09f6ba3ea6
Mar 6, 2026
Merged

refactor: resolve 4 semantic function clustering findings#19799
pelikhan merged 2 commits intomainfrom
copilot/refactor-semantic-function-clustering-53b8f0b4-b41a-4962-835b-fb09f6ba3ea6

Conversation

Copy link
Contributor

Copilot AI commented Mar 6, 2026

Automated semantic analysis identified duplicate logic, orphaned dead code, inconsistent file organization, and mixed responsibilities across pkg/cli and pkg/workflow. Addresses all 4 findings.

Finding 1: Duplicate release-fetching functions

getLatestReleaseVersion(verbose bool) in update_extension_check.go was identical to getLatestRelease() in update_check.go, with only the logger variable differing and verbose never used in the body.

  • Deleted getLatestReleaseVersion and its unused api import
  • ensureLatestExtensionVersion now calls getLatestRelease() directly

Finding 2: Orphaned TOML rendering functions

renderSafeOutputsMCPConfigTOML and renderAgenticWorkflowsMCPConfigTOML in mcp_config_builtin.go had zero production callsites — tests exercised these orphans rather than the production MCPConfigRendererUnified path, leaving sandbox-aware host selection untested.

  • Deleted both orphaned functions from mcp_config_builtin.go
  • Rewired mcp_config_refactor_test.go to use NewMCPConfigRenderer().RenderSafeOutputsMCP() / RenderAgenticWorkflowsMCP()
  • Added TestRenderSafeOutputsMCPConfigTOMLSandboxAware covering the host.docker.internal vs localhost selection logic that was previously untested

Finding 3: Update entity file organization

close_entity_helpers.go consolidates all three close-entity config types in one file; the equivalent update-entity configs were spread across update_issue.go, update_discussion.go, and update_pull_request.go (33–42 lines each), inconsistent with the close pattern.

  • Moved UpdateIssuesConfig, UpdateDiscussionsConfig, UpdatePullRequestsConfig and their parsers into update_entity_helpers.go (which already housed the shared generic parsing infrastructure)
  • Deleted the three now-empty per-entity files
  • Logger vars consolidated at the top of the file per Go convention

Finding 4: Log-parsing functions in detector file

ParseCopilotCodingAgentLogMetrics and extractToolName were in copilot_agent.go alongside detection heuristics, violating the *_logs.go convention used by every other engine (copilot_logs.go, claude_logs.go, codex_logs.go, gemini_logs.go).

  • Extracted both functions to new pkg/cli/copilot_agent_logs.go
  • copilot_agent.go now has a single responsibility: detection logic (~180 lines)

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 GO111MODULE x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git -test.md GO111MODULE 64/bin/go 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 go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git (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 -bool -buildtags (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha :latest git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/gh --show-toplevel go /usr/bin/git gh (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 runs/20260306-040454-27675/test-1570034979/.github/workflows GO111MODULE ache/node/24.14.0/x64/bin/node l GOMOD GOMODCACHE go t-49�� sistency_GoAndJavaScript2712461781/001/test-complex-frontmatter--errorsas GO111MODULE 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 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet tartedAt,updatedAt,event,headBranch,headSha,displayTitle -bool -buildtags /usr/bin/git git rev-�� runs/20260306-040700-32149/test-2182524112/.github/workflows git /usr/bin/git l -tests /usr/bin/git 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 -json GO111MODULE 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 api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel node /usr/bin/git prettier --check 64/bin/go git rev-�� --show-toplevel node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --check scripts/**/*.js 64/bin/go /opt/hostedtoolcache/node/24.14.0/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE ger.test 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 k/gh-aw/gh-aw/.github/workflows/ace-editor.md rev-parse /tmp/go-build1545152914/b409/parser.test -json GO111MODULE 64/bin/go /tmp/go-build1545152914/b409/parser.test -tes�� -test.paniconexit0 -test.v=true (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha /tmp/gh-aw-test-runs/20260306-040454-27675/test-1812856862/.github/workflows (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--show-toplevel 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 GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go k/gh�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD erignore go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha om/aymanbagabas/GOINSECURE om/aymanbagabas/GOMOD 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 8192926/b391/_pkGOINSECURE 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 g/mathutil/mathuGOINSECURE g/mathutil/mathuGOMOD 64/bin/go r code style"; tgo GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 8192926/b398/_pkGOINSECURE 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 k/gh-aw/gh-aw/.github/workflows/ace-editor.md k/gh-aw/gh-aw/pkg/stringutil/identifiers.go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile -json GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile -o /tmp/go-build1545152914/b421/_pkg_.a -trimpath /usr/bin/infocmp -p github.com/githurev-parse -lang=go1.25 infocmp (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 pload-artifact/ggit go /usr/bin/git git -C /tmp/gh-aw-test-runs/20260306-040700-32149/test-1689938947/.github/workflows rev-parse /usr/bin/git --show-toplevel go 86_64/node 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 --show-toplevel -tests /tmp/go-build1545152914/b416/sliceutil.test -json GO111MODULE 64/bin/go /tmp/go-build1545152914/b416/sliceutil.test -tes�� -test.paniconexit0 -test.v=true /usr/bin/gh -test.timeout=10git -test.run=^Test -test.short=true--show-toplevel gh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel resolved$ Name,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --show-toplevel go /usr/bin/git git -C /tmp/gh-aw-test-runs/20260306-040700-32149/test-1689938947/.github/workflows (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 -json GO111MODULE (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git add origin /usr/bin/infocmp-v git rev-�� --show-toplevel infocmp (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/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 download 1 --dir test-logs/run-1 git /usr/bin/git /tmp/shared-actigit config /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel node /usr/bin/git /home/REDACTED/worgit /tmp/go-build154rev-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/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 node /usr/bin/git /tmp/TestHashStagit go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git user.name Test User /opt/hostedtoolc--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 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 git /usr/bin/git GOMODCACHE resolved$ /usr/bin/git git rev-�� ons/secrets git /usr/bin/git user.email test@example.comrev-parse /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/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 download 2 --dir test-logs/run-2 gh /usr/bin/git /repos/actions/ggit resolved$ /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel 8192926/b358/imprev-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 x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linu-w /usr/bin/git -unreachable=falgit /tmp/go-build154config /usr/bin/git git rev-�� 0700-32149/test-3876540399/.github/workflows git /usr/bin/git --show-toplevel 8192926/b369/imprev-parse /usr/bin/git 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/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 download 4 --dir test-logs/run-4 node /usr/bin/git /tmp/TestHashStagit resolved$ /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel sh /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/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 download 5 --dir test-logs/run-5 infocmp /usr/bin/git xterm-color go /usr/bin/git git rev-�� 0700-32149/test-3876540399/.githremote.origin.url git /usr/bin/git GOMODCACHE 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 GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ck 'scripts/**/*GOINSECURE 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 go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (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 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 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/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel 64/pkg/tool/linux_amd64/compile /usr/bin/git g_.a GO111MODULE ache/go/1.25.0/x/repos/actions/checkout/git/ref/tags/v5 git rev-�� --show-toplevel go /usr/bin/git eyKKX2HHY GO111MODULE ache/go/1.25.0/x--show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha ript formatting GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha --show-toplevel 64/pkg/tool/linux_amd64/compile /usr/bin/git ository }} GO111MODULE /opt/hostedtoolc/tmp/gh-aw-test-runs/20260306-040700-32149/test-3506985126/.github/workflows git rev-�� --show-toplevel go /usr/bin/git 0454-27675/test-git GO111MODULE /opt/hostedtoolc--show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v2.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha 8192926/b369/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/tmp GOMODCACHE go env f-GF/qbxfFo4g7fP-errorsas GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 8192926/b369/imp-tests (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha 8192926/b385/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE bagabas/go-udiff-atomic GOMODCACHE go env DfIt/H91eAJ5JZRw-errorsas GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 8192926/b385/imp-tests (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 e=false GO111MODULE 64/bin/go GOINSECURE %H %ct %D GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq .object.sha --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git SameOutput191825git GO111MODULE /opt/hostedtoolc/tmp/compile-instructions-test-2606274699/.github/workflows git rev-�� ithub-script/git/ref/tags/v8 go /usr/bin/git -json GO111MODULE (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 -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 319361167/.github/workflows GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel go /usr/bin/git 0454-27675/test-git GO111MODULE ache/go/1.25.0/x--show-toplevel 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 go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion test.txt go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --git-dir node /usr/bin/git git (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD ode-gyp-bin/sh go env ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo /usr/bin/git util.test GO111MODULE ortcfg.link git rev-�� --show-toplevel ieDgTbGk7_NLNx7PZm/GFtmVa307QDDNuUCuh0B/7zrZo2yp-trimpath /usr/bin/git 0454-27675/test-git GO111MODULE les.test git (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build1545152914/b383/cli.test /tmp/go-build1545152914/b383/cli.test -test.testlogfile=/tmp/go-build1545152914/b383/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE ortcfg k/gh�� 8242caa57cd5fccfGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD erignore ache/go/1.25.0/xGO111MODULE (http block)
    • Triggering command: /tmp/go-build4191221642/b001/cli.test /tmp/go-build4191221642/b001/cli.test -test.testlogfile=/tmp/go-build4191221642/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s rev-�� --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git 22/001/stabilitygit GO111MODULE ache/go/1.25.0/x--show-toplevel git rev-�� heckout/git/ref/tags/v3 go /usr/bin/git 0454-27675/test-git GO111MODULE 0/x64/bin/node 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 GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ck 'scripts/**/*GOINSECURE 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 --show-toplevel aw.test /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel go /usr/bin/git /ref/tags/v8 GO111MODULE ache/go/1.25.0/x--show-toplevel git (http block)

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


💡 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.

Finding 1: Remove duplicate getLatestReleaseVersion, use getLatestRelease
Finding 2: Remove orphaned TOML functions, update tests to use production path
Finding 3: Consolidate update entity configs into update_entity_helpers.go
Finding 4: Extract log-parsing functions to copilot_agent_logs.go"

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor semantic function clustering analysis findings refactor: resolve 4 semantic function clustering findings Mar 6, 2026
@pelikhan pelikhan marked this pull request as ready for review March 6, 2026 08:04
Copilot AI review requested due to automatic review settings March 6, 2026 08:04
Copy link
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

Refactors pkg/cli and pkg/workflow to address semantic-analysis findings by deduplicating release-check logic, removing unused MCP TOML helpers, consolidating update-entity config parsing, and separating Copilot coding-agent log parsing into a dedicated file.

Changes:

  • Removed duplicate getLatestReleaseVersion and reused getLatestRelease() for extension update checks.
  • Deleted orphaned MCP TOML render helpers and rewired tests to exercise the production MCPConfigRendererUnified path (including a new sandbox-aware host selection test).
  • Consolidated update-entity config types/parsers into update_entity_helpers.go and moved Copilot coding-agent log parsing into copilot_agent_logs.go.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/cli/update_extension_check.go Removes duplicate latest-release fetcher and calls shared getLatestRelease()
pkg/cli/copilot_agent.go Removes log-metrics parsing helpers so the file focuses on detection heuristics
pkg/cli/copilot_agent_logs.go Adds dedicated Copilot coding-agent log metrics parsing utilities
pkg/workflow/mcp_config_builtin.go Removes unused/orphaned TOML helper renderers
pkg/workflow/mcp_config_refactor_test.go Updates tests to use production MCP renderer and adds sandbox-aware Safe Outputs TOML test
pkg/workflow/update_entity_helpers.go Consolidates update-issue/discussion/PR config types and parsing into the shared helpers file
pkg/workflow/update_issue.go Deleted (moved into update_entity_helpers.go)
pkg/workflow/update_discussion.go Deleted (moved into update_entity_helpers.go)
pkg/workflow/update_pull_request.go Deleted (moved into update_entity_helpers.go)
Comments suppressed due to low confidence (1)

pkg/cli/copilot_agent_logs.go:105

  • extractToolName recompiles its regex list on every invocation. Consider precompiling these patterns once (e.g., a package-level slice) and reusing them to reduce overhead when scanning large logs.
// extractToolName extracts a tool name from a log line
func extractToolName(line string) string {
	// Try to extract tool name from various patterns
	patterns := []*regexp.Regexp{
		regexp.MustCompile(`(?i)tool[:\s]+([a-zA-Z0-9_-]+)`),
		regexp.MustCompile(`(?i)calling[:\s]+([a-zA-Z0-9_-]+)`),
		regexp.MustCompile(`(?i)executing[:\s]+([a-zA-Z0-9_-]+)`),
		regexp.MustCompile(`(?i)using[:\s]+tool[:\s]+([a-zA-Z0-9_-]+)`),
	}

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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 210 to 212
// TestRenderPlaywrightMCPConfigTOML verifies the TOML format helper for Codex engine
// TestRenderSafeOutputsMCPConfigTOML verifies the Safe Outputs TOML format helper
// TestRenderSafeOutputsMCPConfigTOML verifies the Safe Outputs TOML format via the production MCPConfigRendererUnified path
func TestRenderSafeOutputsMCPConfigTOML(t *testing.T) {
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

The comment TestRenderPlaywrightMCPConfigTOML... is misleading here: the following test function is TestRenderSafeOutputsMCPConfigTOML, not a Playwright TOML test. Please remove or update this comment so it matches the test it describes.

See below for a potential fix:

// TestRenderSafeOutputsMCPConfigTOML verifies the Safe Outputs TOML format via the production MCPConfigRendererUnified path
func TestRenderSafeOutputsMCPConfigTOML(t *testing.T) {
	var output strings.Builder
	var output strings.Builder

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +26
// GitHub Copilot coding agent log patterns
// These patterns are designed to match the specific log format of the agent
turnPattern := regexp.MustCompile(`(?i)task.*iteration|agent.*turn|step.*\d+`)
toolCallPattern := regexp.MustCompile(`(?i)tool.*call|executing.*tool|calling.*(\w+)`)
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

turnPattern and toolCallPattern are compiled on every call to ParseCopilotCodingAgentLogMetrics. Consider moving these regexes to package-level vars (or initializing once) to avoid repeated compilation overhead when parsing many logs.

This issue also appears on line 97 of the same file.

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit b00407b into main Mar 6, 2026
110 checks passed
@pelikhan pelikhan deleted the copilot/refactor-semantic-function-clustering-53b8f0b4-b41a-4962-835b-fb09f6ba3ea6 branch March 6, 2026 08:10
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.

3 participants