Skip to content

Token optimization: auto-triage-issues workflow#26247

Merged
pelikhan merged 2 commits intomainfrom
copilot/copilot-token-optimizer-auto-triage-issues
Apr 14, 2026
Merged

Token optimization: auto-triage-issues workflow#26247
pelikhan merged 2 commits intomainfrom
copilot/copilot-token-optimizer-auto-triage-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

The auto-triage workflow was burning 268K–1M tokens/run due to three compounding inefficiencies: fetching a 120–125KB list_issues payload the agent couldn't parse, ~60 failed search_repositories calls per run adding error noise to the context, and ~50% of agent turns spent on data-gathering that could be done deterministically.

Changes

  • Model downgrade: copilot (default) → gpt-4.1-mini; pure read-only keyword classification doesn't need a frontier model
  • Pre-agent bash step: pre-fetches unlabeled issues via gh api into /tmp/gh-aw/agent/unlabeled-issues.json before the agent starts, eliminating the data-gathering turns entirely
  • Scheduled run instructions: read from pre-fetched file first; fall back to search_issues with no:label (not list_issues) if file is missing or empty []
  • Suppress search_repositories: explicit instruction added — this tool isn't in the issues toolset but Claude was calling it 59–60 times per run, each returning an error into the context window
  • Bash allow-list: added cat * so the agent can read the pre-fetched JSON
steps:
  pre-agent:
    - name: Fetch unlabeled issues
      run: |
        mkdir -p /tmp/gh-aw/agent
        gh api "repos/github/gh-aw/issues?state=open&labels=&per_page=30" \
          --jq '[.[] | select(.labels | length == 0) | {number: .number, title: .title, body: .body}]' \
          > /tmp/gh-aw/agent/unlabeled-issues.json
        echo "Unlabeled issues: $(jq length /tmp/gh-aw/agent/unlabeled-issues.json)"

