Skip to content

feat(ambient-context): trim prompt size in daily-code-metrics, test-quality-sentinel, smoke-copilot-aoai-entra#41960

Merged
pelikhan merged 2 commits into
mainfrom
copilot/ambient-context-optimize-daily-metrics
Jun 27, 2026
Merged

feat(ambient-context): trim prompt size in daily-code-metrics, test-quality-sentinel, smoke-copilot-aoai-entra#41960
pelikhan merged 2 commits into
mainfrom
copilot/ambient-context-optimize-daily-metrics

Conversation

Copilot AI commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Three workflows account for the largest first-request sizes in the daily ambient context audit (26k, 22k, and 16k chars respectively). This PR removes redundant inline content that duplicates shared imports or can be pre-computed deterministically outside the AI sandbox.

daily-code-metrics.md (−1,979 chars, 13.2%)

  • Removed direct shared/python-dataviz.md import — already transitively included via shared/trends.md, causing the content to be injected twice
  • Replaced 40-line "Python Script Structure" boilerplate code block (full imports + skeleton) with a 4-line note; the setup is already documented in python-dataviz.md
  • Removed "Chart Quality Standards" and "Chart Upload and Embedding" sections — both fully covered by python-dataviz.md's existing guidance

test-quality-sentinel.md (agent body −880 chars)

Moved deterministic shell work out of the agent body into the pre-fetch steps: block (runs outside the AI sandbox, zero tokens consumed):

  • Pre-extracts new Go/JS test function signatures (go-new-test-funcs.txt, js-new-test-funcs.txt) via grep on the already-fetched test diff
  • Pre-checks newly added Go test files for missing //go:build tags → missing-build-tags.txt
  • Simplified Step 1 and Step 2 bash blocks in the agent body to file-path references instead of repeating the shell commands
  • Updated go-test-analyzer sub-agent to read missing-build-tags.txt instead of re-running git diff — removes the ${{ github.event.pull_request.base.sha }} reference from the agent body that was no longer needed

smoke-copilot-aoai-entra.md (−1,000 chars, 8.5%)

Condensed the "Tool Access Overview" section from 15 lines to 2 lines. The per-tool CLI invocation patterns (playwright, serena, safeoutputs, etc.) are restated from system-injected <mcp-clis> context; only the essential tool→CLI mapping is kept.

…-quality-sentinel, smoke-copilot-aoai-entra

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize Python boilerplate in daily code metrics feat(ambient-context): trim prompt size in daily-code-metrics, test-quality-sentinel, smoke-copilot-aoai-entra Jun 27, 2026
Copilot AI requested a review from pelikhan June 27, 2026 22:53
@pelikhan pelikhan marked this pull request as ready for review June 27, 2026 22:59
Copilot AI review requested due to automatic review settings June 27, 2026 22:59
@pelikhan pelikhan merged commit 89e70ea into main Jun 27, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/ambient-context-optimize-daily-metrics branch June 27, 2026 22:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces first-request prompt size for several gh-aw agent workflows by removing redundant inline guidance and moving deterministic preprocessing out of the agent prompt body and into workflow steps: that run outside the AI sandbox.

Changes:

  • daily-code-metrics: removes duplicated imports / boilerplate chart guidance and replaces it with pointers to the shared python-dataviz guidance (still included transitively via shared/trends.md).
  • test-quality-sentinel: precomputes test-function signatures and missing Go build-tag findings during the pre-fetch step, and updates the agent body to reference the pre-fetched files.
  • smoke-copilot-aoai-entra: condenses the CLI-proxy tool access explanation while keeping the key tool→invocation mapping.
Show a summary per file
File Description
.github/workflows/test-quality-sentinel.md Moves deterministic parsing work into steps: and trims repeated shell snippets from the agent body.
.github/workflows/test-quality-sentinel.lock.yml Regenerated compiled workflow reflecting the updated pre-fetch step and prompt text.
.github/workflows/daily-code-metrics.md Trims redundant chart/script boilerplate and removes a duplicate direct import.
.github/workflows/daily-code-metrics.lock.yml Regenerated compiled workflow reflecting the daily-code-metrics prompt changes.
.github/workflows/smoke-copilot-aoai-entra.md Condenses CLI-proxy tool access overview text.
.github/workflows/smoke-copilot-aoai-entra.lock.yml Regenerated compiled workflow reflecting the updated prompt text.
.github/workflows/smoke-otel-backends.lock.yml Regenerated compiled workflow (includes GH_AW_LABEL_COMMANDS env wiring).
.github/workflows/smoke-copilot.lock.yml Regenerated compiled workflow (includes GH_AW_LABEL_COMMANDS env wiring).
.github/workflows/smoke-copilot-sdk.lock.yml Regenerated compiled workflow (includes GH_AW_LABEL_COMMANDS env wiring).
.github/workflows/smoke-copilot-aoai-apikey.lock.yml Regenerated compiled workflow (includes GH_AW_LABEL_COMMANDS env wiring).
.github/workflows/necromancer.lock.yml Regenerated compiled workflow (includes GH_AW_LABEL_COMMANDS env wiring).
.github/workflows/dev.lock.yml Regenerated compiled workflow (includes GH_AW_LABEL_COMMANDS env wiring).
.github/workflows/cloclo.lock.yml Regenerated compiled workflow (includes GH_AW_LABEL_COMMANDS env wiring).
.github/workflows/ci-doctor.lock.yml Regenerated compiled workflow (includes GH_AW_LABEL_COMMANDS env wiring).
.github/workflows/approach-validator.lock.yml Regenerated compiled workflow (includes GH_AW_LABEL_COMMANDS env wiring).

Review details

Tip

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

  • Files reviewed: 15/15 changed files
  • Comments generated: 1
  • Review effort level: Low

if [ -s /tmp/gh-aw/agent/test-diff.txt ]; then
grep -E "^\+func Test" /tmp/gh-aw/agent/test-diff.txt \
> /tmp/gh-aw/agent/go-new-test-funcs.txt || true
grep -E "^\+(it|test|describe)\(" /tmp/gh-aw/agent/test-diff.txt \
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.

3 participants