feat: optimization workflows skip already-tracked workflows instead of blocking#3057
Conversation
Remove skip-if-match from both optimization workflows so they always run. Add a pre-agent step that fetches open optimization issues and extracts which workflows are already tracked. Update the agent prompt to skip those workflows and optimize the next most expensive one. This allows the optimizer to cover multiple workflows over time instead of being blocked by a single open optimization issue. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
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.
There was a problem hiding this comment.
Pull request overview
This PR updates the Copilot/Claude token optimization advisor workflows so they don’t fully skip execution when an optimization issue is already open. Instead, they now run, detect which workflows are already being tracked by open optimization issues, and (per the updated prompt) select the next most expensive untracked workflow or exit gracefully if all are covered.
Changes:
- Removed
skip-if-matchgating so both optimizers always run. - Added a pre-agent step to list open optimization issues and extract already-tracked workflow names into
/tmp/gh-aw/token-audit/already-optimized.txt. - Updated the agent prompt to skip excluded workflows and avoid creating duplicate issues when everything is already covered.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/copilot-token-optimizer.md | Removes skip gate; adds “already optimized” issue scan step and prompt logic to skip tracked workflows. |
| .github/workflows/copilot-token-optimizer.lock.yml | Compiled workflow updates reflecting the new scan step and removal of skip-if-match activation logic. |
| .github/workflows/claude-token-optimizer.md | Same as Copilot optimizer changes, scoped to Claude labels/reporting. |
| .github/workflows/claude-token-optimizer.lock.yml | Compiled workflow updates reflecting the new scan step and removal of skip-if-match activation logic. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
.github/workflows/copilot-token-optimizer.md:123
- The new exclusion-list logic (skip workflows already tracked by open optimization issues) won’t work as intended while
safe-outputs.create-issue.close-older-issuesremains enabled. As soon as the workflow creates a new optimization issue for a different workflow, the safe-output handler will close existing optimization issues with this label/prefix, so you’ll still end up with only one open issue at a time (and the next run will “forget” previously tracked workflows). Disableclose-older-issues(and ensure any other safe-output limits allow multiple concurrent optimization issues) to match the PR’s described behavior.
**Skip any workflow whose name appears in `already-optimized.txt`** — an open optimization issue already tracks it. Select the highest-ranked workflow that is **not** in the exclusion list.
If **all** workflows in the report are already covered by open issues, do **not** create an issue. Log a message noting that all heavy-usage workflows already have open optimization issues and stop without calling any safe-output tools.
.github/workflows/claude-token-optimizer.md:125
- Same issue as in the Copilot optimizer: the new “skip already-tracked workflows” logic won’t achieve multi-workflow coverage while
safe-outputs.create-issue.close-older-issuesis still enabled in this workflow. Creating a new optimization issue will close prior optimization issues, so you can’t keep multiple workflows tracked concurrently. Disableclose-older-issues(and confirm safe-output limits allow multiple open optimization issues) to align with the intended behavior.
**Skip any workflow whose name appears in `already-optimized.txt`** \u2014 an open optimization issue already tracks it. Select the highest-ranked workflow that is **not** in the exclusion list.
If **all** workflows in the report are already covered by open issues, do **not** create an issue. Log a message noting that all heavy-usage workflows already have open optimization issues and stop without calling any safe-output tools.
- Files reviewed: 4/4 changed files
- Comments generated: 4
| mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs | ||
| cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_92a5feb0ce596222_EOF' | ||
| cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_5baea3a7a04c427a_EOF' | ||
| {"create_issue":{"close_older_issues":true,"labels":["copilot-token-optimization"],"max":1,"title_prefix":"⚡ Copilot Token Optimization"},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} |
| mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs | ||
| cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_d12b3bfe5ff8b57d_EOF' | ||
| cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_1ec037f92aeea528_EOF' | ||
| {"create_issue":{"close_older_issues":true,"labels":["claude-token-optimization"],"max":1,"title_prefix":"⚡ Claude Token Optimization"},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} |
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 Results
Overall Status: FAIL
|
🔬 Smoke Test Results
Overall: FAIL — GitHub MCP returned 401 (unauthenticated). Actor: @lpcox
|
🔥 Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( Overall: PARTIAL — BYOK inference path confirmed ✅; GitHub MCP auth and pre-step template expansion had issues.
|
|
Merged PR titles: unavailable (GitHub read failed: gh 401) 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.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test Results — FAIL
|
Summary
Both token optimization workflows (
copilot-token-optimizerandclaude-token-optimizer) previously usedskip-if-matchto skip entirely when any open optimization issue existed. This meant only one workflow could ever have an open optimization issue at a time, blocking coverage of other expensive workflows.Changes
skip-if-match— workflows always run now⚡ ... Optimization YYYY-MM-DD — <workflow-name>)/tmp/gh-aw/token-audit/already-optimized.txtexclusion list, skips workflows already tracked, optimizes the next most expensive one. If all workflows are covered, exits gracefully without creating a duplicate issue.Behavior Before
Behavior After