-
Notifications
You must be signed in to change notification settings - Fork 211
Closed
Labels
Description
Objective
Add an early exit mechanism to the Hourly CI Cleaner workflow that skips execution when there is no work to do, preventing unnecessary token consumption.
Context
The Copilot Token Report (discussion #7407) recommends adding a no-op exit guard to the Hourly CI Cleaner. This will prevent the workflow from consuming tokens when there are no CI runs to clean up.
Approach
- Add a preliminary step that checks if there are CI runs to clean
- Use GitHub API to query for qualifying runs
- If no runs found, exit early with success status
- Document the no-op behavior in workflow comments
Implementation Strategy
Add an early check before the main Copilot agent execution:
steps:
- name: Check for CI runs to clean
id: check
run: |
# Query for qualifying CI runs
count=$(gh api ... | jq 'length')
echo "count=$count" >> $GITHUB_OUTPUT
- name: Run CI Cleaner
if: steps.check.outputs.count > 0
# ... existing Copilot agent executionFiles to Modify
- Hourly CI Cleaner workflow file (identified in previous issue)
Acceptance Criteria
- Workflow checks for work before executing
- Early exit occurs when no CI runs need cleaning
- Token consumption drops for no-op runs
- Workflow still cleans CI runs when work exists
- Logs clearly indicate no-op vs. execution runs
Expected Impact
- Further reduces token consumption beyond schedule changes
- Eliminates wasteful executions
- Combined with schedule reduction, maximizes cost savings
Related to [plan] Address DeepReport Intelligence Briefing findings (Dec 23, 2025) #7410
AI generated by Plan Command for discussion #7407
Reactions are currently unavailable