fix: stop token-optimizer self-targeting the AIC monitoring family#121
Open
mrfelton wants to merge 1 commit into
Open
fix: stop token-optimizer self-targeting the AIC monitoring family#121mrfelton wants to merge 1 commit into
mrfelton wants to merge 1 commit 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>
This was referenced Jun 11, 2026
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
The Phase 1 self-targeting guard in
workflows/agentic-token-optimizer.mdcan never fire, so the optimizer selects itself (or its sibling audit) as the workflow to optimize. Full write-up in #119.gh aw logsreportsworkflow_nameas the display name (the H1):Agentic Workflow AIC Usage OptimizerDaily Agentic Workflow AIC Usage AuditNeither contains the substring "Token", so
Exclude workflows with "Token" in the namematches nothing. With the monitoring family always in the candidate pool, andsort_by(total_ai_credits)putting the always-on scheduled family on top (especially sincegh aw logsonly recovers ~24h and event-driven workflows mostly skip), the optimizer ends up "optimizing the optimizer".Fix
workflow_pathmatchesagentic-token-(optimizer|audit)or whose display name matchesAIC Usage (Optimizer|Audit), so neitherall-runs.jsonnortop-workflows.jsoncan list the family (the agent reads both).Both
workflows/(template) and.github/workflows/(active) copies are updated and kept identical.Notes
.mdonly. The generated.lock.ymlfiles are intentionally not included: a fork compile produces repo-scoped cron jitter and resolves action-pin SHAs differently, so fork-built locks wouldn't match this repo'sgh aw compile/install-workflows.ymloutput. Please regenerate locks in-repo.gh aw compile --validate --no-emit(v0.72.1): 0 errors, 0 warnings.Fixes #119
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com