fix(claude-token-optimizer): resolve workflow file via .lock.yml when .md lacks name field#3633
Conversation
… .md lacks name field The pre-agent step searched .md files for 'name: <workflow>', but many workflows (e.g. doc-maintainer) don't have an explicit name field — the display name is compiled into the .lock.yml. When the grep failed, the fallback derived a kebab-case path that didn't exist, setting TARGET_NOT_FOUND=1 and causing the agent to produce no safe outputs. Fix: after the .md search fails, search .lock.yml files (which always contain name: "<workflow>") and derive the .md path from the matching lock file. Kebab-case fallback is kept as a last resort. Also update the equivalent example code in copilot-token-optimizer.md prompt body to use the same three-step resolution strategy. Recompile all lock files and run post-processing.
✅ 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 fixes workflow source resolution for token optimization advisors when a workflow display name exists only in the compiled .lock.yml, preventing the Claude optimizer from failing to stage the intended .md source file.
Changes:
- Adds
.lock.ymldisplay-name lookup before falling back to kebab-case inclaude-token-optimizer.md. - Updates the Copilot optimizer prompt example with the same resolution strategy.
- Recompiles generated lock workflows, primarily refreshing manifest metadata and generated heredoc identifiers.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/claude-token-optimizer.md |
Adds lock-file fallback for resolving workflow display names to source .md files. |
.github/workflows/copilot-token-optimizer.md |
Updates agent instructions with the same three-step workflow-file resolution flow. |
.github/workflows/claude-token-optimizer.lock.yml |
Recompiled lock output reflecting the Claude optimizer source change. |
.github/workflows/copilot-token-optimizer.lock.yml |
Recompiled lock output for the Copilot optimizer workflow. |
.github/workflows/secret-digger-codex.lock.yml |
Recompiled generated heredoc IDs and manifest action pin metadata. |
.github/workflows/update-release-notes.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/test-coverage-reporter.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/test-coverage-improver.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/smoke-services.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/smoke-otel-tracing.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/smoke-opencode.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/smoke-gemini.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/smoke-copilot.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/smoke-copilot-byok.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/smoke-codex.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/smoke-claude.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/smoke-chroot.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/security-review.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/security-guard.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/secret-digger-copilot.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/secret-digger-claude.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/schema-sync.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/refactoring-scanner.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/plan.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/pelis-agent-factory-advisor.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/issue-monster.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/issue-duplication-detector.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/firewall-issue-dispatcher.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/export-audit.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/duplicate-code-detector.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/doc-maintainer.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/dependency-security-monitor.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/copilot-token-usage-analyzer.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/cli-flag-consistency-checker.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/claude-token-usage-analyzer.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/ci-doctor.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/ci-cd-gaps-assessment.lock.yml |
Recompiled manifest action pin metadata. |
.github/workflows/build-test.lock.yml |
Recompiled manifest action pin metadata. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 38/38 changed files
- Comments generated: 0
Smoke Test: Copilot BYOK (Offline) — FAIL ❌Test Results:
Mode: Running in BYOK offline mode (COPILOT_OFFLINE=true) via api-proxy → api.githubcopilot.com PR Context: Overall: FAIL — File test failed, connectivity check missing data
|
Smoke Test Results✅ GitHub MCP: #3617 [docs] Add model fallback feature documentation Status: FAIL
|
Smoke Test Results✅ GitHub API — 2 PR entries verified Result: PASS — All smoke tests passed.
|
Smoke Test Codex: FAILGitHub merged PR review: ✅ [docs] Add model fallback feature documentation; feat(api-proxy): add middle-power model fallback with stale-cache recovery 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.
|
Service Connectivity: ❌ FAIL
Overall: FAIL — No services reachable via
|
|
Gemini Smoke Test: PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS All build and test operations completed successfully across all ecosystems.
|
The "Daily Claude Token Optimization Advisor" was selecting a top workflow (
Documentation Maintainer) but failing to stage its source file — settingTARGET_NOT_FOUND=1and causing the agent to exit without producing any safe outputs.Root cause
The pre-agent step located the workflow file by grepping
.mdfiles forname: <workflow>. About half of the.mdworkflow files (includingdoc-maintainer.md) have no explicitname:field — the display name is derived from the filename during compilation and only exists in the.lock.yml. The grep returned nothing, the fallback produced.github/workflows/documentation-maintainer.md(kebab-case), which doesn't exist.Fix
claude-token-optimizer.md— pre-agent stepAdded a
.lock.ymllookup as a middle fallback before the kebab-case guess:Lock files always contain a quoted
name:entry, so this reliably maps any workflow display name back to its.mdsource.copilot-token-optimizer.md— prompt body exampleUpdated the inline bash example (used as agent instructions) with the same three-step resolution strategy.
Recompile
All
.lock.ymlfiles recompiled and post-processed.