From 195431ea3826161f526f1078d7b179066e9ce76c Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick <200251+mrfelton@users.noreply.github.com> Date: Thu, 11 Jun 2026 19:24:04 +0200 Subject: [PATCH] fix: exclude zero-spend (skipped) runs from token-optimizer ranking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Aggregate top workflows by AIC usage" step keeps every completed run, including runs whose agent skipped via activation/preconditions and consumed 0 AIC. Those zero-spend runs pad run_count, dilute avg_ai_credits, and can surface never-spent workflows into the top-10 that drives target selection. High-frequency event-driven workflows (e.g. label-triggered) are mostly these 0-AIC completed runs. Add `select((.aic // 0) > 0)` after the status filter so a "top workflows by AIC spend" ranking only counts runs that actually spent. NOTE: only correct once the compiler reliably computes AIC. On gh-aw < v0.79.4 (incl. v0.72.1 used here) the Copilot 0-AIC bug (github/gh-aw#38314, fixed in v0.79.4) makes real-spend Copilot runs report 0 AIC, so this filter would drop genuine spend. Pair with / gate on a compiler bump to >= v0.79.4. Details in #120. Source `.md` only — regenerate `.lock.yml` in-repo (fork-built locks don't match this repo's cron jitter / action-pin resolution). Fixes #120 Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/agentic-token-optimizer.md | 1 + workflows/agentic-token-optimizer.md | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/agentic-token-optimizer.md b/.github/workflows/agentic-token-optimizer.md index 6117f5e..272c855 100644 --- a/.github/workflows/agentic-token-optimizer.md +++ b/.github/workflows/agentic-token-optimizer.md @@ -69,6 +69,7 @@ steps: top_workflows: ( [.runs[] | select(.status == "completed") + | select((.aic // 0) > 0) | { workflow_name: .workflow_name, ai_credits: (.aic // 0), diff --git a/workflows/agentic-token-optimizer.md b/workflows/agentic-token-optimizer.md index 6117f5e..272c855 100644 --- a/workflows/agentic-token-optimizer.md +++ b/workflows/agentic-token-optimizer.md @@ -69,6 +69,7 @@ steps: top_workflows: ( [.runs[] | select(.status == "completed") + | select((.aic // 0) > 0) | { workflow_name: .workflow_name, ai_credits: (.aic // 0),