Skip to content

fix: reduce Smoke Copilot context size to fix safe_outputs#539

Closed
Mossaka wants to merge 1 commit intomainfrom
fix/smoke-copilot-context-size
Closed

fix: reduce Smoke Copilot context size to fix safe_outputs#539
Mossaka wants to merge 1 commit intomainfrom
fix/smoke-copilot-context-size

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Feb 5, 2026

Summary

Fix Smoke Copilot pipeline where safe_outputs job always skips because the Copilot agent never calls safeoutputs-add_comment.

Root Cause

PR #530 added explicit actions/checkout (full checkout) to all smoke workflow .md files. 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). The outputs.jsonl file is never created, and safe_outputs always skips.

Fix

  1. smoke-copilot.md: Remove explicit steps: — compiler generates sparse checkout by default
  2. postprocess-smoke-workflows.ts: Updated to:
    • Convert sparse checkout → full checkout (needed for npm ci/npm run build)
    • Add "Clean workspace for agent" step after build that removes src/, tests/, etc.
    • Cleanup only applies to smoke-copilot.lock.yml

Result: full checkout → build awf locally → clean workspace → agent runs with ~200k tokens (not 1M)

Test plan

  • 733 unit tests pass
  • Smoke Copilot agent invokes safeoutputs-add_comment
  • safe_outputs job runs (not skipped)
  • All other smoke tests still pass

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings February 5, 2026 23:17
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 82.12% 82.12% ➡️ +0.00%
Statements 82.16% 82.16% ➡️ +0.00%
Functions 81.95% 81.95% ➡️ +0.00%
Branches 75.48% 75.48% ➡️ +0.00%

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Smoke Test Results: PASS

Last 2 merged PRs:

✅ GitHub MCP: Retrieved PR data successfully
✅ Playwright: Navigated to github.com (title confirmed)
✅ File Write: Created test file successfully
✅ Bash: Verified file content

Overall: PASS

AI generated by Smoke Claude

@Mossaka Mossaka force-pushed the fix/smoke-copilot-context-size branch from e02fc20 to ab9b9b8 Compare February 5, 2026 23:22
Copy link

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

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.md to let compiler generate sparse checkout by default
  • Add logic to postprocess-smoke-workflows.ts to convert sparse checkout to full checkout and add workspace cleanup step
  • Update smoke-copilot.lock.yml with 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`,
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
`${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`,

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

💫 TO BE CONTINUED... Smoke Claude was cancelled! Our hero faces unexpected challenges...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@Mossaka Mossaka force-pushed the fix/smoke-copilot-context-size branch from ab9b9b8 to 8fbe17f Compare February 5, 2026 23:23
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges...

@Mossaka Mossaka force-pushed the fix/smoke-copilot-context-size branch from 8fbe17f to 69255cd Compare February 5, 2026 23:26
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges...

@Mossaka Mossaka force-pushed the fix/smoke-copilot-context-size branch from 69255cd to c644b05 Compare February 5, 2026 23:35
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🎬 THE ENDSmoke 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>
@Mossaka Mossaka force-pushed the fix/smoke-copilot-context-size branch from c644b05 to a94d4b5 Compare February 5, 2026 23:39
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Smoke Test Results - Claude Engine

✅ GitHub MCP: #530, #522
✅ Playwright: github.com verified
✅ File Writing: test file created
✅ Bash Tool: file read confirmed

Status: PASS

AI generated by Smoke Claude

@Mossaka Mossaka closed this Feb 6, 2026
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.

1 participant