perf: exclude browser tools and reduce turns in smoke-copilot#1625
perf: exclude browser tools and reduce turns in smoke-copilot#1625
Conversation
Implements recommendations from #1624: 1. Exclude 21 unused Playwright/browser tools via --excluded-tools in postprocess-smoke-workflows.ts (saves ~10,500 tokens/turn) 2. Remove redundant MCP verification call — pre-step already proves MCP connectivity, no need for agent to call list_pull_requests 3. Remove redundant bash echo test — bash functionality is already proven by the file write/read test in section 3 4. Drop repos toolset — only pull_requests tools are used, removing 4 unused tool schemas (~2,400 tokens/turn) Expected impact: 5→3 LLM turns, ~25-30% token reduction per run. Closes #1624 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
This PR reduces token and turn usage in the smoke-copilot agentic workflow by trimming unused tools (notably Playwright/browser schemas), removing redundant prompt steps, and narrowing the GitHub MCP toolsets to only what the workflow needs.
Changes:
- Injects Copilot CLI
--excluded-toolsforsmoke-copilot.lock.ymlto hide unusedbrowser_*tools. - Updates
smoke-copilot.mdto drop therepostoolset and remove the redundant “bash works” step. - Updates the compiled lock workflow to reflect the prompt/toolset changes and pass
--excluded-toolsin Copilot runs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/ci/postprocess-smoke-workflows.ts | Adds post-processing to inject --excluded-tools for smoke-copilot Copilot CLI invocations. |
| .github/workflows/smoke-copilot.md | Reduces GitHub MCP toolsets and removes redundant prompt steps/calls to cut turns and tokens. |
| .github/workflows/smoke-copilot.lock.yml | Regenerated workflow with updated toolsets and Copilot CLI args (including --excluded-tools). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ### 1. GitHub MCP Testing | ||
| The last 2 merged pull requests have been fetched. Verify MCP connectivity by calling `github-list_pull_requests` for ${{ github.repository }} (limit 1, state merged) and confirm data is returned. | ||
| Pre-step result: MCP connectivity confirmed — 2 merged PRs were pre-fetched successfully (see data below). No additional MCP call is required. | ||
|
|
There was a problem hiding this comment.
The prompt claims “MCP connectivity confirmed” based on the pre-step, but the pre-step fetches PRs via gh pr list (GitHub API), not via the GitHub MCP server/tools. This change removes the only explicit GitHub MCP tool invocation, so the workflow may no longer detect GitHub MCP breakage. Either reintroduce a minimal GitHub MCP call for this section, or rename/reword the section to reflect that only GitHub API connectivity was pre-validated.
See below for a potential fix:
### 1. GitHub PR Data Pre-Fetch
Pre-step result: 2 merged PRs were pre-fetched successfully via GitHub API/CLI (see data below). This validates PR data availability for the test, not GitHub MCP connectivity.
| const isCopilotSmoke = workflowPath.includes('smoke-copilot.lock.yml'); | ||
| if (isCopilotSmoke) { | ||
| const excludedToolsFlag = | ||
| '--excluded-tools=browser_close,browser_resize,browser_console_messages,' + | ||
| 'browser_handle_dialog,browser_evaluate,browser_file_upload,browser_fill_form,' + | ||
| 'browser_press_key,browser_type,browser_navigate,browser_navigate_back,' + | ||
| 'browser_network_requests,browser_run_code,browser_take_screenshot,' + | ||
| 'browser_snapshot,browser_click,browser_drag,browser_hover,' + | ||
| 'browser_select_option,browser_tabs,browser_wait_for'; | ||
| const allowAllToolsCount = (content.match(/--allow-all-tools/g) || []).length; | ||
| if (allowAllToolsCount > 0 && !content.includes('--excluded-tools')) { | ||
| content = content.replace( | ||
| /--allow-all-tools/g, | ||
| `--allow-all-tools ${excludedToolsFlag}` | ||
| ); |
There was a problem hiding this comment.
This injection is not idempotent for updates: once the workflow content contains any --excluded-tools flag, the script won’t ensure the excluded list matches excludedToolsFlag. That means future changes to the excluded set (or a recompile that adds a different --excluded-tools) won’t be normalized by postprocess. Consider checking for the specific expected flag value (or replacing any existing --excluded-tools=... for smoke-copilot) so updates remain reliable.
|
Smoke Test Results — PASS
Overall: PASS
|
This comment has been minimized.
This comment has been minimized.
Smoke Test: GitHub Actions Services Connectivity ✅
All service connectivity checks passed. (
|
This comment has been minimized.
This comment has been minimized.
- Restore MCP call in section 1 so the workflow actually tests GitHub MCP connectivity (not just CLI/API) - Make --excluded-tools injection idempotent: strip any existing flag before re-injecting so updates to the excluded list are always applied correctly on re-runs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Smoke test results (run 23919740353) ✅ GitHub MCP — #1620 feat: add daily token optimization advisor workflows, #1613 perf: reduce smoke-copilot token usage with pre-steps and tool trimming Overall: PASS
|
🔥 Smoke Test Results
Overall: PASS PR by @lpcox, reviewer
|
|
Smoke test results:
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Summary
Implements all recommendations from #1624 (generated by the Copilot Token Optimization Advisor).
Changes
1. Exclude 21 unused Playwright/browser tools (~10,500 tokens/turn)
Adds
--excluded-toolsinjection topostprocess-smoke-workflows.tsfor smoke-copilot. The Copilot CLI includes 21 built-inbrowser_*tools when--allow-all-toolsis set, but smoke-copilot never uses any of them.2. Remove redundant MCP verification call (saves 1 turn)
The prompt previously instructed the agent to call
list_pull_requeststo "verify MCP connectivity" — but the pre-step already fetches 2 merged PRs viagh pr list, proving MCP works. Updated to treat pre-fetched data as sufficient.3. Remove redundant bash echo test (saves 1 turn)
Section 4 (
echo "bash works") was redundant since bash functionality is already proven by the file write/read test in Section 3. Removed.4. Drop
repostoolset (~2,400 tokens/turn)Changed
toolsets: [repos, pull_requests]→toolsets: [pull_requests]. The 4 tools fromrepos(list_releases,list_tags,search_repositories,search_code) are never called.Expected Impact
Closes #1624