Reduce scheduled workflow AI-credit burn and stagger the midnight batch#46510
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix shared AI-credit budget exhaustion issue
Reduce scheduled workflow AI-credit burn and stagger the midnight batch
Jul 19, 2026
pelikhan
marked this pull request as ready for review
July 19, 2026 03:25
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces scheduled AI-credit usage by bounding the semantic-refactoring workflow and staggering related schedules.
Changes:
- Adds semantic-refactoring budgets, a cheaper model, and rotating scope precomputation.
- Staggers five scheduled workflows.
- Adds compilation regression coverage.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/semantic-function-refactor.md |
Adds cost and scope controls. |
.github/workflows/semantic-function-refactor.lock.yml |
Compiles semantic workflow changes. |
.github/workflows/auto-triage-issues.md |
Staggers triage schedule. |
.github/workflows/auto-triage-issues.lock.yml |
Compiles triage schedule. |
.github/workflows/detection-analysis-report.md |
Staggers analysis schedule. |
.github/workflows/detection-analysis-report.lock.yml |
Compiles analysis schedule. |
.github/workflows/duplicate-code-detector.md |
Staggers duplicate scan. |
.github/workflows/duplicate-code-detector.lock.yml |
Compiles duplicate-scan schedule. |
.github/workflows/unbloat-docs.md |
Staggers documentation workflow. |
.github/workflows/unbloat-docs.lock.yml |
Compiles documentation schedule. |
pkg/workflow/semantic_function_refactor_workflow_test.go |
Tests compiled cost guardrails. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 11/11 changed files
- Comments generated: 4
- Review effort level: Medium
| schedule: daily | ||
| schedule: | ||
| - cron: "17 2 * * *" # Offset from the midnight/22:29 UTC workflow clusters | ||
| max-daily-ai-credits: 300 |
| schedule: | ||
| - cron: "17 2 * * *" # Offset from the midnight/22:29 UTC workflow clusters | ||
| max-daily-ai-credits: 300 | ||
| max-ai-credits: 300 |
| set -euo pipefail | ||
| mkdir -p /tmp/gh-aw/agent/semantic-function-refactor | ||
|
|
||
| mapfile -t packages < <(find pkg -mindepth 1 -maxdepth 1 -type d | sort) |
| `17 2 * * *`, | ||
| `GH_AW_MAX_DAILY_AI_CREDITS: "300"`, | ||
| `"maxAiCredits":300`, | ||
| `claude-sonnet-4.6`, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The shared 1000-AIC pool was exhausted account-wide, causing scheduled agentic runs to hard-fail with
403 Maximum AI credits exceededbefore doing useful work. The main burn driver was the Semantic Function Refactoring workflow’s expensive nightly sweep, compounded by several scheduled workflows firing in the same time window.Constrain the highest-burn workflow
semantic-function-refactor.claude-opus-4-8toclaude-sonnet-4.6.Replace whole-repo analysis with a bounded deterministic slice
/tmp/gh-aw/agent/semantic-function-refactor/.Stagger the affected schedule cluster
semantic-function-refactorauto-triage-issuesdetection-analysis-reportduplicate-code-detectorunbloat-docsLock the behavior with a focused compile test
Example of the new bounded precompute pattern: