Skip to content

feat(copilot-session-insights): add orphaned branch escalation detection for high-gate CI waste#29384

Merged
pelikhan merged 2 commits intomainfrom
copilot/deep-report-add-agent-assignment-priority
Apr 30, 2026
Merged

feat(copilot-session-insights): add orphaned branch escalation detection for high-gate CI waste#29384
pelikhan merged 2 commits intomainfrom
copilot/deep-report-add-agent-assignment-priority

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

Historically ~40% of active branches are orphaned (PR open, no Copilot agent assigned, gates firing). Today's 60% rate — with two branches burning 10–11 simultaneous gate jobs for hours — prompted adding an automated escalation signal to surface these before they consume significant CI capacity.

Changes

New Phase 2b in copilot-session-insights.md

  • Fetches open PRs (paginated) and in-progress workflow runs from the last 6 hours via GitHub API
  • Computes per-branch gate counts entirely in jq using group_by — keeps a structured data pipeline without fragile shell text joins
  • Joins PR metadata with gate counts; filters for ≥5 simultaneous gates + no copilot-swe-agent assigned + wait >1 hour
  • Classifies severity and emits orphan-escalations.json sorted by descending gate count:
($runs[0] | group_by(.branch) | map({key: .[0].branch, value: length}) | from_entries) as $gate_counts |
$prs[0] | map(
  . as $pr |
  ($gate_counts[$pr.head_branch] // 0) as $gates |
  ([$pr.assignees[] | select(. == "copilot-swe-agent")] | length == 0) as $no_agent |
  select($gates >= 5 and $no_agent) | ...
)

Severity thresholds

Condition Severity
≥10 gates + no agent + >2h 🔴 Critical — immediate manual review
5–9 gates + no agent + >2h 🟠 High — priority agent assignment
≥5 gates + no agent + 1–2h 🟡 Warning — monitor

Updated discussion template

  • New "Orphaned Branch Escalation Alerts" section: severity table, CI waste estimate (gate-hours wasted, recoverable capacity %), and comparison against the ~40% historical baseline — flagged as elevated when today's rate exceeds 50%

Updated success criteria

  • Orphan detection and escalation reporting added as explicit completion requirements

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 gh repo view --json owner,name --jq .owner.login + "/" + .name ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOINSECURE t/internal GOMODCACHE ache/go/1.25.8/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 th2 GOMODCACHE ache/go/1.25.8/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 I90EMypUi1jSv/QUconfig GOMODCACHE ache/go/1.25.8/xTest User -p 5/001/noflag-a.md -trimpath ow.lock.yml -I /tmp/go-build415rev-parse -I ache/go/1.25.8/x64/pkg/tool/linu--auto (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 -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_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, .object.type] | @tsv GOMODCACHE 64/pkg/tool/linux_amd64/vet /usr/bin/git se 8741784/b019/vetrev-parse .cfg git rev-�� --show-toplevel ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git /tmp/go-build415node pkg/mod/github.c/opt/hostedtoolcache/node/24.14.1/x64/bin/npm Name,createdAt,sinstall 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, .object.type] | @tsv /tmp/go-build2438741784/b474/_pkg_.a -trimpath /usr/bin/git -p github.com/githurev-parse -lang=go1.25 git -C /tmp/shared-actions-test3891476062 rev-parse /usr/bin/git -c=4 -nolocalimports -importcfg 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, .object.type] | @tsv t.go t_test.go ache/go/1.25.8/x64/pkg/tool/linux_amd64/link -p github.com/googlrev-parse -lang=go1.23 ache/go/1.25.8/x64/pkg/tool/linux_amd64/link -uns�� _messages.go _messages_test.go 64/pkg/tool/linux_amd64/compile go1.25.8 -c=4 -nolocalimports 64/pkg/tool/linu-f (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv --show-toplevel ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git vaScript24837813git -trimpath ache/go/1.25.8/x--show-toplevel git rev-�� --show-toplevel ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git -unreachable=falgit /tmp/go-build243rev-parse 8741784/b286/vet--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv tags/v4 git sv ithub-script/gitgit x_amd64/compile bject.type] | @t--show-toplevel git rev-�� --show-toplevel infocmp /usr/bin/git xterm-color l /usr/bin/git 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, .object.type] | @tsv -bool -buildtags /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet =receive -ifaceassert -nilfunc (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv 8741784/b456/_pkg_.a -trimpath 1/x64/bin/node -p github.com/githurev-parse -lang=go1.25 1/x64/bin/node -c 999 git-upload-pack '/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitmain_branch322664335/001' (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv xterm-color (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, .object.type] | @tsv --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu/tmp/go-build2438741784/b114/vet.cfg /usr/bin/git -unreachable=falgit /tmp/go-build243status Name,createdAt,startedAt,updated--show-toplevel git rev-�� --show-toplevel (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, .object.type] | @tsv -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv cli/install.sh..." GO111MODULE x_amd64/asm GOINSECURE GOMOD GOMODCACHE x_amd64/asm env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv -c=4 -nolocalimports -importcfg /tmp/go-build2438741784/b416/importcfg -pack /home/REDACTED/work/gh-aw/gh-aw/pkg/envutil/envutil.go /home/REDACTED/work/gh-aw/gh-aw/pkg/envutil/envutil_test.go env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (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, .object.type] | @tsv --show-toplevel x_amd64/compile /usr/bin/infocmp ortcfg 1y8b/MRa4ogkVnm9rev-parse 64/pkg/tool/linu--show-toplevel infocmp -1 xterm-color 64/pkg/tool/linuremote.origin.url /usr/bin/git plorer.md GO111MODULE 64/pkg/tool/linu--show-toplevel 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, .object.type] | @tsv /tmp/TestGuardPolicyTrustedUsersCompiledOutput3413362225/001 s/4/artifacts /usr/bin/git remote.origin.urgit GO111MODULE x_amd64/vet git -C /tmp/gh-aw-test-runs/20260430-204712-35701/test-2075973966 show /usr/bin/git -json GO111MODULE x_amd64/vet git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv --show-toplevel 64/pkg/tool/linuremote /usr/bin/git LsRemoteWithRealgit LsRemoteWithRealrev-parse x_amd64/compile git rev-�� --show-toplevel x_amd64/compile /usr/bin/git 3214123/b241/_pkgit k-ff/hcoMcb4nJlDrev-parse 64/pkg/tool/linu--show-toplevel git (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv -bool -buildtags /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -errorsas -ifaceassert -nilfunc /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -ato�� licyMinIntegrityOnlymin-integrity_with_repos=public_1525673271/001 -buildtags ache/node/24.14.1/x64/bin/node l -ifaceassert -nilfunc git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv ithub/workflows/artifacts-summary.md -importcfg "warnings":[]}] -s -w -buildmode=exe git add . -extld=gcc /usr/bin/git -json GO111MODULE x_amd64/compile git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv list --json epo.git --repo owner/repo x_amd64/compile git -C s/test.md s/1/artifacts /usr/bin/git -json GO111MODULE x_amd64/vet 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, .object.type] | @tsv /tmp/gh-aw-test-runs/20260430-204712-35701/test-4082803493/.github/workflows remote /usr/bin/git -json GO111MODULE x_amd64/compile git -C /tmp/gh-aw-test-runs/20260430-204712-35701/test-3886344920 rev-parse om/upstream/repo.git -json GO111MODULE x_amd64/vet infocmp (http block)
  • https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv . ache/node/24.14.1/x64/bin/node ules/.bin/git full1.txt 9bf75ebf rgo/bin/git git diff�� --binary (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv . ache/node/24.14.1/x64/bin/node 86_64/git full1.txt 9bf75ebf /home/REDACTED/worgit commit -m 'Initial commit' git init�� -q (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv ithub/workflows herFiles,CFiles,command-line-arguments k.yml l main /go /usr/bin/gh api k/gh-aw/gh-aw -f tor.lock.yml -f owner=github -f /usr/bin/gh (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch .go git 1/x64/bin/node d8f8788473feb08ainfocmp --stdout _modules/.bin/gixterm-color 1/x64/bin/node ve -q tions/setup/js/node_modules/viteowner=github docker-buildx -exist 90ad48f05092a16b-C cal/bin/git docker-buildx (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch k/gh-aw/gh-aw/.gremote.origin.url /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/viteowner=github /tmp/go-build2508590000/b001/exe/text-output l --conditions development /tmp/go-build250rev-parse ings�� ithub/workflows git /opt/hostedtoolcache/node/24.14.-f l ings.cjs es/.bin/git /opt/hostedtoolcshow (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch k/gh-aw/gh-aw/.github/workflows GoFiles,IgnoredGoFiles,IgnoredOtherFiles,CFiles,-export=true 64/bin/bash g_.a test@example.com-1 64/pkg/tool/linuxterm-color git -C k/gh-aw/gh-aw rev-parse docker-buildx test-cwd (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, .object.type] | @tsv --show-toplevel 8n/W7nDXlF-2wrJGconfig /usr/bin/infocmp ortcfg GO111MODULE x_amd64/compile infocmp -1 xterm-color x_amd64/compile /usr/bin/gh 3214123/b178/_pkgit ahb4/lZep-2Miwczrev-parse eutil.test gh (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, .object.type] | @tsv --show-toplevel x_amd64/compile /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -json GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -ato�� -bool -buildtags /usr/bin/git -errorsas -ifaceassert -nilfunc git (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, .object.type] | @tsv /tmp/TestGuardPolicyMinIntegrityOnlymin-integrity_with_explicit_repo52409033/001 remote /usr/bin/git -json GO111MODULE x_amd64/link git -C /tmp/gh-aw-test-runs/20260430-204712-35701/test-963066292/.github/workflows remote me: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -json GO111MODULE x_amd64/vet git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --limit 100 --created >=2026-04-23 GOMOD GOMODCACHE 64/pkg/tool/linutest@example.com env add-source-path-go1.25.8 .cfg 64/pkg/tool/linu-nolocalimports ata/action_pins.git GOMOD GOMODCACHE 64/pkg/tool/linuInitial commit (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --limit 100 --created >=2026-03-31 GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet ortc�� 3214123/b011/_pkg_.a .cfg 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 --limit 100 --created >=2026-01-30 GOMOD GOMODCACHE 64/pkg/tool/linuremote.origin.url ortc�� 3214123/b120/_pkg_.a .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE b/gh-aw/pkg/typemaintenance GOMODCACHE 64/pkg/tool/linu--auto (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 .cfg 64/pkg/tool/linux_amd64/vet GOINSECURE contextprotocol/rev-parse ache/go/1.25.8/x--show-toplevel 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 d2UJ/DbmGN00V4XBV3gqgd2UJ 64/pkg/tool/linux_amd64/compile GOINSECURE g/x/text/transfo/tmp/test-expr-4139360342.js GOMODCACHE 64/pkg/tool/linux_amd64/compile stat�� 609/001/stability-test.md _isA/iz-VlEV3Z-CBIoY6_isA ck GOSUMDB GOWORK 64/bin/go ache/go/1.25.8/x64/pkg/tool/linuremote (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 .cfg x_amd64/vet GOINSECURE /go-yaml/internarun GOMODCACHE x_amd64/vet 4387�� se 8741784/b017/vet100 ache/go/1.25.8/x--created GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuremote.origin.url (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 l_test.go 64/pkg/tool/linux_amd64/compile GOINSECURE b/gh-aw/pkg/typeconfig GOMODCACHE 64/pkg/tool/linutest@example.com (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 .cfg x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 ne_constants.go 64/pkg/tool/linux_amd64/compile GOINSECURE b/gh-aw/pkg/striconfig GOMODCACHE 64/pkg/tool/linuTest User estl�� rdian.md 8741784/b022/vet.cfg ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOINSECURE til GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuremote.origin.url (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 zm1t/ybsydLQ-bM8eUCGDzm1t 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuTest User (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 bYse/Agvt9vB4Z3tFs27lbYse 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/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 .cfg 64/pkg/tool/linux_amd64/link GOINSECURE fips140/mlkem ache/go/1.25.8/x--show-toplevel 64/pkg/tool/linux_amd64/link inst�� util.test EuIi/QLX65JRSUvpCHrYwEuIi k GOSUMDB GOWORK 64/bin/go iUEqf5PFeb3NCkL0nF/2rw-RdHCw_apH02zfbN4/uSkbk2Bo-trimpath (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 x_amd64/compile GOINSECURE boring/bbig ache/go/1.25.8/x--show-toplevel x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 o ache/go/1.25.8/x64/pkg/tool/linu-nolocalimports GOINSECURE g/x/crypto/chachrev-parse GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu/tmp/go-build2438741784/b441/_testmain.go (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 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD 3214123/b006/symabis 64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 QuTc/8J1aAAdvjhK6D-KwQuTc .cfg GOINSECURE g/x/crypto/interinit GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linurev-parse (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 GOMOD GOMODCACHE x_amd64/vet er_b�� g_.a 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 b/gh-aw/pkg/consrev-parse ache/go/1.25.8/x--show-toplevel 64/pkg/tool/linux_amd64/vet env rity1279324409/001 GO111MODULE ache/go/1.25.8/x64/pkg/tool/linu-nilfunc GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuremote.origin.url (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build2438741784/b404/cli.test /tmp/go-build2438741784/b404/cli.test -test.testlogfile=/tmp/go-build2438741784/b404/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (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, .object.type] | @tsv tags/v6 ache/go/1.25.8/x64/pkg/tool/linuremote1 sv 491780106 8741784/b074/vetrev-parse /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/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, .object.type] | @tsv 8741784/b390/_pkg_.a b24G/6nfC8zN5c6kASggpb24G .cfg --format=%H:%ct GOWORK 64/bin/go ache/go/1.25.8/x64/pkg/tool/linuremote -o me.go o 1/x64/bin/node -p crypto/internal/remote -lang=go1.25 ache/go/1.25.8/x64/pkg/tool/linuremote.upstream.url (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, .object.type] | @tsv -json @v1.1.3/base64/base64.go x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env g_.a GO111MODULE x_amd64/vet GOINSECURE essage 64/src/internal//tmp/gh-aw-test-runs/20260430-204712-35701/test-3320409004 x_amd64/vet (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, .object.type] | @tsv -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env g_.a til.go x_amd64/vet GOINSECURE iat abis x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv g_.a GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env g_.a 0/message/catalog/catalog.go x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv iant-3500694449/--exclude-hidden=receive GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet phen�� g_.a 4LOc7tzcC x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (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, .object.type] | @tsv -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet ch_w�� g_.a 0/internal/catmsg/catmsg.go x_amd64/vet GOINSECURE 5519/field 64/src/internal//tmp/TestHashStability_SameInputSameOutput781739609/001/stability-test.md x_amd64/vet (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, .object.type] | @tsv 963066292/.github/workflows --merged=fa60b3e035df6753567c4bc-c=4 ck GOSUMDB b/gh-aw/pkg/agenrev-parse 64/bin/go ache/go/1.25.8/x64/pkg/tool/linu/tmp/go-build2438741784/b456/_testmain.go sRem�� se 8741784/b204/vet.cfg ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -p log/slog/interna-c -lang=go1.25 ache/go/1.25.8/xsh (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 x_amd64/compile 4387�� se 8741784/b047/vet.cfg 64/pkg/tool/linux_amd64/compile -p internal/coveragrev-parse -lang=go1.25 64/pkg/tool/linux_amd64/compile (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 x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD emclr_wasm.s x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/vet GOINSECURE util t0_js_wasm.s x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh workflow list --repo owner/repo --json name,path,state ortcfg.link GOINSECURE GOMOD GOMODCACHE 6lOae4WsPt2nvzZ6yM/kanFXMcb9Ib9j3Zv3h0y/rLzSlIqW^remote\..*\.gh-resolved$ estl�� se 8741784/b084/vet.cfg g_.a -I /tmp/go-build415remote -I ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (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 -json GO111MODULE x_amd64/asm GOINSECURE GOMOD GOMODCACHE x_amd64/asm env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD r_wasm.s x_amd64/vet (http block)
  • https://api.github.com/repos/test/repo
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch se 8741784/b189/vet.cfg ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -p io -lang=go1.25 ache/go/1.25.8/x64/pkg/tool/linu.github/workflows/test.md -o 4712-35701/test-2817595443/.github/workflows -trimpath /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -p crypto/hkdf -lang=go1.25 /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linurev-parse (http block)
  • invalid.example.invalid
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin https://invalid.example.invalid/nonexistent-repo.git e/git init�� ndor/bin/git git ode_modules/.bin/git =receive test@example.com--git-dir=/tmp/bare-incremental-8jC0w5 /git (dns block)

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

…ights

Adds Phase 2b to the copilot-session-insights workflow to detect high-gate
orphaned branches (≥5 simultaneous gate firings, no Copilot agent assigned,
waiting >1 hour) and escalate them in the daily report.

- Uses paginated GitHub API calls to fetch open PRs and in-progress runs
- Computes gate counts per branch via jq group_by (structured data pipeline)
- Joins PR data with gate counts and classifies severity (critical/high/warning)
- Adds Orphaned Branch Escalation Alerts section to the discussion template
- Tracks orphaned rate vs. historical ~40% baseline for elevated-waste detection
- Updates success criteria to include orphan detection and escalation reporting"

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b6a3da23-289a-451a-807d-9f1a1338da27

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Add agent assignment priority for orphaned branches feat(copilot-session-insights): add orphaned branch escalation detection for high-gate CI waste Apr 30, 2026
Copilot AI requested a review from gh-aw-bot April 30, 2026 20:55
@github-actions
Copy link
Copy Markdown
Contributor

Hey @Copilot 👋 — great addition to the copilot-session-insights skill! The orphaned branch escalation detection addresses a real CI waste problem — the context around the 60% orphan rate and 10–11 simultaneous gate jobs burning for hours makes the motivation crystal clear.

One small thing to address before this is fully ready:

  • No test coverage — the new Phase 2b logic (the jq detection pipeline, thresholds, and escalation severity classification) has no accompanying test. Even a lightweight fixture-based unit test (e.g., feeding known open-prs.json + active-runs.json stubs through the jq query and asserting the output shape and severity labels) would give reviewers confidence the logic is correct — especially the edge cases around the 1h/2h wait-time boundaries and the ≥5/≥10 gate thresholds.

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

Add a unit test for the orphaned branch escalation detection logic introduced in .github/workflows/copilot-session-insights.md (Phase 2b).

Create a test fixture under test/ (or the appropriate test directory for this repo) that:
1. Provides a stub open-prs.json with at least 3 PRs:
   - One with ≥10 active gate runs, no copilot-swe-agent assigned, created >2 hours ago → expect severity: "critical"
   - One with 5–9 active gate runs, no agent assigned, created 1–2 hours ago → expect severity: "warning"
   - One with ≥5 gate runs but copilot-swe-agent IS assigned → expect it to be excluded
2. Provides a matching stub active-runs.json with the corresponding in-progress workflow run entries.
3. Runs the jq command from Phase 2b against these stubs and asserts the output matches the expected escalation records (pr_number, severity, recommended_action).

Follow the existing test patterns in the repo (check the Makefile targets test-unit / test for guidance).

Generated by Contribution Check · ● 1.1M ·

@pelikhan pelikhan marked this pull request as ready for review April 30, 2026 21:43
Copilot AI review requested due to automatic review settings April 30, 2026 21:43
@pelikhan pelikhan merged commit 25d123f into main Apr 30, 2026
19 checks passed
@pelikhan pelikhan deleted the copilot/deep-report-add-agent-assignment-priority branch April 30, 2026 21:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an “orphaned branch escalation” signal to the Copilot session insights workflow documentation to surface high CI gate waste on open PR branches that lack a Copilot agent assignment.

Changes:

  • Introduces a new Phase 2b with GitHub API data collection (open PRs + in-progress runs) and a jq-based join to produce orphan-escalations.json.
  • Adds a Discussion template section for “Orphaned Branch Escalation Alerts” including severity tiers and waste estimation fields.
  • Updates success criteria to include orphan detection/escalation reporting and historical baseline comparison.
Show a summary per file
File Description
.github/workflows/copilot-session-insights.md Documents the Phase 2b orphan escalation pipeline, adds report template content, and extends success criteria to cover escalation reporting and baseline comparison.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (2)

.github/workflows/copilot-session-insights.md:340

  • The alert section summary says branches must be unassigned for ">2 hours", but Phase 2b escalation logic also includes a 1–2 hour "warning" tier. Update this description to reflect the full threshold set (e.g., ">1 hour" or enumerate the tiers) to avoid contradicting the logic.
## Orphaned Branch Escalation Alerts 🚨

> Branches with ≥5 simultaneous gate firings and no Copilot agent assigned for >2 hours.

.github/workflows/copilot-session-insights.md:578

  • Success criteria mentions detecting orphaned branches with no agent for ">2 hours", but Phase 2b logic escalates starting at ">1 hour" (warning tier). Align the success criteria wording with the implemented thresholds so it's clear what's required.
- ✅ Detected orphaned branches with ≥5 gate firings and no agent for >2 hours
- ✅ Reported escalation alerts in the "Orphaned Branch Escalation Alerts" section
  • Files reviewed: 1/1 changed files
  • Comments generated: 4

--arg two_hours_ago "$TWO_HOURS_AGO" \
--arg one_hour_ago "$ONE_HOUR_AGO" '
# Build a map of branch -> gate_count from in-progress runs
($runs[0] | group_by(.branch) | map({key: .[0].branch, value: length}) | from_entries) as $gate_counts |
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

jq's group_by(.branch) requires the input array to be sorted by the same key; without a preceding sort_by(.branch) the computed gate counts can be incorrect (and therefore misclassify/omit escalations). Sort the runs by .branch before group_by, or switch to a reduce-based counting approach that doesn't require sorting.

Suggested change
($runs[0] | group_by(.branch) | map({key: .[0].branch, value: length}) | from_entries) as $gate_counts |
($runs[0] | sort_by(.branch) | group_by(.branch) | map({key: .[0].branch, value: length}) | from_entries) as $gate_counts |

Copilot uses AI. Check for mistakes.
severity: $severity,
assignees: $pr.assignees,
recommended_action: (if $severity == "critical" then "immediate manual review"
else "priority agent assignment" end)
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

recommended_action currently returns "priority agent assignment" for both high and warning severities, but the thresholds section defines warning as "monitor closely". Align the generated recommended_action with the severity definitions (e.g., make warning recommend monitoring rather than assignment).

This issue also appears in the following locations of the same file:

  • line 338
  • line 577
Suggested change
else "priority agent assignment" end)
elif $severity == "high" then "priority agent assignment"
else "monitor closely" end)

Copilot uses AI. Check for mistakes.

### CI Waste Estimate

- **Orphaned gate-hours today**: [N] gate × [Xh] ≈ [N] CI-minutes wasted
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

The CI waste estimate mixes units: "gate × [Xh]" yields gate-hours, but the text says it's "CI-minutes". Either convert hours to minutes (×60) or rename the result to CI-hours/gate-hours so the units are consistent.

Suggested change
- **Orphaned gate-hours today**: [N] gate × [Xh][N] CI-minutes wasted
- **Orphaned gate-hours today**: [N] gate × [Xh][N] gate-hours wasted

Copilot uses AI. Check for mistakes.
Comment on lines +233 to +240
**Historical Comparison**:
- Compare today's orphaned rate against the historical baseline (~40%) stored in cache memory.
- If today's rate exceeds 50%, flag as an elevated waste pattern.
- Save orphan metrics to cache for trend tracking:
```bash
mkdir -p /tmp/gh-aw/cache-memory/session-analysis/
# Append today's orphan stats to history.json (see cache memory management section)
```
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

The historical comparison section refers to a baseline "stored in cache memory" and to appending orphan stats to history.json, but this file/path and expected schema aren’t defined anywhere else in this workflow. Specify the exact cache file location/name and the fields to persist/read so the agent can implement the comparison consistently.

Copilot uses AI. Check for mistakes.
@github-actions github-actions Bot mentioned this pull request Apr 30, 2026
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.

[deep-report] Add agent assignment priority for high-gate orphaned branches to reduce CI waste

4 participants