fix: fetch AIC logs per workflow so audit/optimizer survive high-CI-volume repos#124
Open
mrfelton wants to merge 2 commits into
Open
fix: fetch AIC logs per workflow so audit/optimizer survive high-CI-volume repos#124mrfelton wants to merge 2 commits into
mrfelton wants to merge 2 commits into
Conversation
The Phase 1 self-targeting guard ("Exclude workflows with \"Token\" in the
name") can never fire: gh aw logs reports `workflow_name` as the display
name (the H1), which for these two workflows is "Agentic Workflow AIC
Usage Optimizer" / "Daily Agentic Workflow AIC Usage Audit" — neither
contains "Token". The string only appears in the workflow id / tracker-id.
So the monitoring family is never excluded, and the optimizer selects
itself (or its sibling audit) as the target.
This fixes it two ways:
- Deterministic pre-filter in the "Download" step: drop runs whose
workflow_path matches `agentic-token-(optimizer|audit)` or whose
display name matches `AIC Usage (Optimizer|Audit)`, so neither
all-runs.json nor top-workflows.json can list the family.
- Correct the Phase 1 prompt guard to key off the actual ids/display
names instead of the substring "Token".
Source `.md` only — the generated `.lock.yml` files are intentionally
left for in-repo regeneration via `gh aw compile` (lock cron jitter and
action-pin resolution are repo-scoped, so fork-built locks would not
match this repo's CI output).
Fixes githubnext#119
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The audit reported empty days ("0 completed runs") and the optimizer's
candidate pool silently truncated in busy repos: unfiltered
`gh aw logs` scans repo-wide run batches and stops paginating when a
batch filters down to zero processable agentic runs (skipped/cancelled
dropped first) — github/gh-aw#38782. 250 repo-wide runs span ~2h of CI
in a large monorepo, so the call rarely saw past the most recent runs.
Enumerate agentic workflows from .github/workflows/*.lock.yml and call
`gh aw logs <id>` per workflow (workflow-scoped listing is unaffected
by repo CI volume), then merge results deduped by run_id into the same
{summary, runs} shape the agent prompts already expect.
Validated in a production monorepo over a window that produced an
empty audit: unfiltered call returned 1 run (the audit itself);
per-workflow loop returned 15 runs including 5016/3674/2548-AIC runs.
Fixes githubnext#123
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In busy repos, both the audit and the optimizer download data with an unfiltered
gh aw logs --jsoncall, which stops paginating after roughly one repo-wide batch of CI history — full write-up in #123, root cause in the CLI filed as github/gh-aw#38782 (skipped/cancelled runs are dropped, then the empty filtered batch is mistaken for end-of-history).Net effect we hit in production:
rolling-summary.jsonnever accumulates, so the trend chart can never render.Fix
Enumerate agentic workflows from
.github/workflows/*.lock.ymland callgh aw logs <id>per workflow — workflow-scoped listing uses the per-workflow runs API and is unaffected by repo-wide CI volume — then merge results (deduped byrun_id) into the same{summary, runs}shape the agent prompts already expect. Tolerates per-workflow failures (partial results still merge).Applied to both workflows, in both the
workflows/templates and the.github/workflows/active copies (kept identical).Validation
gh aw compile --validate --no-emiton v0.72.1 (this repo's pinned compiler): 0 errors, 0 warnings.Notes
.mdonly — please regenerate.lock.ymlin-repo (fork-built locks carry repo-scoped cron jitter / action-pin resolution that won't match this repo's CI).Fixes #123
Co-Authored-By: Claude Fable 5 noreply@anthropic.com