feat: add daily token usage analyzer workflow#1557
Conversation
Adds an agentic workflow that runs daily to mine token-usage.jsonl from recent workflow runs, compute per-workflow statistics (tokens, cache rates, costs, model mix), identify optimization opportunities, and create a summary issue. The workflow: - Discovers completed runs from the past 24 hours - Downloads agent-artifacts and extracts token-usage.jsonl - Computes per-workflow stats (cache hit rate, I/O ratio, cost) - Flags inefficiencies (zero cache hits, high I/O ratios) - Compares with previous reports for historical trends - Creates a structured issue with progressive disclosure Gracefully handles missing data since token tracking is a new feature. Closes #1551 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
Adds a new scheduled agentic workflow to analyze token-usage.jsonl artifacts from recent GitHub Actions runs, compute per-workflow token/cost/cache metrics, and publish a daily “Token Usage Report” issue.
Changes:
- Introduces
.github/workflows/token-usage-analyzer.mddefining the analyzer agent prompt, safe outputs, and skip logic. - Adds the compiled workflow
.github/workflows/token-usage-analyzer.lock.yml. - Updates
.github/aw/actions-lock.jsonto lockgithub/gh-aw-actions/setup@v0.65.3.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| .github/workflows/token-usage-analyzer.md | New workflow manifest/prompt describing discovery, artifact download, aggregation, and report issue structure. |
| .github/workflows/token-usage-analyzer.lock.yml | Generated compiled workflow to execute the agent and safe-outputs issue creation. |
| .github/aw/actions-lock.json | Adds the pinned SHA entry for the newer gh-aw-actions/setup version used by the compiled workflow. |
Comments suppressed due to low confidence (1)
.github/workflows/token-usage-analyzer.md:163
- The example
Workflow Summarytable inside the suggested issue body also uses||at the start of each row, which will render with a blank first column. Use standard GFM table syntax (| Workflow | ... |) so the report issue displays as intended.
### Workflow Summary
| Workflow | Runs | Total Tokens | Cost | Cache Rate | I/O Ratio | Top Model |
|----------|------|-------------|------|------------|-----------|-----------|
| smoke-claude | 2 | 395K | $0.46 | 99.5% | 0.6:1 | sonnet-4.6 |
| smoke-copilot | 2 | 603K | $1.20 | 0% | 184:1 | gpt-4o |
| ... | | | | | | |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Smoke Test Results — Run 23866856394 ✅ GitHub MCP — #1553 [WIP] Create daily token usage analysis workflow, #1552 [WIP] Fix NODE_EXTRA_CA_CERTS path issue after chroot for SSL bump Overall: PASS
|
|
Smoke Test Results — ✅ GitHub MCP: Last 2 merged PRs fetched (#1553 "[WIP] Create daily token usage analysis workflow", #1552 "[WIP] Fix NODE_EXTRA_CA_CERTS path issue after chroot for SSL bump") Overall: PASS
|
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
🤖 Smoke test results for Copilot engine — PR #1557 (
Overall: PASS
|
|
Smoke Test Results — PASS
|
Smoke Test: GitHub Actions Services Connectivity ✅All checks passed:
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
|
PR titles:
Results: GitHub MCP ✅ | safeinputs-gh ❌ | Playwright ❌ | Tavily ❌ | File write ✅ | Bash cat ✅ | Discussion comment ❌ | Build ✅
|
Summary
Adds a daily agentic workflow that mines
token-usage.jsonlfrom recent workflow runs, computes per-workflow statistics, identifies optimization opportunities, and creates a summary issue.What it does
agent-artifactsand extractstoken-usage.jsonl<details>blocks)Configuration
create-issuewith📊 Token Usage ReportprefixGraceful Degradation
Token tracking is new (PR #1539), so the workflow:
agent-artifactstoken-usage.jsonlFiles
.github/workflows/token-usage-analyzer.md— Workflow definition.github/workflows/token-usage-analyzer.lock.yml— Compiled lock file.github/aw/actions-lock.json— Updated action SHA lockExample Output
The issue will contain a summary table like:
Plus optimization recommendations and per-workflow detail sections.
Closes #1551