Skip to content

Commit d30dba7

Browse files
authored
fix(log-watcher): remove branch filter; fold high-cost alert into primary report (#19)
* fix(log-watcher): remove branch filter; fold high-cost alert into primary report * docs(log-watcher): document optional branch filter with trade-off comment * docs(log-watcher): define $TOTAL_TOKENS capture in Step 4 for use in Step 8
1 parent 4fc8d88 commit d30dba7

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

workflows/log-watcher.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ on:
1010
workflows: ["agent-implement", "agent-pr-fix"] # Edit to match your agent workflow names
1111
types:
1212
- 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.
1516

1617
permissions: read-all
1718

@@ -132,6 +133,10 @@ Calculate the following metrics across all lines:
132133

133134
Flagged metrics are anomalies - include them in the diagnosis.
134135

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+
135140
### Step 5: Determine run health
136141

137142
Assign one of three health levels:
@@ -194,14 +199,18 @@ run is degraded or failed, the most likely cause.
194199
**If no PR was found**: create an issue using `create_issue` with title:
195200
`[log-watcher] #${{ github.event.workflow_run.run_number }}: $HEALTH`
196201

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:
198207

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+
```
202212

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.
205214

206215
## Guidelines
207216

0 commit comments

Comments
 (0)