Skip to content

Commit 1472ece

Browse files
Copilotmnkiefer
andauthored
fix: only exclude AIC monitoring family in downstream repos, not in source repo
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
1 parent 8e2306d commit 1472ece

2 files changed

Lines changed: 34 additions & 28 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: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ 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)"
52+
# Skip the AIC monitoring family in downstream repositories.
53+
# In the source repo (githubnext/agentic-ops) they remain valid targets;
54+
# in any other repo, optimization suggestions for them belong upstream.
55+
if [[ "$GITHUB_REPOSITORY" != "githubnext/agentic-ops" && \
56+
("$WORKFLOW_ID" == "agentic-token-optimizer" || "$WORKFLOW_ID" == "agentic-token-audit") ]]; then
57+
echo "⏭️ Skipping $WORKFLOW_ID (AIC monitoring family — optimize in githubnext/agentic-ops, not here)"
5758
continue
5859
fi
5960
@@ -104,26 +105,31 @@ steps:
104105
fi
105106
106107
BEFORE_COUNT=$(jq '(.runs // []) | length' /tmp/gh-aw/token-audit/all-runs.json)
107-
jq '
108-
(.runs // [])
109-
| map(select(
110-
(.workflow_path // "") != ".github/workflows/agentic-token-optimizer.lock.yml"
111-
and (.workflow_path // "") != ".github/workflows/agentic-token-audit.lock.yml"
112-
and (.workflow_name // "") != "Agentic Workflow AIC Usage Optimizer"
113-
and (.workflow_name // "") != "Daily Agentic Workflow AIC Usage Audit"
114-
)) as $runs
115-
| {
116-
summary: {
117-
total_runs: ($runs | length),
118-
total_tokens: ($runs | map(.token_usage // 0) | add // 0),
119-
total_aic: ($runs | map(.aic // 0) | add // 0)
120-
},
121-
runs: $runs
122-
}
123-
' /tmp/gh-aw/token-audit/all-runs.json > /tmp/gh-aw/token-audit/all-runs.filtered.json
124-
mv /tmp/gh-aw/token-audit/all-runs.filtered.json /tmp/gh-aw/token-audit/all-runs.json
125-
AFTER_COUNT=$(jq '(.runs // []) | length' /tmp/gh-aw/token-audit/all-runs.json)
126-
echo "🚫 Excluded AIC monitoring family from candidate pool: $((BEFORE_COUNT - AFTER_COUNT)) run(s) removed"
108+
if [[ "$GITHUB_REPOSITORY" != "githubnext/agentic-ops" ]]; then
109+
jq '
110+
(.runs // [])
111+
| map(select(
112+
(.workflow_path // "") != ".github/workflows/agentic-token-optimizer.lock.yml"
113+
and (.workflow_path // "") != ".github/workflows/agentic-token-audit.lock.yml"
114+
and (.workflow_name // "") != "Agentic Workflow AIC Usage Optimizer"
115+
and (.workflow_name // "") != "Daily Agentic Workflow AIC Usage Audit"
116+
)) as $runs
117+
| {
118+
summary: {
119+
total_runs: ($runs | length),
120+
total_tokens: ($runs | map(.token_usage // 0) | add // 0),
121+
total_aic: ($runs | map(.aic // 0) | add // 0)
122+
},
123+
runs: $runs
124+
}
125+
' /tmp/gh-aw/token-audit/all-runs.json > /tmp/gh-aw/token-audit/all-runs.filtered.json
126+
mv /tmp/gh-aw/token-audit/all-runs.filtered.json /tmp/gh-aw/token-audit/all-runs.json
127+
AFTER_COUNT=$(jq '(.runs // []) | length' /tmp/gh-aw/token-audit/all-runs.json)
128+
echo "🚫 Excluded AIC monitoring family from candidate pool: $((BEFORE_COUNT - AFTER_COUNT)) run(s) removed"
129+
else
130+
echo "ℹ️ Running in source repo — AIC monitoring family remains in candidate pool"
131+
AFTER_COUNT=$BEFORE_COUNT
132+
fi
127133
128134
- name: Aggregate top workflows by AIC usage
129135
run: |
@@ -229,7 +235,7 @@ Treat missing numeric fields (`aic`, `token_usage`, `turns`, `action_minutes`) a
229235

230236
- Start from `top-workflows.json`.
231237
- Exclude workflows optimized in the last 14 days (use `optimization-log.json`).
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.
238+
- 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") — **unless this workflow is running in `githubnext/agentic-ops`** (the source repository that ships them). In downstream repositories these workflows are not valid optimization targets; any optimization suggestions for them belong in `githubnext/agentic-ops`. In downstream repos they are pre-filtered from `all-runs.json` and `top-workflows.json`, but never select them even if a stale snapshot still lists them.
233239
- Choose the highest AI-credit-spend workflow that remains.
234240
- If no snapshot/history exists, derive candidates directly from `all-runs.json`.
235241

0 commit comments

Comments
 (0)