Estimated savings: ~400–800K tokens/run across the 8 daily scheduled runs.

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 (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 scripts/**/*.js 64/bin/go go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 github.com/githu/home/REDACTED/.npm/_npx/b388654678d519d9/node_modules/.bin/prettier -lang=go1.25 go env h ../../../.pret.prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 ithub/workflows rev-parse repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } ithub/workflows rev-parse r: $owner, name:-unreachable=false infocmp -1 xterm-color git repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } /home/REDACTED/wor/tmp/go-build3621377140/b406/constants.test show repository(owne-test.paniconexit0 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 --get remote.origin.url /usr/bin/git pload-artifact/ggit .cfg 64/pkg/tool/linu--show-toplevel /usr/bin/git remo�� -v 64/pkg/tool/linu-1 /usr/bin/git /repos/githubnexgit erena-mcp-serverrev-parse 64/pkg/tool/linu--show-toplevel 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 --show-toplevel git /usr/bin/infocmp e=false show /usr/bin/git infocmp -1 xterm-color git /opt/hostedtoolcache/node/24.14.1/x64/bin/node ithub/workflows rev-parse x_amd64/vet node (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 8/001/test-complex-frontmatter-with-tools.md 1377140/b048/vet.cfg ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet ithub/workflows git $name) { hasxterm-color ache/go/1.25.8/x64/pkg/tool/linu--auto (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git k/gh-aw/gh-aw config 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/git se 1377140/b020/vetrev-parse .cfg git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel /opt/hostedtoolcache/go/1.25.8/x1 /usr/bin/git -unreachable=falgit /tmp/go-build362rev-parse /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu/home/REDACTED/work/gh-aw/gh-aw/scripts/lint_errorrev-parse /usr/bin/git k/gh-aw/gh-aw/.ggit -buildtags /opt/hostedtoolc--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 ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git se 1377140/b005/vet^From [0-9a-f]\{40\} .cfg git rev-�� --show-toplevel ache/go/1.25.8/x4 /usr/bin/git 01/main.md 1377140/b204/vetrev-parse ache/go/1.25.8/x--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 ithub/workflows git er: String!, $name: String!) { repository(owne-f data/action_pins/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet show DiscussionsEnabl-unreachable=false git -C ithub/workflows show repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } ithub/workflows show repository(owne-bool infocmp (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq .object.sha ithub/workflows rev-parse repository(owne-nilfunc ithub/workflows ghcr.io/github/s-o repository(owne/tmp/go-build3621377140/b406/constants.test infocmp -1 ithub/workflows git x_amd64/compile ithub/workflows rev-parse r: $owner, name:--symref x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq .object.sha k/gh-aw/gh-aw show lock.yml k/gh-aw/gh-aw --jq lock.yml git -C ithub/workflows config x_amd64/vet remote.origin.urgh config /usr/bin/git x_amd64/vet (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 r: $owner, name:--show-toplevel x_amd64/vet /usr/bin/git rity3327457183/0git rev-parse x_amd64/vet git rev-�� --show-toplevel x_amd64/vet 1377140/b451/vet.cfg k/gh-aw/gh-aw/.ggit show 64/pkg/tool/linu--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha install --package-lock-only /usr/bin/git --git-dir x_amd64/vet /usr/bin/git git rev-�� --show-toplevel git /usr/bin/ls kflows/issue-trigit 64/pkg/tool/linurev-parse (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 1377140/b452/_pkg_.a myorg 1377140/b452=> go1.25.8 -c=4 -nolocalimports git rev-�� 2dE7/G74ZWDFluB_K3ff12dE7 /tmp/go-build3621377140/b455/_testmain.go /usr/bin/git k/gh-aw/gh-aw rev-parse 64/pkg/tool/linu--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha install --package-lock-only /usr/bin/git /home/REDACTED/worgit x_amd64/vet /usr/bin/git git rev-�� --show-toplevel git /usr/bin/sed --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git sed (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 sistency_GoAndJavaScript667766628/001/test-empty-frontmatter.md -trimpath /usr/lib/git-core/git -p main -lang=go1.25 /usr/lib/git-core/git --gi�� ErrorFormatting3365621466/001 --format=%(objectname) /usr/bin/git go1.25.8 -c=4 -nolocalimports 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 prettier --check 64/bin/go --ignore-path .prettierignore 64/bin/go go env ath ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sed (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha --check scripts/**/*.js modules/@npmcli/run-script/lib/node-gyp-bin/node .prettierignore scripts/**/*.js 64/bin/go go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v7 --jq .object.sha --check scripts/**/*.js 64/bin/go -d scripts/**/*.js 64/bin/go go env -json GO111MODULE /sh GOINSECURE GOMOD GOMODCACHE go (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 h ../../../.pret.prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env w/js/**/*.json' --ignore-path GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha h ../../../.pret.prettierignore 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/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha ithub/workflows GO111MODULE nfig/composer/vendor/bin/sh GOINSECURE GOMOD GOMODCACHE go env rite '../../../**/*.json' '!../../../pkg/workflow/js/**/*.json' --ignore-path GO111MODULE repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/docker/build-push-action/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v7 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ode_�� -json GO111MODULE ache/go/1.25.8/x-f GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v7 --jq .object.sha -json GO111MODULE $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go ode_�� -json GO111MODULE r: $owner, name:-f GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v7 --jq .object.sha k/gh-aw/gh-aw/.g-f --ignore-path /home/node_modul-f --log-level=erro/usr/bin/gh GO111MODULE 64/bin/go node /hom�� k/gh-aw/gh-aw ../../../**/*.jsowner=github ature-coverage.l-f --ignore-path ../../../.pretti-C DiscussionsEnabl/home/REDACTED/work/gh-aw/gh-aw docker (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 v1.0.0 remote.origin.url /usr/bin/git repo1326080345/0git rev-parse x_amd64/vet git rev-�� --git-dir x_amd64/vet /usr/bin/git xterm-color infocmp 64/pkg/tool/linu--show-toplevel 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 -stringintconv -tests ache/node/24.14.1/x64/bin/node ithub/workflows -f kflows/smoke-mul--show-toplevel infocmp t-24�� bility_SameInputSameOutput1453837517/001/stability-test.md git /usr/bin/git pload-artifact/ggit show me: String!) { --show-toplevel 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 --show-toplevel -tests /usr/bin/git k/gh-aw/gh-aw/.ggit config /usr/bin/git /usr/bin/git conf�� --get-regexp ^remote\..*\.gh-resolved$ /usr/bin/gh ithub/workflows rev-parse er: String!, $na--show-toplevel 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 config x_amd64/link remote.origin.urgit config ml x_amd64/link -C /home/REDACTED/work/gh-aw/gh-aw/.github/workflows go .cfg ithub/workflows rev-parse DiscussionsEnabl--show-toplevel dT/7Y_Y9Edui35POZLyjuWD/EdibnIjyElfKEpT_XrgG (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 show 64/pkg/tool/linux_amd64/vet l show /usr/bin/git 64/pkg/tool/linux_amd64/vet -C k/gh-aw/gh-aw/.github/workflows rev-parse .cfg k/gh-aw/gh-aw/.ggit rev-parse r.lock.yml ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (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 64/pkg/tool/linu-nolocalimports remote.origin.urgit config gent-analysis.louser.email 64/pkg/tool/linutest@example.com -C ithub/workflows config x_amd64/link l config /usr/bin/git x_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 .cfg 64/pkg/tool/linux_amd64/vet ithub/workflows ghcr.io/github/sinit (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 64/pkg/tool/linux_amd64/vet k/gh-aw/gh-aw/.ggit show $name) { has--git-dir 64/pkg/tool/linux_amd64/vet -C ithub/workflows o 64/pkg/tool/linux_amd64/compile k/gh-aw/gh-aw show (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 show 64/pkg/tool/linux_amd64/vet ithub/workflows show DiscussionsEnabl--show-toplevel 64/pkg/tool/linux_amd64/vet -C /home/REDACTED/work/gh-aw/gh-aw/.github/workflows rev-parse 64/pkg/tool/linux_amd64/compile /home/REDACTED/wornode rev-parse $name) { has/home/REDACTED/work/gh-aw/gh-aw/.github/workflows/archie.md 64/pkg/tool/linux_amd64/compile (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 rev-parse 64/pkg/tool/linux_amd64/vet it/ref/tags/v7 rev-parse $name) { has--show-toplevel 64/pkg/tool/linux_amd64/vet -C 2890406473 show 64/pkg/tool/linux_amd64/compile ithub/workflows show kflows/weekly-is--git-dir 64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 rev-parse 64/pkg/tool/linux_amd64/vet it/ref/tags/v7 rev-parse kflows/smoke-tes--show-toplevel 64/pkg/tool/linux_amd64/vet -C 1104796663/.github/workflows show k /home/REDACTED/worgit show l-instrumentatio--show-toplevel ache/go/1.25.8/x64/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 config 64/pkg/tool/linux_amd64/vet remote.origin.urgit config me: String!) { --show-toplevel 64/pkg/tool/linux_amd64/vet -C 2890406473 rev-parse x_amd64/vet k/gh-aw/gh-aw/.ggit rev-parse me: String!) { --show-toplevel x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 config 64/pkg/tool/linu-nolocalimports remote.origin.urgit config $name) { has-pack 64/pkg/tool/linu/tmp/go-build3621377140/b449/_testmain.go -C /home/REDACTED/work/gh-aw/gh-aw/.g-s config ck remote.origin.urgit config me: String!) { -f ache/go/1.25.8/x64/pkg/tool/linu-extld=gcc (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 show 64/pkg/tool/linux_amd64/vet /home/REDACTED/wornode show r: $owner, name:/home/REDACTED/work/gh-aw/gh-aw/.github/workflows/agent-performance-analyzer.md 64/pkg/tool/linux_amd64/vet -C 2890406473 config 64/pkg/tool/linux_amd64/vet l config /usr/bin/git 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 .cfg 64/pkg/tool/linux_amd64/vet -f owner=github -f 64/pkg/tool/linux_amd64/vet -C k/gh-aw/gh-aw/.github/workflows config ache/go/1.25.8/x64/pkg/tool/linu-nilfunc l config r: $owner, name:--show-toplevel ache/go/1.25.8/x64/pkg/tool/linu-tests (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 show 64/pkg/tool/linux_amd64/vet l show (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 config 64/pkg/tool/linux_amd64/vet remote.origin.urgit config (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path 129429547/001' 129429547/001' kflows/weekly-editors-health-check.lock.yml k/gh-aw/gh-aw :latest kflows/weekly-is-bool git -C ithub/workflows config /usr/bin/git l config ed } } git (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 config r: $owner, name:. x_amd64/vet -1 ithub/workflows git x_amd64/vet ithub/workflows show repository(owne--show-toplevel 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 erena-mcp-serverrev-parse repository(owne--show-toplevel 64/pkg/tool/linux_amd64/vet api k/gh-aw/gh-aw/.github/workflows .cfg 64/pkg/tool/linux_amd64/vet l owner=github DiscussionsEnabl--show-toplevel 64/pkg/tool/linux_amd64/vet (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 /home/REDACTED/worgit rev-parse ache/go/1.25.8/x--show-toplevel git rev-�� --show-toplevel ache/go/1.25.8/x64/pkg/tool/linu-test.v=true /usr/bin/git efaultBranchFrom/bin/sh efaultBranchFrom-c .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 edOutput3335473176/001 .cfg 64/pkg/tool/linux_amd64/link k/gh-aw/gh-aw :latest DiscussionsEnabl/home/REDACTED/work/gh-aw/gh-aw/.github/workflows/approach-validator.md 64/pkg/tool/linux_amd64/link (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 k/gh-aw/gh-aw/.g-errorsas config x_amd64/vet l -f r: $owner, name:. x_amd64/vet api graphql -f x_amd64/vet -f owner=github -f 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 ithub/workflows ghcr.io/github/s-ifaceassert x_amd64/vet ithub/workflows -f er: String!, $narun x_amd64/vet -C k/gh-aw/gh-aw/.g--detach rev-parse x_amd64/vet l rev-parse (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha /home/REDACTED/wor-errorsas :latest x_amd64/link /home/REDACTED/worinfocmp :latest r: $owner, name:xterm-color x_amd64/link -C k/gh-aw/gh-aw config x_amd64/vet remote.origin.urgit config DiscussionsEnabl--show-toplevel 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 graphql -f x_amd64/vet -f owner=github ed } } x_amd64/vet -C /home/REDACTED/wor-errorsas config x_amd64/vet remote.origin.urgit /usr/libexec/doc-C lock.yml 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 ithub/workflows -f x_amd64/vet -f owner=github -f x_amd64/vet -C ithub/workflows rev-parse x_amd64/vet ithub/workflows -f er: String!, $na/repos/actions/github-script/git/ref/tags/v9 x_amd64/vet (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/-
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/- --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env json' --ignore-path ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/- --jq .object.sha -json :latest rkflow/js/**/*.json /../../.prettiergit erignore GOMODCACHE sh -c ithub/workflows GOPROXY r.lock.yml GOSUMDB GOWORK ed } } sh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/- --jq .object.sha k/gh-aw/gh-aw show ion-check.lock.yml json' --ignore-pgit GO111MODULE node git -C ithub/workflows config /usr/bin/git remote.origin.urgit GO111MODULE odules/npm/node_/home/REDACTED/work/gh-aw/gh-aw/.github/workflows 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 k/gh-aw/gh-aw/.github/workflows .cfg 64/pkg/tool/linux_amd64/vet l infocmp /usr/bin/git 64/pkg/tool/linux_amd64/vet (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 k/gh-aw/gh-aw/.ggit show l 64/pkg/tool/linutest@example.com /opt�� view .cfg ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet name -- e-output-integra--show-toplevel ache/go/1.25.8/x64/pkg/tool/linuremote (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 ti-device-docs-tester.lock.yml remote.origin.ur/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet config ti-device-docs-t-bool gh api ithub/workflows --jq /usr/bin/git ithub/workflows node /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo ml k/gh-aw/gh-aw -f ed } } ker/cli-plugins/-buildtags n-me�� /repos/docker/bu-errorsas --jq yml xterm-color node $name) { hasuser.name git (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build3621377140/b397/cli.test /tmp/go-build3621377140/b397/cli.test -test.testlogfile=/tmp/go-build3621377140/b397/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true k/gh-aw/gh-aw/.g/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet rev-parse /usr/bin/git infocmp -1 ithub/workflows git kflows/weekly-blog-post-writer.l-f ithub/workflows show kflows/weekly-ed-bool /usr/bin/gh (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 29429547/001' 29429547/001' -nolocalimports -importcfg /tmp/go-build3621377140/b397/importcfg -pack /tmp/go-build3621377140/b397/_testmain.go -C ithub/workflows rev-parse (http block)

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

- Downgrade model to gpt-4.1-mini (pure read-only classification task)
- Add pre-agent bash step to pre-fetch unlabeled issues into JSON file
- Update scheduled run instructions to read pre-fetched data first,
  falling back to search_issues with no:label instead of list_issues
- Add explicit instruction to not call search_repositories (not available,
  was causing ~60 failed calls per run bloating context window)
- Add cat * to allowed bash tools for reading pre-fetched JSON file
- Clarify when issue_read is needed vs using pre-fetched data

Estimated savings: ~400-800K tokens/run

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/f7627b1c-236b-44a6-b26d-7aff1ccfb8e0

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize token usage for auto-triage issues Token optimization: auto-triage-issues workflow Apr 14, 2026
Copilot AI requested a review from pelikhan April 14, 2026 16:21
@pelikhan pelikhan marked this pull request as ready for review April 14, 2026 16:25
Copilot AI review requested due to automatic review settings April 14, 2026 16:25
@pelikhan pelikhan merged commit 9511205 into main Apr 14, 2026
52 of 53 checks passed
@pelikhan pelikhan deleted the copilot/copilot-token-optimizer-auto-triage-issues branch April 14, 2026 16:25
This was referenced 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

Optimizes the scheduled auto-triage workflow to reduce token consumption by pre-fetching unlabeled issues deterministically, switching to a smaller model, and tightening agent instructions to avoid noisy/unsupported tool calls.

Changes:

  • Downgrade Copilot model to gpt-4.1-mini for read-only issue classification.
  • Add a pre-agent fetch of unlabeled issues into /tmp/gh-aw/agent/unlabeled-issues.json and update scheduled-run instructions to use it first.
  • Explicitly instruct the agent not to call search_repositories, and allow cat * so the agent can read the pre-fetched JSON.
Show a summary per file
File Description
.github/workflows/auto-triage-issues.md Updates engine model, adds pre-agent fetch configuration, and adjusts agent instructions/tool allowlist.
.github/workflows/auto-triage-issues.lock.yml Regenerates compiled workflow to reflect model/allowlist changes and the attempted pre-agent step injection.

Copilot's findings

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 4

Comment on lines +37 to +39
run: |
mkdir -p /tmp/gh-aw/agent
gh api "repos/github/gh-aw/issues?state=open&labels=&per_page=30" \
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 pre-agent fetch step does not set GH_TOKEN/GITHUB_TOKEN. On github.com runners, configure_gh_for_ghe.sh does not authenticate gh, so this gh api ... call is likely to run unauthenticated (or fail/rate-limit). Also, without an explicit GH_TOKEN in the pre-agent step, the compiler’s DIFC proxy injection for integrity filtering won’t trigger even though min-integrity: approved is configured. Add the appropriate token env vars on this step (and preferably rely on $GITHUB_REPOSITORY rather than hard-coding github/gh-aw).

Suggested change
run: |
mkdir -p /tmp/gh-aw/agent
gh api "repos/github/gh-aw/issues?state=open&labels=&per_page=30" \
env:
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
run: |
mkdir -p /tmp/gh-aw/agent
gh api "repos/$GITHUB_REPOSITORY/issues?state=open&labels=&per_page=30" \

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +42
pre-agent:
- name: Fetch unlabeled issues
run: |
mkdir -p /tmp/gh-aw/agent
gh api "repos/github/gh-aw/issues?state=open&labels=&per_page=30" \
--jq '[.[] | select(.labels | length == 0) | {number: .number, title: .title, body: .body}]' \
> /tmp/gh-aw/agent/unlabeled-issues.json
echo "Unlabeled issues: $(jq length /tmp/gh-aw/agent/unlabeled-issues.json)"
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 frontmatter steps: block is using a nested pre-agent: key, but the compiler appears to treat steps: as the pre-agent step list already. This structure is producing a malformed compiled workflow (see auto-triage-issues.lock.yml where pre-agent: ends up inside a GitHub Actions step). Convert this to the supported format (make steps: a plain array of step objects) and re-run gh aw compile so the generated lock file is valid.

Suggested change
pre-agent:
- name: Fetch unlabeled issues
run: |
mkdir -p /tmp/gh-aw/agent
gh api "repos/github/gh-aw/issues?state=open&labels=&per_page=30" \
--jq '[.[] | select(.labels | length == 0) | {number: .number, title: .title, body: .body}]' \
> /tmp/gh-aw/agent/unlabeled-issues.json
echo "Unlabeled issues: $(jq length /tmp/gh-aw/agent/unlabeled-issues.json)"
- name: Fetch unlabeled issues
run: |
mkdir -p /tmp/gh-aw/agent
gh api "repos/github/gh-aw/issues?state=open&labels=&per_page=30" \
--jq '[.[] | select(.labels | length == 0) | {number: .number, title: .title, body: .body}]' \
> /tmp/gh-aw/agent/unlabeled-issues.json
echo "Unlabeled issues: $(jq length /tmp/gh-aw/agent/unlabeled-issues.json)"

Copilot uses AI. Check for mistakes.
Comment on lines +354 to +361
pre-agent:
- name: Fetch unlabeled issues
run: |
mkdir -p /tmp/gh-aw/agent
gh api "repos/github/gh-aw/issues?state=open&labels=&per_page=30" \
--jq '[.[] | select(.labels | length == 0) | {number: .number, title: .title, body: .body}]' \
> /tmp/gh-aw/agent/unlabeled-issues.json
echo "Unlabeled issues: $(jq length /tmp/gh-aw/agent/unlabeled-issues.json)"
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 compiled workflow is invalid here: pre-agent: is nested inside the - name: Configure gh CLI for GitHub Enterprise step, and the following - name: Fetch unlabeled issues is mis-indented. GitHub Actions will fail to parse this YAML (and the fetch step will not run). This should be regenerated after fixing the .md frontmatter steps format so the fetch is emitted as a normal step in the steps: list.

Suggested change
pre-agent:
- name: Fetch unlabeled issues
run: |
mkdir -p /tmp/gh-aw/agent
gh api "repos/github/gh-aw/issues?state=open&labels=&per_page=30" \
--jq '[.[] | select(.labels | length == 0) | {number: .number, title: .title, body: .body}]' \
> /tmp/gh-aw/agent/unlabeled-issues.json
echo "Unlabeled issues: $(jq length /tmp/gh-aw/agent/unlabeled-issues.json)"
- name: Fetch unlabeled issues
run: |
mkdir -p /tmp/gh-aw/agent
gh api "repos/github/gh-aw/issues?state=open&labels=&per_page=30" \
--jq '[.[] | select(.labels | length == 0) | {number: .number, title: .title, body: .body}]' \
> /tmp/gh-aw/agent/unlabeled-issues.json
echo "Unlabeled issues: $(jq length /tmp/gh-aw/agent/unlabeled-issues.json)"

Copilot uses AI. Check for mistakes.
run: |
mkdir -p /tmp/gh-aw/agent
gh api "repos/github/gh-aw/issues?state=open&labels=&per_page=30" \
--jq '[.[] | select(.labels | length == 0) | {number: .number, title: .title, body: .body}]' \
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.

gh api repos/.../issues returns both issues and pull requests. The current jq filter only checks for labels | length == 0, so unlabeled PRs can be included in /tmp/gh-aw/agent/unlabeled-issues.json and then triaged/labeled as if they were issues. Update the jq filter (or API path) to explicitly exclude items with a pull_request field, or switch to a search that enforces is:issue.

Suggested change
--jq '[.[] | select(.labels | length == 0) | {number: .number, title: .title, body: .body}]' \
--jq '[.[] | select((.pull_request | not) and (.labels | length == 0)) | {number: .number, title: .title, body: .body}]' \

Copilot uses AI. Check for mistakes.
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.

[copilot-token-optimizer] Token Optimization: Auto-Triage Issues

3 participants