Optimize test-coverage-improver prompt/tool shape to reduce Copilot token burn#3954
Conversation
test-coverage-improver prompt/tool shape to reduce Copilot token burn
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
Coverage comparison generated by |
Smoke Test: Claude Engine
Result: PASS
|
There was a problem hiding this comment.
Pull request overview
Optimizes the test-coverage-improver workflow to cut Copilot token/turn usage by deterministically pre-selecting a low-coverage target file and injecting both its source and current test file into the prompt, while trimming the agent's bash tool surface and replacing the multi-phase prompt with a tight ≤10-call task block. The CI guard test is updated to enforce the new shape.
Changes:
- Adds a
Select target file and inject contentstep that picks a priority file and exposesTARGET_FILE/SOURCE_CONTENT/TEST_CONTENT. - Removes per-file
cat:/ls:exploration tools from the agent allow-list and replaces the multi-phase prompt with a Turn Budget + pre-selected target block. - Updates the workflow guard test to assert the new step, prompt strings, and reduced tool list (both in
.mdand compiled.lock.yml).
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/test-coverage-improver.md | Adds target-selection step, trims tools, rewrites prompt with injected source/test content and Turn Budget. |
| .github/workflows/test-coverage-improver.lock.yml | Recompiled lock reflecting new step, env wiring of steps.target.outputs.*, and reduced --allow-tool list (also includes some unrelated re-compile diffs: sparse-checkout, local awf build, session-state copy). |
| scripts/ci/test-coverage-improver-workflow.test.ts | Updates assertions to require the new step/prompt markers and forbid the removed tool/phase strings. |
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
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.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
🔥 Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( Overall: PASS — PR by
|
🔥 Smoke Test Results
PR: "Optimize Overall: PARTIAL — MCP test passed; pre-computed test data was not injected into the workflow.
|
|
[Test Coverage] Cover uncovered branches in cli-workflow runMainWorkflow ✅ 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.
|
|
Smoke test passed 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 —
|
test-coverage-improverwas spending too many turns on exploratory file reads, driving high token usage. This change makes target selection deterministic in pre-steps, injects source/test context directly into the prompt, and tightens agent instructions to reduce turn count and schema overhead.Precompute and inject target context
Select target file and inject contentstep to choose a priority low-coverage file fromcoverage/coverage-summary.json.TARGET_FILE,SOURCE_CONTENT, andTEST_CONTENTas step outputs for direct prompt injection.Reduce bash tool surface
cat:andls:exploration tools previously used for discovery.cat:src/*.test.ts, jest config reads) plusnpm run test/npm run lint.Tighten prompt for low-turn execution
≤ 10 tool calls).Keep optimization enforced in CI guard test
scripts/ci/test-coverage-improver-workflow.test.tsto assert:cat:/ls:entries and old phase text are absent