Skip to content

Split logs_report.go by report section#26278

Merged
pelikhan merged 4 commits intomainfrom
copilot/split-logs-report-by-section
Apr 14, 2026
Merged

Split logs_report.go by report section#26278
pelikhan merged 4 commits intomainfrom
copilot/split-logs-report-by-section

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

pkg/cli/logs_report.go had grown to 1,065 lines containing 15+ independent builder functions with no shared state, making it hard to navigate and maintain.

Changes

Extracted functions and their associated types into four focused files:

  • logs_report_tools.goToolUsageSummary, isValidToolName, buildToolUsageSummary
  • logs_report_mcp.gobuildMCPFailuresSummary, buildMCPToolUsageSummary
  • logs_report_firewall.goAccessLogSummary, FirewallLogSummary, domainAggregation, aggregateDomainStats, convertDomainsToSortedSlices, buildAccessLogSummary, buildFirewallLogSummary, buildRedactedDomainsSummary
  • logs_report_errors.goErrorSummary, addUniqueWorkflow, aggregateSummaryItems, buildCombinedErrorsSummary, buildMissingToolsSummary, buildMissingDataSummary

logs_report.go retains the top-level orchestration: buildLogsData, renderLogsConsole, renderLogsJSON, writeSummaryFile, deriveRunClassification, and the core data types (LogsData, LogsSummary, RunData, ContinuationData).

