fix: reduce Smoke Copilot context size to fix safe_outputs#539
fix: reduce Smoke Copilot context size to fix safe_outputs#539
Conversation
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
✅ Coverage Check PassedOverall Coverage
Coverage comparison generated by |
|
Smoke Test Results: PASS Last 2 merged PRs:
✅ GitHub MCP: Retrieved PR data successfully Overall: PASS
|
e02fc20 to
ab9b9b8
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes the Smoke Copilot workflow where the safe_outputs job was always skipping because Copilot CLI was overwhelmed by excessive context (~1M tokens from full repository). The fix involves a two-step approach: removing explicit checkout steps from the source .md file to let the compiler generate a sparse checkout, then using a postprocess script to convert the sparse checkout to full checkout (needed for building), and finally adding a cleanup step that removes source files after the build, reducing context to ~200k tokens.
Changes:
- Remove explicit checkout steps from
smoke-copilot.mdto let compiler generate sparse checkout by default - Add logic to
postprocess-smoke-workflows.tsto convert sparse checkout to full checkout and add workspace cleanup step - Update
smoke-copilot.lock.ymlwith full checkout, local build steps, workspace cleanup, and version bumps (0.13.5→0.13.6, v0.0.99→v0.0.103)
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.github/workflows/smoke-copilot.md |
Removed explicit steps: block to allow compiler to generate sparse checkout by default |
scripts/ci/postprocess-smoke-workflows.ts |
Added logic to convert sparse checkout to full checkout and conditionally add workspace cleanup step for smoke-copilot workflow |
.github/workflows/smoke-copilot.lock.yml |
Compiled workflow with full checkout, local build steps, workspace cleanup, and updated container versions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| `${scriptIndent}# Remove source code to reduce Copilot CLI context size`, | ||
| `${scriptIndent}# Keep only .github, .agents, dist, node_modules (needed for awf binary)`, | ||
| `${scriptIndent}cd "$GITHUB_WORKSPACE"`, | ||
| `${scriptIndent}find . -maxdepth 1 -not -name '.' -not -name '.github' -not -name '.agents' -not -name 'dist' -not -name 'node_modules' -not -name '.git' | xargs rm -rf`, |
There was a problem hiding this comment.
The find | xargs rm command doesn't properly handle filenames with spaces or special characters. Consider using find ... -print0 | xargs -0 rm -rf or find ... -delete for robustness. While the current command should work for typical repository files, using null-delimited output is a safer best practice.
| `${scriptIndent}find . -maxdepth 1 -not -name '.' -not -name '.github' -not -name '.agents' -not -name 'dist' -not -name 'node_modules' -not -name '.git' | xargs rm -rf`, | |
| `${scriptIndent}find . -maxdepth 1 -not -name '.' -not -name '.github' -not -name '.agents' -not -name 'dist' -not -name 'node_modules' -not -name '.git' -print0 | xargs -0 rm -rf`, |
|
💫 TO BE CONTINUED... Smoke Claude was cancelled! Our hero faces unexpected challenges... |
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
ab9b9b8 to
8fbe17f
Compare
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges... |
8fbe17f to
69255cd
Compare
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges... |
69255cd to
c644b05
Compare
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
Full repo checkout causes Copilot CLI to ingest 1M tokens of context
(via --add-dir "${GITHUB_WORKSPACE}"), making it use bash commands
instead of MCP tools. The safeoutputs-add_comment tool is never called,
outputs.jsonl is never created, and the safe_outputs job always skips.
Fix: Remove explicit actions/checkout from smoke-copilot.md (compiler
generates sparse checkout by default). Update the postprocess script to:
1. Convert sparse checkout → full checkout (needed for npm ci/build)
2. Add a "Clean workspace for agent" step that removes src/, tests/,
etc. after building, keeping only .github, .agents, dist, node_modules
This reduces Copilot's context from ~1M to ~200k tokens, allowing it
to properly use MCP safe-output tools.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c644b05 to
a94d4b5
Compare
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
Smoke Test Results - Claude Engine ✅ GitHub MCP: #530, #522 Status: PASS
|
Summary
Fix Smoke Copilot pipeline where
safe_outputsjob always skips because the Copilot agent never callssafeoutputs-add_comment.Root Cause
PR #530 added explicit
actions/checkout(full checkout) to all smoke workflow.mdfiles. With full checkout, Copilot CLI's--add-dir "${GITHUB_WORKSPACE}"ingests the entire repo (~1M tokens). This overwhelms Copilot, causing it to use bash commands (gh pr comment) instead of MCP tools (safeoutputs-add_comment). Theoutputs.jsonlfile is never created, andsafe_outputsalways skips.Fix
smoke-copilot.md: Remove explicitsteps:— compiler generates sparse checkout by defaultpostprocess-smoke-workflows.ts: Updated to:npm ci/npm run build)src/,tests/, etc.smoke-copilot.lock.ymlResult: full checkout → build awf locally → clean workspace → agent runs with ~200k tokens (not 1M)
Test plan
safeoutputs-add_commentsafe_outputsjob runs (not skipped)🤖 Generated with Claude Code