Harden test-coverage-improver prompt injection and trim unused tool surface#4204
Conversation
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
Coverage comparison generated by |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR tightens the test-coverage-improver agentic workflow to reduce wasted tokens and make prompt-context injection failures visible in logs, while also narrowing the GitHub MCP tool surface to what the workflow actually uses.
Changes:
- Remove the GitHub MCP
pull_requeststoolset usage and assert the reduced tool surface via workflow tests. - Add
TARGET_TEST_FILEoutput and a “Verify injected context” step to fail fast when injected outputs are unexpectedly empty. - Update the workflow prompt to discourage broad test-file glob reads and guide targeted Jest reruns.
Show a summary per file
| File | Description |
|---|---|
| scripts/ci/test-coverage-improver-workflow.test.ts | Updates assertions to lock in the reduced toolsets, new injected outputs, verification step, and prompt guidance. |
| .github/workflows/test-coverage-improver.md | Removes pull_requests toolset, adds TARGET_TEST_FILE, adds injected-context verification, and tightens prompt instructions to keep reruns targeted. |
| .github/workflows/test-coverage-improver.lock.yml | Regenerated compiled workflow carrying new outputs/verification step/toolset changes (plus compiler/version-driven regeneration changes). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 2
| - name: Setup Scripts | ||
| id: setup | ||
| uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 | ||
| uses: github/gh-aw-actions/setup@v0.77.5 | ||
| with: | ||
| destination: ${{ runner.temp }}/gh-aw/actions |
| GH_AW_SKILL_DIR: ".github/skills" | ||
| run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_skills.sh" | ||
| - name: Download container images | ||
| run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.55 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55 ghcr.io/github/gh-aw-firewall/squid:0.25.55 ghcr.io/github/gh-aw-mcpg:v0.3.19 ghcr.io/github/github-mcp-server:v1.0.4@sha256:e3816a476a977cfb836e7d221510011436c654d11861db66ecfd826601aba6a4 node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f | ||
| run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.58 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.58 ghcr.io/github/gh-aw-firewall/squid:0.25.58 ghcr.io/github/gh-aw-mcpg:v0.3.22 ghcr.io/github/github-mcp-server:v1.1.0 node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f | ||
| - name: Generate Safe Outputs Config |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@copilot address review feedback |
Addressed the review feedback in commit |
Smoke Test Results (Claude)
Total: PASS
|
🔥 Smoke Test: Copilot BYOK (Offline) Mode
Note: Running in BYOK offline mode ( PR author: Overall: PARTIAL — BYOK inference and MCP ✅; pre-step output injection broken for tests 2 & 3.
|
🧪 Smoke Test Results
Overall: PASS PR by
|
|
Merged PRs:\n- refactor(api-proxy): extract duplicate collectLogOutput() into shared test helper\n- [Test Coverage] container-lifecycle.ts branch coverage\nChecks:\n- GitHub title check: ✅\n- Smoke file: ✅\n- Build: ✅\n- Discussion note: ✅\nOverall: PASS 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.
|
Gemini Engine Smoke Test Results
Overall Status: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test: GitHub Actions Services Connectivity
Overall: FAIL — service containers are not reachable from this environment.
|
test-coverage-improverwas paying avoidable token cost because pre-step outputs were rendering as empty strings in the prompt, forcing the agent to rediscover and reread the target file. This change makes injection failures explicit, removes unused GitHub tool surface, and tightens the prompt so reruns stay targeted.Fail fast on broken prompt injection
Verify injected contextstep after target/content selection.TARGET_FILE,TARGET_TEST_FILE,SOURCE_CONTENT,TEST_CONTENT,COVERAGE_MD, andLOW_COVERAGEbefore the agent runs.Reduce loaded tool surface
pull_requeststoolset from the workflow.repostoolset, which matches actual usage.Constrain test-reading and rerun behavior
TARGET_TEST_FILEas an explicit step output for the selected module’s test path.src/*.test.tsreads.npm run testto final verification only.Recompiled workflow artifacts
test-coverage-improver.lock.ymlto carry the new outputs, verification step, and prompt updates.