Skip to content

chore: optimize test-coverage-improver workflow for ~50% token reduction#2238

Merged
lpcox merged 3 commits intomainfrom
copilot/optimize-copilot-tokens-again
Apr 27, 2026
Merged

chore: optimize test-coverage-improver workflow for ~50% token reduction#2238
lpcox merged 3 commits intomainfrom
copilot/optimize-copilot-tokens-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

test-coverage-improver was spending ~46 LLM turns and ~2M tokens/run running npm ci + build + coverage interactively, then exploring the filesystem broadly. This pre-computes all deterministic work and narrows tool access.

Changes

  • Pre-compute build pipeline in steps:npm cinpm run buildnpm run test:coverage run before the agent starts; coverage JSON, COVERAGE_SUMMARY.md, and files-below-80% list are injected directly into the prompt via step outputs, eliminating ~10–15 LLM turns of build churn

  • Restrict GitHub toolsets[default] (~22 tools) → [repos, pull_requests]; removes ~10 unused tool schemas from every request (~330K tokens/run)

  • Tighten bash allowlist — replaced broad cat:*/ls:*/npm run:* with path-scoped patterns (cat:src/*.ts, cat:tests/**, ls:src, etc.) to prevent unfocused filesystem exploration

  • Reorder prompt for prefix cache efficiency — stable sections (Repository Context, Guidelines, Test Quality Criteria, Do Not rules) moved before dynamic coverage data; pushes the stable ~4K-char prefix into Anthropic's cache on every run, targeting cache hit rate improvement from ~49% → ~65–70%+

Expected impact

Metric Before Target
Tokens/run ~2,009K ~900–1,100K
LLM turns 46 ~20–25
Cache hit rate ~49% ~65–70%
Session time 7.9 min ~4–5 min

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
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq .object.sha (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0.68.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.68.3 --jq .object.sha (http block)

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

Copilot AI changed the title [WIP] Optimize tokens for test coverage improver chore: optimize test-coverage-improver workflow for ~50% token reduction Apr 27, 2026
Copilot AI requested a review from lpcox April 27, 2026 15:25
@lpcox lpcox marked this pull request as ready for review April 27, 2026 15:48
@lpcox lpcox requested a review from Mossaka as a code owner April 27, 2026 15:48
Copilot AI review requested due to automatic review settings April 27, 2026 15:48
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

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 test-coverage-improver agentic workflow to reduce runtime tokens/turns by precomputing deterministic work (install/build/coverage) and restricting agent tooling/shell access.

Changes:

  • Adds pre-steps intended to run npm ci, npm run build, and npm run test:coverage, then inject coverage artifacts into the prompt via step outputs.
  • Restricts GitHub toolsets to [repos, pull_requests] and tightens the bash allowlist to specific paths/commands.
  • Regenerates the compiled .lock.yml workflow and updates the actions lock entries.
Show a summary per file
File Description
.github/workflows/test-coverage-improver.md Adds pre-steps + prompt sections intended to include precomputed coverage; tightens tool allowlists.
.github/workflows/test-coverage-improver.lock.yml Regenerated compiled workflow to include the new steps/tool restrictions and prompt interpolation wiring.
.github/aw/actions-lock.json Removes some pinned action entries (notably gh-aw-actions setup/setup-cli).

Copilot's findings

Tip

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

Comments suppressed due to low confidence (5)

.github/workflows/test-coverage-improver.md:91

  • node -e ... prints to STDOUT but is not redirected into $GITHUB_OUTPUT, so steps.low-coverage.outputs.LOW_COVERAGE will be empty. Capture the Node script output (and the fallback message) and append it to $GITHUB_OUTPUT between the heredoc markers.
      echo "LOW_COVERAGE<<EOF" >> $GITHUB_OUTPUT
      node -e "
        const d = JSON.parse(require('fs').readFileSync('coverage/coverage-summary.json', 'utf8'));
        const low = Object.entries(d)
          .filter(([k, v]) => k !== 'total' && v.statements.pct < 80)
          .sort((a, b) => a[1].statements.pct - b[1].statements.pct);
        if (low.length === 0) { console.log('All files are above 80% coverage.'); }
        else { low.forEach(([k, v]) => console.log(k + ' — ' + v.statements.pct + '%')); }
      " 2>/dev/null || echo "(coverage summary not available)"

.github/aw/actions-lock.json:62

  • These action pin entries for github/gh-aw-actions/setup(-cli)@v0.71.1 were removed from the lock, but multiple workflows in this repo still reference github/gh-aw-actions/setup@... / setup-cli@... (e.g. .github/workflows/agentics-maintenance.yml, various *.lock.yml). Keeping .github/aw/actions-lock.json aligned with actual workflow usages is important for reproducible upgrades/compiles; please either restore the removed entries or update the workflows to stop using those actions.
    "docker/setup-buildx-action@v4.0.0": {
      "repo": "docker/setup-buildx-action",
      "version": "v4.0.0",
      "sha": "4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd"
    },
    "github/gh-aw/actions/setup@v0.69.3": {
      "repo": "github/gh-aw/actions/setup",
      "version": "v0.69.3",
      "sha": "6abd7107cebd8b300f4d64013201ad2d8e0a994f"
    },

.github/workflows/test-coverage-improver.lock.yml:384

  • LOW_COVERAGE is being written using a heredoc marker, but the Node script output is not redirected into $GITHUB_OUTPUT, so steps.low-coverage.outputs.LOW_COVERAGE will be empty. Capture the script output (and fallback message) and append it to $GITHUB_OUTPUT between the markers.
      - id: low-coverage
        name: List files below 80% coverage
        run: "echo \"LOW_COVERAGE<<EOF\" >> $GITHUB_OUTPUT\nnode -e \"\n  const d = JSON.parse(require('fs').readFileSync('coverage/coverage-summary.json', 'utf8'));\n  const low = Object.entries(d)\n    .filter(([k, v]) => k !== 'total' && v.statements.pct < 80)\n    .sort((a, b) => a[1].statements.pct - b[1].statements.pct);\n  if (low.length === 0) { console.log('All files are above 80% coverage.'); }\n  else { low.forEach(([k, v]) => console.log(k + ' — ' + v.statements.pct + '%')); }\n\" 2>/dev/null || echo \"(coverage summary not available)\"\necho \"EOF\" >> $GITHUB_OUTPUT"

.github/workflows/test-coverage-improver.lock.yml:381

  • COVERAGE_MD is intended as a step output, but the cat ... || echo ... output isn't appended to $GITHUB_OUTPUT, so steps.coverage-md.outputs.COVERAGE_MD will be empty. Append the command output to $GITHUB_OUTPUT between the heredoc markers.
        name: Read COVERAGE_SUMMARY.md
        run: |
          echo "COVERAGE_MD<<EOF" >> $GITHUB_OUTPUT
          cat COVERAGE_SUMMARY.md 2>/dev/null || echo "(COVERAGE_SUMMARY.md not found)"
          echo "EOF" >> $GITHUB_OUTPUT

.github/workflows/test-coverage-improver.md:78

  • Same issue as above: the cat COVERAGE_SUMMARY.md ... || echo ... command doesn't append to $GITHUB_OUTPUT, so steps.coverage-md.outputs.COVERAGE_MD will be empty. Append the command output to $GITHUB_OUTPUT so it becomes part of the output value.
      echo "COVERAGE_MD<<EOF" >> $GITHUB_OUTPUT
      cat COVERAGE_SUMMARY.md 2>/dev/null || echo "(COVERAGE_SUMMARY.md not found)"
      echo "EOF" >> $GITHUB_OUTPUT
  • Files reviewed: 3/3 changed files
  • Comments generated: 6

Comment on lines +1 to +2
# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"3e3da1351f418290092cf2b0774fc26553dee5c79df96d0e704446f71892e390","compiler_version":"v0.68.3","strict":true,"agent_id":"copilot"}
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/setup-node","sha":"53b83947a5a98c8d113130e565377fae1a50d02f","version":"v6.3.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"v0.68.3","version":"v0.68.3"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.20","digest":"sha256:9161f2415a3306a344aca34dd671ee69f122317e0a512e66dc64c94b9c508682","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.25.20@sha256:9161f2415a3306a344aca34dd671ee69f122317e0a512e66dc64c94b9c508682"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20","digest":"sha256:6971639e381e82e45134bcd333181f456df3a52cd6f818a3e3d6de068ff91519","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20@sha256:6971639e381e82e45134bcd333181f456df3a52cd6f818a3e3d6de068ff91519"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.20","digest":"sha256:5411d903f73ee597e6a084971c2adef3eb0bd405910df3ed7bf5e3d6bd58a236","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.25.20@sha256:5411d903f73ee597e6a084971c2adef3eb0bd405910df3ed7bf5e3d6bd58a236"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.2.19","digest":"sha256:44d4d8de7e6c37aaea484eba489940c52df6a0b54078ddcbc9327592d5b3c3dd","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.2.19@sha256:44d4d8de7e6c37aaea484eba489940c52df6a0b54078ddcbc9327592d5b3c3dd"},{"image":"ghcr.io/github/github-mcp-server:v0.32.0","digest":"sha256:2763823c63bcca718ce53850a1d7fcf2f501ec84028394f1b63ce7e9f4f9be28","pinned_image":"ghcr.io/github/github-mcp-server:v0.32.0@sha256:2763823c63bcca718ce53850a1d7fcf2f501ec84028394f1b63ce7e9f4f9be28"},{"image":"node:lts-alpine","digest":"sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f","pinned_image":"node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f"}]}
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

In the generated manifest, github/gh-aw-actions/setup has sha: "v0.68.3", which is not a commit SHA and defeats the purpose of pinning (and may break any tooling expecting a 40-hex SHA). Regenerate the lock so the manifest pins github/gh-aw-actions/setup@v0.68.3 to its actual commit SHA (as other workflows do).

Copilot uses AI. Check for mistakes.
Comment on lines +162 to +164
GH_AW_EXPR_4E3B1F6D: ${{ steps.coverage-summary.outputs.COVERAGE_JSON }}
GH_AW_EXPR_998C0DF8: ${{ steps.low-coverage.outputs.LOW_COVERAGE }}
GH_AW_EXPR_BCB09072: ${{ steps.coverage-md.outputs.COVERAGE_MD }}
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

The activation job builds/interpolates the prompt using steps.coverage-* outputs, but those coverage steps are defined in the agent job (later in the workflow). As a result, these expressions will resolve to empty strings during activation and the prompt won't include the pre-computed coverage data. Move the coverage collection steps into the activation job before prompt rendering, or defer prompt interpolation/substitution until after the coverage steps have run.

Suggested change
GH_AW_EXPR_4E3B1F6D: ${{ steps.coverage-summary.outputs.COVERAGE_JSON }}
GH_AW_EXPR_998C0DF8: ${{ steps.low-coverage.outputs.LOW_COVERAGE }}
GH_AW_EXPR_BCB09072: ${{ steps.coverage-md.outputs.COVERAGE_MD }}

Copilot uses AI. Check for mistakes.
Comment on lines +373 to +381
echo "COVERAGE_JSON<<EOF" >> $GITHUB_OUTPUT
cat coverage/coverage-summary.json
echo "EOF" >> $GITHUB_OUTPUT
- id: coverage-md
name: Read COVERAGE_SUMMARY.md
run: |
echo "COVERAGE_MD<<EOF" >> $GITHUB_OUTPUT
cat COVERAGE_SUMMARY.md 2>/dev/null || echo "(COVERAGE_SUMMARY.md not found)"
echo "EOF" >> $GITHUB_OUTPUT
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

This workflow step intends to export COVERAGE_JSON, but cat coverage/coverage-summary.json writes to STDOUT instead of $GITHUB_OUTPUT, so the output will be empty. Append the file contents to $GITHUB_OUTPUT between the heredoc markers.

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

  • line 377
  • line 382
Suggested change
echo "COVERAGE_JSON<<EOF" >> $GITHUB_OUTPUT
cat coverage/coverage-summary.json
echo "EOF" >> $GITHUB_OUTPUT
- id: coverage-md
name: Read COVERAGE_SUMMARY.md
run: |
echo "COVERAGE_MD<<EOF" >> $GITHUB_OUTPUT
cat COVERAGE_SUMMARY.md 2>/dev/null || echo "(COVERAGE_SUMMARY.md not found)"
echo "EOF" >> $GITHUB_OUTPUT
{
echo "COVERAGE_JSON<<EOF"
cat coverage/coverage-summary.json
echo "EOF"
} >> "$GITHUB_OUTPUT"
- id: coverage-md
name: Read COVERAGE_SUMMARY.md
run: |
{
echo "COVERAGE_MD<<EOF"
cat COVERAGE_SUMMARY.md 2>/dev/null || echo "(COVERAGE_SUMMARY.md not found)"
echo "EOF"
} >> "$GITHUB_OUTPUT"

Copilot uses AI. Check for mistakes.
{"add_comment":{"max":1,"target":"*"},"create_pull_request":{"draft":true,"max":1,"max_patch_size":1024,"protected_files":["package.json","bun.lockb","bunfig.toml","deno.json","deno.jsonc","deno.lock","global.json","NuGet.Config","Directory.Packages.props","mix.exs","mix.lock","go.mod","go.sum","stack.yaml","stack.yaml.lock","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","package-lock.json","yarn.lock","pnpm-lock.yaml","npm-shrinkwrap.json","requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","Gemfile","Gemfile.lock","uv.lock","CODEOWNERS","DESIGN.md","AGENTS.md","CLAUDE.md","GEMINI.md"],"protected_path_prefixes":[".github/",".agents/",".githooks/",".husky/"],"title_prefix":"[Test Coverage] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}}
GH_AW_SAFE_OUTPUTS_CONFIG_6715fb4237626891_EOF
cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_b63d66120918967c_EOF'
{"add_comment":{"max":1,"target":"*"},"create_pull_request":{"draft":true,"max":1,"max_patch_size":1024,"protected_files":["package.json","bun.lockb","bunfig.toml","deno.json","deno.jsonc","deno.lock","global.json","NuGet.Config","Directory.Packages.props","mix.exs","mix.lock","go.mod","go.sum","stack.yaml","stack.yaml.lock","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","package-lock.json","yarn.lock","pnpm-lock.yaml","npm-shrinkwrap.json","requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","Gemfile","Gemfile.lock","uv.lock","CODEOWNERS"],"protected_path_prefixes":[".github/",".agents/"],"title_prefix":"[Test Coverage] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}}
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

The Safe Outputs protection set is significantly reduced here (e.g., .husky/ and CLAUDE.md are no longer protected), even though .husky/ and CLAUDE.md exist in this repo. That’s a security regression because it would allow an automated agent PR to modify commit hooks / agent instruction files. Re-add the previously protected path prefixes/files (at least .husky/ and CLAUDE.md) unless there’s a strong reason to relax them.

Suggested change
{"add_comment":{"max":1,"target":"*"},"create_pull_request":{"draft":true,"max":1,"max_patch_size":1024,"protected_files":["package.json","bun.lockb","bunfig.toml","deno.json","deno.jsonc","deno.lock","global.json","NuGet.Config","Directory.Packages.props","mix.exs","mix.lock","go.mod","go.sum","stack.yaml","stack.yaml.lock","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","package-lock.json","yarn.lock","pnpm-lock.yaml","npm-shrinkwrap.json","requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","Gemfile","Gemfile.lock","uv.lock","CODEOWNERS"],"protected_path_prefixes":[".github/",".agents/"],"title_prefix":"[Test Coverage] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}}
{"add_comment":{"max":1,"target":"*"},"create_pull_request":{"draft":true,"max":1,"max_patch_size":1024,"protected_files":["package.json","bun.lockb","bunfig.toml","deno.json","deno.jsonc","deno.lock","global.json","NuGet.Config","Directory.Packages.props","mix.exs","mix.lock","go.mod","go.sum","stack.yaml","stack.yaml.lock","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","package-lock.json","yarn.lock","pnpm-lock.yaml","npm-shrinkwrap.json","requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","Gemfile","Gemfile.lock","uv.lock","CODEOWNERS","CLAUDE.md"],"protected_path_prefixes":[".github/",".agents/",".husky/"],"title_prefix":"[Test Coverage] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}}

Copilot uses AI. Check for mistakes.
Comment on lines +249 to +257
```
${{ steps.coverage-md.outputs.COVERAGE_MD }}
```

Good tests should:
- ✅ Test one specific behavior
- ✅ Have descriptive names
- ✅ Include edge cases
- ✅ Cover error handling
- ✅ Be deterministic (no flaky tests)
- ✅ Run quickly (mock external dependencies)
### Coverage JSON (full)

## Do Not
```json
${{ steps.coverage-summary.outputs.COVERAGE_JSON }}
```
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

The prompt embeds ${{ steps.coverage-*.outputs.* }} values. Those expressions only resolve if the referenced steps run in the same job before the prompt is rendered/interpolated. In the compiled workflow, the prompt is rendered in the activation job, so ensure the coverage steps execute in activation (or change when/where interpolation occurs), otherwise these sections will render empty.

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +92
echo "COVERAGE_JSON<<EOF" >> $GITHUB_OUTPUT
cat coverage/coverage-summary.json
echo "EOF" >> $GITHUB_OUTPUT

- name: Read COVERAGE_SUMMARY.md
id: coverage-md
run: |
echo "COVERAGE_MD<<EOF" >> $GITHUB_OUTPUT
cat COVERAGE_SUMMARY.md 2>/dev/null || echo "(COVERAGE_SUMMARY.md not found)"
echo "EOF" >> $GITHUB_OUTPUT

- name: List files below 80% coverage
id: low-coverage
run: |
echo "LOW_COVERAGE<<EOF" >> $GITHUB_OUTPUT
node -e "
const d = JSON.parse(require('fs').readFileSync('coverage/coverage-summary.json', 'utf8'));
const low = Object.entries(d)
.filter(([k, v]) => k !== 'total' && v.statements.pct < 80)
.sort((a, b) => a[1].statements.pct - b[1].statements.pct);
if (low.length === 0) { console.log('All files are above 80% coverage.'); }
else { low.forEach(([k, v]) => console.log(k + ' — ' + v.statements.pct + '%')); }
" 2>/dev/null || echo "(coverage summary not available)"
echo "EOF" >> $GITHUB_OUTPUT
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

The step is attempting to set a multi-line output, but cat coverage/coverage-summary.json writes to STDOUT rather than appending to $GITHUB_OUTPUT, so steps.coverage-summary.outputs.COVERAGE_JSON will be empty. Redirect/append the file contents into $GITHUB_OUTPUT between the heredoc markers.

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

  • line 76
  • line 83
Suggested change
echo "COVERAGE_JSON<<EOF" >> $GITHUB_OUTPUT
cat coverage/coverage-summary.json
echo "EOF" >> $GITHUB_OUTPUT
- name: Read COVERAGE_SUMMARY.md
id: coverage-md
run: |
echo "COVERAGE_MD<<EOF" >> $GITHUB_OUTPUT
cat COVERAGE_SUMMARY.md 2>/dev/null || echo "(COVERAGE_SUMMARY.md not found)"
echo "EOF" >> $GITHUB_OUTPUT
- name: List files below 80% coverage
id: low-coverage
run: |
echo "LOW_COVERAGE<<EOF" >> $GITHUB_OUTPUT
node -e "
const d = JSON.parse(require('fs').readFileSync('coverage/coverage-summary.json', 'utf8'));
const low = Object.entries(d)
.filter(([k, v]) => k !== 'total' && v.statements.pct < 80)
.sort((a, b) => a[1].statements.pct - b[1].statements.pct);
if (low.length === 0) { console.log('All files are above 80% coverage.'); }
else { low.forEach(([k, v]) => console.log(k + ' — ' + v.statements.pct + '%')); }
" 2>/dev/null || echo "(coverage summary not available)"
echo "EOF" >> $GITHUB_OUTPUT
{
echo "COVERAGE_JSON<<EOF"
cat coverage/coverage-summary.json
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Read COVERAGE_SUMMARY.md
id: coverage-md
run: |
{
echo "COVERAGE_MD<<EOF"
cat COVERAGE_SUMMARY.md 2>/dev/null || echo "(COVERAGE_SUMMARY.md not found)"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: List files below 80% coverage
id: low-coverage
run: |
{
echo "LOW_COVERAGE<<EOF"
node -e "
const d = JSON.parse(require('fs').readFileSync('coverage/coverage-summary.json', 'utf8'));
const low = Object.entries(d)
.filter(([k, v]) => k !== 'total' && v.statements.pct < 80)
.sort((a, b) => a[1].statements.pct - b[1].statements.pct);
if (low.length === 0) { console.log('All files are above 80% coverage.'); }
else { low.forEach(([k, v]) => console.log(k + ' — ' + v.statements.pct + '%')); }
" 2>/dev/null || echo "(coverage summary not available)"
echo "EOF"
} >> "$GITHUB_OUTPUT"

Copilot uses AI. Check for mistakes.
@github-actions

This comment has been minimized.

@lpcox
Copy link
Copy Markdown
Collaborator

lpcox commented Apr 27, 2026

@copilot address the review feedback on .md files and ignore feedback on .lock.yml files #2238 (review)

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot address the review feedback on .md files and ignore feedback on .lock.yml files #2238 (review)

Fixed in 38fec97. The three output steps now use { ... } >> "$GITHUB_OUTPUT" grouped heredoc syntax so that cat and node -e stdout is correctly captured into the output variable rather than being discarded.

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
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq .object.sha (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0.68.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.68.3 --jq .object.sha (http block)

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

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test Results

✅ GitHub MCP: Last 2 merged PRs retrieved

  • feat: optimize Pelis Agent Factory Advisor to reduce token usage ~50%
  • fix: ensure Node.js is available in copilot-setup-steps for GPU runners

✅ Playwright: github.com page title verified
✅ File Writing: Test file created successfully
✅ Bash Tool: File verified with content

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

ALL CLONES FAILEDgh CLI is not authenticated (GH_TOKEN not set). All 8 ecosystem repositories could not be cloned.

Ecosystem Project Build/Install Tests Status
Bun elysia N/A ❌ CLONE_FAILED
Bun hono N/A ❌ CLONE_FAILED
C++ fmt N/A ❌ CLONE_FAILED
C++ json N/A ❌ CLONE_FAILED
Deno oak N/A ❌ CLONE_FAILED
Deno std N/A ❌ CLONE_FAILED
.NET hello-world N/A ❌ CLONE_FAILED
.NET json-parse N/A ❌ CLONE_FAILED
Go color N/A ❌ CLONE_FAILED
Go env N/A ❌ CLONE_FAILED
Go uuid N/A ❌ CLONE_FAILED
Java gson N/A ❌ CLONE_FAILED
Java caffeine N/A ❌ CLONE_FAILED
Node.js clsx N/A ❌ CLONE_FAILED
Node.js execa N/A ❌ CLONE_FAILED
Node.js p-limit N/A ❌ CLONE_FAILED
Rust fd N/A ❌ CLONE_FAILED
Rust zoxide N/A ❌ CLONE_FAILED

Overall: 0/8 ecosystems passed — ❌ FAIL

Error: gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable.

All gh repo clone commands failed because GH_TOKEN is not set in the environment. To fix this, ensure the workflow sets GH_TOKEN before running build tests.

Generated by Build Test Suite for issue #2238 · ● 141.3K ·

@github-actions
Copy link
Copy Markdown
Contributor

Merged PRs: feat: optimize Pelis Agent Factory Advisor to reduce token usage ~50%; fix: ensure Node.js is available in copilot-setup-steps for GPU runners
Queried PRs: chore: optimize test-coverage-improver workflow for ~50% token reduction; [Test Coverage] Add comprehensive tests for image-tag module
GitHub merged review: ✅
safeinputs-gh query: ❌
Playwright: ✅
Tavily search: ❌
File write/read: ✅
Discussion interaction: ✅
Build: ✅
Overall: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Offline) Mode

Test Result
GitHub MCP connectivity ✅ (fetched merged PR: "feat: optimize Pelis Agent Factory Advisor...")
GitHub.com HTTP ⚠️ N/A (pre-step template vars not expanded)
File write/read ⚠️ N/A (pre-step template vars not expanded)
BYOK inference (agent → api-proxy → api.githubcopilot.com)

Running in BYOK offline mode (COPILOT_OFFLINE=true) via api-proxy → api.githubcopilot.com.
Author: @Copilot · Assignees: @lpcox, @Copilot

Overall: PASS (core BYOK path verified; pre-step data unavailable due to unexpanded template vars)

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test Results

  • ❌ Redis (host.docker.internal:6379): no response / timeout
  • ❌ PostgreSQL pg_isready (host.docker.internal:5432): no response
  • ❌ PostgreSQL SELECT 1: no response

Overall: FAILhost.docker.internal is unreachable from this runner environment. Service containers are not accessible.

🔌 Service connectivity validated by Smoke Services

@lpcox lpcox merged commit 767da74 into main Apr 27, 2026
61 of 65 checks passed
@lpcox lpcox deleted the copilot/optimize-copilot-tokens-again branch April 27, 2026 16:24
@github-actions
Copy link
Copy Markdown
Contributor

🔥 Smoke Test Results

Test Status
GitHub MCP (list_pull_requests)
GitHub.com connectivity
File write/read

Overall: PASS

Latest PR: #2238 — chore: optimize test-coverage-improver workflow for ~50% token reduction by @Copilot · assignees: @lpcox, @Copilot

📰 BREAKING: Report filed by Smoke Copilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⚡ Copilot Token Optimization2026-04-27 — Weekly Test Coverage Improver

3 participants