optimize(firewall-issue-dispatcher): reduce token usage#2300
Conversation
- Reduce comments query from first:100 to first:10 (10x data reduction) - Remove labels from GraphQL response (already filtered in query) - Cap tracking issue body at 200 words (prevent verbose outputs) - Add 'No extra reads' guideline (prevent AGENTS.md file reads) - Add 'Don't retry without diagnosing' guideline - Recompile lock file with gh aw compile (also pins updated actions/github-script SHA) Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/8bf32321-13f8-40e2-8d41-ce4bf4666b64 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( PR author: Overall: PARTIAL PASS (BYOK inference ✅, pre-step smoke data template vars unresolved
|
Smoke TestPR titles: Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
There was a problem hiding this comment.
Pull request overview
Reduces token usage in the Firewall Issue Dispatcher agentic workflow by shrinking the GraphQL payload and tightening prompt instructions, then recompiling the corresponding lock workflow.
Changes:
- Reduce GraphQL response size by fetching fewer issue comments and removing label nodes from the query.
- Update the workflow prompt to discourage extra file reads (e.g., AGENTS.md) and constrain tracking issue verbosity.
- Recompile the lock workflow, updating pinned action SHAs and incorporating compiler output changes (cron offset, sparse-checkout, AWF install step changes).
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/firewall-issue-dispatcher.md | Adjusts the data-fetching query and prompt guidelines to reduce tokens and avoid unnecessary reads. |
| .github/workflows/firewall-issue-dispatcher.lock.yml | Recompiled workflow reflecting the .md changes plus updated action pins and workflow generation changes. |
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: 3
| else | ||
| echo "No session state found at $SESSION_STATE_SRC" | ||
| fi | ||
| run: bash "${RUNNER_TEMP}/gh-aw/actions/copy_copilot_session_state.sh" |
| @@ -52,8 +52,7 @@ gh api graphql -f query=' | |||
| title | |||
| body | |||
| url | |||
| labels(first: 10) { nodes { name } } | |||
| comments(first: 100) { | |||
| comments(first: 10) { | |||
| nodes { author { login } body } | |||
| (umask 177 && touch /tmp/gh-aw/agent-stdio.log) | ||
| # shellcheck disable=SC1003 | ||
| sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --session-state-dir /tmp/gh-aw/sandbox/agent/session-state --enable-host-access --allow-host-ports 80,443,8080 --build-local --enable-api-proxy \ | ||
| sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --image-tag 0.25.29 --skip-pull --enable-api-proxy \ |
|
Smoke Test Results ✅ GitHub MCP: Listed 2 merged PRs
✅ Playwright: GitHub page title verified Status: PASS
|
🔥 Smoke Test Results
Overall: PASS PR author:
|
The Firewall Issue Dispatcher averages 581K tokens/run (886K peak), driven by over-fetching comment data and triggering expensive
AGENTS.mdreads on every invocation.Changes
comments(first: 100)→comments(first: 10)— we only need early comments to detect an existing dispatch link; 90+ comments were being fetched needlesslylabels(first: 10)from the response — labels are already a query filter parameter, returning them adds tokens with zero value"See AGENTS.md for component descriptions"instruction and added an explicit"No extra reads"guideline — this was causing the agent to read the fullAGENTS.md(~6 KB) on every run"Don't retry without diagnosing"guideline per the efficiency best practices flagged in the token reportgh aw compile(also picks up updatedactions/github-scriptSHA pin and compiler-scattered cron offset)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/repos/actions/github-script/git/ref/tags/v9/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv(http block)If you need me to access, download, or install something from one of these locations, you can either: