|
10 | 10 | workflows: ["agent-implement", "agent-pr-fix"] # Edit to match your agent workflow names |
11 | 11 | types: |
12 | 12 | - completed |
13 | | - branches: |
14 | | - - main |
| 13 | + # branches: [main] # Uncomment to restrict to specific branches. |
| 14 | + # # Omit (default) to watch all branches, including PR branches, |
| 15 | + # # which is the common gh-aw case. |
15 | 16 |
|
16 | 17 | permissions: read-all |
17 | 18 |
|
@@ -132,6 +133,10 @@ Calculate the following metrics across all lines: |
132 | 133 |
|
133 | 134 | Flagged metrics are anomalies - include them in the diagnosis. |
134 | 135 |
|
| 136 | +Capture the total token count as `$TOTAL_TOKENS` (sum of all `input_tokens`, `output_tokens`, |
| 137 | +`cache_read_input_tokens`, and `cache_creation_input_tokens` across all lines) for use in |
| 138 | +Step 8. |
| 139 | + |
135 | 140 | ### Step 5: Determine run health |
136 | 141 |
|
137 | 142 | Assign one of three health levels: |
@@ -194,14 +199,18 @@ run is degraded or failed, the most likely cause. |
194 | 199 | **If no PR was found**: create an issue using `create_issue` with title: |
195 | 200 | `[log-watcher] #${{ github.event.workflow_run.run_number }}: $HEALTH` |
196 | 201 |
|
197 | | -### Step 8: Critical anomaly alert (optional) |
| 202 | +### Step 8: High-cost failure callout (optional) |
| 203 | + |
| 204 | +If health is ❌ **Failed** AND total tokens exceed 50 000, add the following callout |
| 205 | +**inside** the report you are already posting (comment or issue from Step 7) - do not |
| 206 | +create a separate issue: |
198 | 207 |
|
199 | | -If health is ❌ **Failed** AND total tokens exceed 50 000 (high-cost failure), create a |
200 | | -second issue using `create_issue` with title: |
201 | | -`[log-watcher] High-cost failure: run #${{ github.event.workflow_run.run_number }}` |
| 208 | +```markdown |
| 209 | +> ⚠️ **High-cost failure** - this run consumed $TOTAL_TOKENS tokens. Review the token |
| 210 | +> breakdown above. Adjust the 50 000-token threshold in the workflow to match your budget. |
| 211 | +``` |
202 | 212 |
|
203 | | -Include the full diagnosis and a direct link to the run. Adjust the 50 000-token threshold |
204 | | -in the workflow to match your budget. |
| 213 | +This keeps one report per run as required by the guidelines below. |
205 | 214 |
|
206 | 215 | ## Guidelines |
207 | 216 |
|
|
0 commit comments