Skip to content

Commit 8e2306d

Browse files
Copilotmnkiefer
andauthored
fix: prevent optimizer from self-targeting in downstream repos
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
1 parent fb7af89 commit 8e2306d

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/agentic-token-optimizer.lock.yml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/agentic-token-optimizer.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ steps:
4949
WORKFLOW_ID=$(sed -n 's/^tracker-id:[[:space:]]*//p' "$workflow" | head -n 1 | tr -d '\r' | sed 's/[[:space:]]*$//')
5050
[ -n "$WORKFLOW_ID" ] || continue
5151
52+
# Skip the AIC monitoring family regardless of which repo this is running in.
53+
# These workflows are maintained in githubnext/agentic-ops; optimization
54+
# suggestions for them belong there, not in downstream repositories.
55+
if [[ "$WORKFLOW_ID" == "agentic-token-optimizer" || "$WORKFLOW_ID" == "agentic-token-audit" ]]; then
56+
echo "⏭️ Skipping $WORKFLOW_ID (AIC monitoring family — not a valid optimization target)"
57+
continue
58+
fi
59+
5260
FOUND_WORKFLOW=1
5361
SAFE_WORKFLOW_ID=$(printf '%s' "$WORKFLOW_ID" | tr -cs 'A-Za-z0-9._-' '_')
5462
PART_FILE="$PARTS_DIR/$SAFE_WORKFLOW_ID.json"
@@ -221,7 +229,7 @@ Treat missing numeric fields (`aic`, `token_usage`, `turns`, `action_minutes`) a
221229

222230
- Start from `top-workflows.json`.
223231
- Exclude workflows optimized in the last 14 days (use `optimization-log.json`).
224-
- Exclude the AIC monitoring family — the `agentic-token-optimizer` and `agentic-token-audit` workflows (display names "Agentic Workflow AIC Usage Optimizer" and "Daily Agentic Workflow AIC Usage Audit") — to avoid self-targeting. These workflows are pre-filtered from `all-runs.json` and `top-workflows.json`, but never select them even if a stale snapshot still lists them.
232+
- Exclude the AIC monitoring family — the `agentic-token-optimizer` and `agentic-token-audit` workflows (display names "Agentic Workflow AIC Usage Optimizer" and "Daily Agentic Workflow AIC Usage Audit") — to avoid self-targeting. This rule applies **regardless of which repository this workflow is running in**: these workflows are maintained in `githubnext/agentic-ops`, and any optimization changes to them belong there, not in downstream repositories. These workflows are pre-filtered from `all-runs.json` and `top-workflows.json`, but never select them even if a stale snapshot still lists them.
225233
- Choose the highest AI-credit-spend workflow that remains.
226234
- If no snapshot/history exists, derive candidates directly from `all-runs.json`.
227235

0 commit comments

Comments
 (0)