All new files are ≤200 lines. The original file is reduced to 417 lines; the remaining bulk is buildLogsData (~191 lines) which the issue spec keeps intact. No logic was changed.

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 cal/bin/bash git rev-�� --show-toplevel go /usr/bin/git me.go o e/git git (http block)
  • https://api.github.com/orgs/test-owner/actions/secrets
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build1156695125/b418/importcfg -pack /tmp/go-build1156695125/b418/_testmain.go -c k/gh-aw/gh-aw/pkGOINSECURE k/gh-aw/gh-aw/pkGOMOD 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcGOPROXY (http block)
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name --show-toplevel /usr/bin/git /usr/bin/git --get-regexp ^remote\..*\.gh-rev-parse /usr/bin/gh git rev-�� --show-toplevel gh /usr/bin/git /repos/actions/g/usr/lib/systemd/systemd-executor s/test.md /usr/bin/infocmp69 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 add origin /usr/bin/git hub/workflows GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha k/gh-aw/gh-aw/pkg/cli node clusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle run lint:cjs 64/bin/go infocmp -1 xterm-color sh /usr/bin/git "prettier" --chegit node 64/bin/go 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 41/001/test-complex-frontmatter-with-tools.md GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env y.md GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 55004358/001 GO111MODULE util.test git rev-�� --show-toplevel util.test /usr/bin/git ility-kit.md GO111MODULE x_amd64/vet git (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 licyMinIntegritygit GO111MODULE /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile /usr/bin/git 999 -trimpath ache/node/24.14.--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 --show-toplevel go /usr/bin/git 41/001/test-frongrep GO111MODULE ache/go/1.25.8/x/tmp/gh-aw/aw-master.patch git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE /opt/hostedtoolc--show-toplevel git (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ejp7/zsCemQoPI3YGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 9237557/b413/impGO111MODULE (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq .object.sha 9237557/b407/embGOINSECURE GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolc-trimpath -o /tmp/go-build334-p -trimpath 64/bin/go -p main -lang=go1.25 go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq .object.sha che/go-build/f9/GOINSECURE GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcGOPROXY -o /tmp/go-build334GOSUMDB -trimpath 64/bin/go -p main -lang=go1.25 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 remove origin /usr/bin/git rity3533807089/0git GO111MODULE 64/bin/go git rev-�� --show-toplevel go 6695125/b451/vet.cfg -json GO111MODULE 64/bin/go 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 6695125/b452/_pkg_.a origin 6695125/b452=> ay_c1779145392/0git GO111MODULE x_amd64/vet git rev-�� ZPG0/8tKMz3R2fsTHC6T_ZPG0 x_amd64/vet /usr/bin/git -json GO111MODULE x_amd64/compile git (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 -bool -buildtags ache/node/24.14.1/x64/bin/node -errorsas -ifaceassert -nilfunc find t-77�� bility_SameInputSameOutput1646135335/001/stability-test.md -lname /usr/bin/git -exec touch -c git (http block)
  • https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha 3902-31116/test-1011406802/.github/workflows GO111MODULE ache/go/1.25.8/x64/bin/bash GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha 885986010 GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuTest User env /v1.2.3 GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha -json GO111MODULE e/git GOINSECURE GOMOD GOMODCACHE e/git env 3 GO111MODULE 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0.1.2
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq .object.sha add myorg /usr/bin/git -c=4 -nolocalimports -importcfg git conf�� user.name Test User /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq .object.sha sistency_GoAndJavaScript3064249841/001/test-frontmatter-with-env-template-expressions.md GOPROXY /usr/bin/infocmp GOSUMDB GOWORK 64/bin/go infocmp 6695�� xterm-color 6695125/b422/_testmain.go /usr/bin/infocmp irKU/ChGtgPzYRrrgit GO111MODULE 64/bin/go infocmp (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha -aw/git/ref/tags/v2.0.0 GOPROXY /usr/bin/git GOSUMDB GOWORK 64/bin/go /usr/bin/git conf�� --get-regexp ^remote\..*\.gh-resolved$ /usr/bin/gh DeV7/J5kjcn-G5gogit GO111MODULE 64/bin/go gh (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/1/artifacts --jq .artifacts[].name GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE k GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/1/artifacts --jq .artifacts[].name git /usr/bin/du --show-toplevel go /usr/bin/git du -k 3861017566/.github/workflows /usr/bin/git /usr/bin/git --get-regexp ^remote\..*\.gh-remote /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12345/artifacts --jq .artifacts[].name GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env thub/workflows GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12345/artifacts --jq .artifacts[].name git /usr/bin/git --show-toplevel go /usr/bin/infocmpadd git log --oneline -10 /usr/bin/git xterm-color go /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12346/artifacts --jq .artifacts[].name GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env thub/workflows GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /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.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12346/artifacts --jq .artifacts[].name node /usr/bin/git /home/REDACTED/worgit go /usr/bin/git git stat�� 64/bin/go /usr/bin/git /usr/bin/git -v go /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/2/artifacts --jq .artifacts[].name GO111MODULE ache/go/1.25.8/x-importcfg GOINSECURE GOMOD GOMODCACHE go env 3514475573 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE de/node/bin/bash GOINSECURE GOMOD GOMODCACHE go env 419087223/.github/workflows GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/2/artifacts --jq .artifacts[].name git /usr/bin/cut --show-toplevel go /usr/bin/git cut -f1 3861017566/.github/workflows /usr/bin/git /usr/bin/git -v go /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name GO111MODULE 64/bin/bash GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE ylQP4Z8/vCNYLdc7D8RXanEmFBss env 419087223/.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 --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name git /usr/bin/wc --show-toplevel go /usr/bin/git wc -l 3861017566/.github/workflows /usr/bin/git /usr/bin/git --get-regexp ^remote\..*\.gh-rev-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 api --paginate repos/{owner}/{repo}/actions/runs/4/artifacts --jq .artifacts[].name GO111MODULE 1/x64/bin/bash GOINSECURE GOMOD GOMODCACHE go env 3514475573 GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE r (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env 419087223 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/4/artifacts --jq .artifacts[].name git /usr/bin/grep --show-toplevel go /usr/bin/git grep ^Fro�� 3861017566/.github/workflows /usr/bin/git /usr/bin/git -v go /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name GO111MODULE de/node/bin/bash GOINSECURE GOMOD GOMODCACHE go env 3514475573 GO111MODULE ck GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name git /usr/bin/grep --show-toplevel go /usr/bin/git grep -c 3861017566/.github/workflows /tmp/gh-aw/aw-master.patch /usr/bin/git -v go /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 q8HY/4bsFm_kQ2fXGOINSECURE rk 64/bin/go GOINSECURE GOMOD GOMODCACHE 9237557/b418/impGO111MODULE -c k/gh-aw/gh-aw/pkGOINSECURE k/gh-aw/gh-aw/pkGOMOD 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcGOPROXY (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 unsafe 64/bin/go 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 6 -d 168.63.129.16 WKKjjpb/pnOHWmOW0VPsKVyXPZlC env rity4021817053/001 GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v0.47.4
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq .object.sha --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git 460660505/customgit GO111MODULE ache/go/1.25.8/x--show-toplevel git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE .cfg git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/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 /tmp/go-build334-p -trimpath 64/bin/go -p github.com/ayman-ne -lang=go1.24 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.2.3 --jq .object.sha --show-toplevel nly /usr/bin/git -bool -buildtags /opt/hostedtoolc--symref git rev-�� --show-toplevel node /usr/bin/git /tmp/TestHashStagit -tests (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 /tmp/go-build334GOSUMDB -trimpath 64/bin/go -p github.com/charm-e -lang=go1.24 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/v2.0.0 --jq .object.sha /tmp/go-build334-p -trimpath 64/bin/go -p github.com/githuapi -lang=go1.25 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/v2.0.0 --jq .object.sha /tmp/go-build334GOSUMDB -trimpath 64/bin/go -p main -lang=go1.25 go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 /tmp/go-build334GOSUMDB -trimpath 64/bin/go -p main -lang=go1.25 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/v3.0.0 --jq .object.sha --show-toplevel /tmp/go-build1156695125/b429/semverutil.test /usr/bin/git -test.paniconexigit -test.v=true /opt/hostedtoolc/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitbranch_with_hyphen1305387036/001 git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile /usr/bin/git /tmp/go-build115git -trimpath /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 rity4021817053/001 GO111MODULE 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuTest User env g_.a GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link (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/linutest@example.com env e-analyzer.md GO111MODULE ortcfg.link GOINSECURE GOMOD GOMODCACHE EBpBXrdidLe1b_H-6U/X2lamLNGwUyQxU_H_V1q/Yonh5bsGremote (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion --show-toplevel go /usr/lib/git-cor--show-toplevel head -500�� y_with_repos=public_1940854475/001 /usr/lib/git-core/git-remote-https /usr/bin/git REDACTED go /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 GOMODCACHE 9237557/b417/impGO111MODULE -c che/go-build/6c/GOINSECURE GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcGOPROXY (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE 9237557/b424/impGO111MODULE -c k/gh-aw/gh-aw/pkGOINSECURE k/gh-aw/gh-aw/pkGOMOD 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolc/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitmain_branch2287100528/002/work (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo /usr/bin/git --get remote.origin.urrev-parse 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git --get remote.origin.ur--norc /usr/bin/git git (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build1156695125/b397/cli.test /tmp/go-build1156695125/b397/cli.test -test.testlogfile=/tmp/go-build1156695125/b397/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node (http block)
    • Triggering command: /tmp/go-build571450357/b001/cli.test /tmp/go-build571450357/b001/cli.test -test.testlogfile=/tmp/go-build571450357/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s rev-�� --show-toplevel G0/J5DXngsS4PU-FfFeq3Za/EKbf6qLkjYYnBXCoTB97 /usr/bin/git t0 go (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name Tz4K/UIjeBJ6kuDKGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 9237557/b406/impGO111MODULE -c che/go-build/d5/GOINSECURE GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcshow (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name --show-toplevel infocmp /usr/bin/git bility_SameInputgit go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git runs/20260414-20git remote /opt/hostedtoolc--show-toplevel git (http block)

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

Copilot AI linked an issue Apr 14, 2026 that may be closed by this pull request
5 tasks
Move builder functions to dedicated files:
- logs_report_tools.go: ToolUsageSummary, isValidToolName, buildToolUsageSummary
- logs_report_mcp.go: buildMCPFailuresSummary, buildMCPToolUsageSummary
- logs_report_firewall.go: AccessLogSummary, FirewallLogSummary, domainAggregation,
  aggregateDomainStats, convertDomainsToSortedSlices, buildAccessLogSummary,
  buildFirewallLogSummary, buildRedactedDomainsSummary
- logs_report_errors.go: ErrorSummary, addUniqueWorkflow, aggregateSummaryItems,
  buildCombinedErrorsSummary, buildMissingToolsSummary, buildMissingDataSummary

Keep buildLogsData, renderLogsConsole, renderLogsJSON, writeSummaryFile,
deriveRunClassification and core types in logs_report.go

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/3c51e058-f3eb-41af-ad85-3cb029753d5b

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Split logs_report.go into section-focused files Split logs_report.go by report section Apr 14, 2026
Copilot AI requested a review from pelikhan April 14, 2026 20:45
@pelikhan pelikhan marked this pull request as ready for review April 14, 2026 20:51
Copilot AI review requested due to automatic review settings April 14, 2026 20:51
@github-actions github-actions bot mentioned this pull request Apr 14, 2026
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

Refactors the logs report implementation by splitting the previously large pkg/cli/logs_report.go into several smaller, section-focused files to improve navigability and maintainability.

Changes:

  • Extracted tool usage summary logic into logs_report_tools.go.
  • Extracted MCP summaries into logs_report_mcp.go.
  • Extracted firewall/access/redacted-domains summaries into logs_report_firewall.go.
  • Extracted error/missing-* aggregation helpers into logs_report_errors.go, leaving logs_report.go as the orchestration layer.
Show a summary per file
File Description
pkg/cli/logs_report.go Removes extracted helper/types and keeps report orchestration and core data types.
pkg/cli/logs_report_tools.go Adds tool usage summary types + builders (including tool name validation).
pkg/cli/logs_report_mcp.go Adds MCP failures/tool-usage aggregation and sorting.
pkg/cli/logs_report_firewall.go Adds shared domain aggregation helpers and firewall/access/redacted-domains summaries.
pkg/cli/logs_report_errors.go Adds generic aggregation helper + missing tools/data summaries (and combined errors stub).

Copilot's findings

Tip

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

  • Files reviewed: 5/5 changed files
  • Comments generated: 5

Comment on lines +45 to +46
for _, pr := range processedRuns {
allowedDomains, blockedDomains, totalRequests, allowedCount, blockedCount, exists := getAnalysis(&pr)
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

In aggregateDomainStats, the loop takes the address of the range variable (&pr) and passes it to getAnalysis. This is a common Go footgun because the range variable is reused each iteration; while it happens to be safe today since the pointer isn't retained, it’s easy to accidentally break later. Prefer iterating by index and passing &processedRuns[i] (or change getAnalysis to accept a value) to avoid accidental pointer aliasing.

Suggested change
for _, pr := range processedRuns {
allowedDomains, blockedDomains, totalRequests, allowedCount, blockedCount, exists := getAnalysis(&pr)
for i := range processedRuns {
allowedDomains, blockedDomains, totalRequests, allowedCount, blockedCount, exists := getAnalysis(&processedRuns[i])

Copilot uses AI. Check for mistakes.
}

// Return nil if no MCP tool usage data was found
if len(toolSummaryMap) == 0 && len(serverStatsMap) == 0 && len(allFilteredEvents) == 0 {
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

buildMCPToolUsageSummary can return nil even when there are MCP tool calls present (it only checks summaries/servers/filtered events). If a ProcessedRun has ToolCalls populated but Summary/Servers empty, the aggregated tool call data will be dropped from the report/JSON output. Include len(allToolCalls) in the “no MCP data” check (or otherwise ensure tool calls alone keep the summary non-nil).

Suggested change
if len(toolSummaryMap) == 0 && len(serverStatsMap) == 0 && len(allFilteredEvents) == 0 {
if len(toolSummaryMap) == 0 && len(serverStatsMap) == 0 && len(allToolCalls) == 0 && len(allFilteredEvents) == 0 {

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +44
// Filter out common English words that are likely from error messages
commonWords := map[string]bool{
"calls": true, "to": true, "for": true, "the": true, "a": true, "an": true,
"is": true, "are": true, "was": true, "were": true, "be": true, "been": true,
"have": true, "has": true, "had": true, "do": true, "does": true, "did": true,
"will": true, "would": true, "could": true, "should": true, "may": true, "might": true,
"Testing": true, "multiple": true, "launches": true, "command": true, "invocation": true,
"with": true, "from": true, "by": true, "at": true, "in": true, "on": true,
}
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

isValidToolName allocates and initializes the commonWords map on every call. Since this runs once per tool name, it can create unnecessary allocations for large log sets. Consider moving the stop-word set to a package-level var (e.g., map[string]struct{}) so it’s built once and reused.

Copilot uses AI. Check for mistakes.
// it's likely a fragment
words := strings.Fields(name)
if len(words) == 1 && !hasUnderscore && !hasHyphen && len(name) < 10 && !hasCapital {
// Could be a fragment - be conservative and reject if it's a common word
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The comment in the “single word … short … lowercase” branch says “reject if it's a common word”, but the code unconditionally returns false for any single short lowercase word that matches the branch. Please adjust the comment to match the actual behavior (or adjust the logic if the intent really is to only reject common words).

Suggested change
// Could be a fragment - be conservative and reject if it's a common word
// Could be a fragment - be conservative and reject these short lowercase single-word names

Copilot uses AI. Check for mistakes.
Comment on lines +63 to +65
// buildCombinedErrorsSummary has been removed since error patterns are no longer supported
func buildCombinedErrorsSummary(_ []ProcessedRun) []ErrorSummary {
// Return empty slice since error patterns have been removed
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The comment says buildCombinedErrorsSummary “has been removed”, but the function still exists (as a stub returning an empty slice). This is confusing for future maintainers; please reword to reflect that the function is intentionally a no-op/compatibility stub (or delete it and remove its call site if it’s truly removed).

Suggested change
// buildCombinedErrorsSummary has been removed since error patterns are no longer supported
func buildCombinedErrorsSummary(_ []ProcessedRun) []ErrorSummary {
// Return empty slice since error patterns have been removed
// buildCombinedErrorsSummary is an intentional no-op compatibility stub retained
// after error-pattern support was removed.
func buildCombinedErrorsSummary(_ []ProcessedRun) []ErrorSummary {
// Preserve the previous call shape while reporting no combined errors.

Copilot uses AI. Check for mistakes.
Generated by Design Decision Gate workflow to document the architectural
decision to split pkg/cli/logs_report.go into domain-focused files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Commit pushed: 3750686

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions
Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (675 new lines in pkg/cli/, a default business logic directory) but does not have a linked Architecture Decision Record (ADR).

AI has analyzed the PR diff and generated a draft ADR to help you get started:

📄 Draft ADR: docs/adr/26278-split-logs-report-by-section.md

What to do next

  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete the missing sections — add context the AI couldn't infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-26278: Split logs_report.go into Domain-Focused Files

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.


📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (e.g., 26278-split-logs-report-by-section.md for PR #26278).

🔒 This PR cannot merge until an ADR is linked in the PR body.

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · ● 132.2K ·

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review all comments

- logs_report_firewall.go: use index-based loop in aggregateDomainStats to
  avoid range-variable pointer aliasing
- logs_report_mcp.go: include len(allToolCalls) in the nil guard so runs
  with only ToolCalls populated are not silently dropped
- logs_report_tools.go: promote commonWords to package-level var to avoid
  per-call map allocation; clarify misleading comment in short-name branch
- logs_report_errors.go: reword buildCombinedErrorsSummary comment to
  reflect it is an intentional no-op stub, not a removed function

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/03dac59c-ef56-46e4-b97d-5cee94d615ec

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 14, 2026

@copilot review all comments

Addressed all 5 review comments in 93eccc3:

  1. aggregateDomainStats range-variable pointer aliasing — switched to for i := range processedRuns + &processedRuns[i]
  2. buildMCPToolUsageSummary nil guard — added len(allToolCalls) == 0 to the early-return condition so runs with only tool calls aren't silently dropped
  3. isValidToolName per-call map allocation — promoted commonWords to a package-level var toolNameStopWords
  4. Misleading comment in isValidToolName — updated to accurately say "Reject short, all-lowercase, single-word names with no separators" rather than "reject if it's a common word"
  5. buildCombinedErrorsSummary misleading comment — reworded to "intentional no-op compatibility stub retained after error-pattern support was removed"

@pelikhan pelikhan merged commit 85c49b6 into main Apr 14, 2026
@pelikhan pelikhan deleted the copilot/split-logs-report-by-section branch April 14, 2026 21:14
@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

Hey @Copilot 👋 — great work splitting up the bloated logs_report.go! Breaking a 1,065-line file into four focused domain files (tools, mcp, firewall, errors) is exactly the kind of maintainability improvement the codebase benefits from, and the ADR document is a nice touch.

One thing worth flagging before this merges:

  • No test changes — the diff doesn't touch any test files. Since this is a pure refactor (no logic changes), existing tests should still cover the moved functions — but it would be worth explicitly confirming existing tests still pass and are green after the split. If there are no tests for the moved functions, this is a good opportunity to add them.

If you'd like a hand, you can assign this prompt to your coding agent:

In the gh-aw repository, PR #26278 refactored `pkg/cli/logs_report.go` by splitting it into four new files:
- pkg/cli/logs_report_tools.go
- pkg/cli/logs_report_mcp.go
- pkg/cli/logs_report_firewall.go
- pkg/cli/logs_report_errors.go

Please:
1. Check whether existing unit tests in `pkg/cli/` cover the functions that were moved.
2. If any moved functions lack test coverage, add unit tests for them in an appropriately named `_test.go` file.
3. Run `make test-unit` to confirm all tests pass after the refactor.

Generated by Contribution Check · ● 1.7M ·

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] Split logs_report.go by report section

3 participants