Repository navigation
ci: raise AI-credit budgets for failing agentic workflows - #9158
Conversation
Test Improver and Efficiency Improver hit the default 1000 per-run max-ai-credits guardrail by a small margin and terminated mid-run; bump both to 2000. Expert Code Review (on PR ready) exceeded the 24h daily budget when a busy PR day fanned out many sub-agent reviews; add an explicit max-daily-ai-credits of 20K. Recompiled the affected .lock.yml files with gh aw compile --strict. Fixes #9062 Fixes #9059 Fixes #9053 Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR updates GitHub agentic workflow budgets in microsoft/testfx so Copilot-driven runs don’t terminate or get skipped due to AI credit guardrails, aligning the repo’s workflows with observed real-world usage.
Changes:
- Increase per-run
max-ai-creditsto2000for Test Improver and Efficiency Improver workflows. - Add a per-workflow 24h budget override
max-daily-ai-credits: 20Kfor Expert Code Review (on PR ready) to avoid skips on busy days. - Regenerate the corresponding compiled
.lock.ymlfiles to reflect the new guardrail values.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/test-improver.md | Sets max-ai-credits: 2000 for the Test Improver workflow. |
| .github/workflows/test-improver.lock.yml | Recompiled lock file reflecting the new 2000 per-run cap. |
| .github/workflows/efficiency-improver.md | Sets max-ai-credits: 2000 for the Efficiency Improver workflow. |
| .github/workflows/efficiency-improver.lock.yml | Recompiled lock file reflecting the new 2000 per-run cap. |
| .github/workflows/review-on-open.agent.md | Adds max-daily-ai-credits: 20K for the expert review workflow to prevent daily-budget skips. |
| .github/workflows/review-on-open.agent.lock.yml | Recompiled lock file reflecting the new 20K daily budget value. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 0
Amaury Levé (Evangelink)
left a comment
There was a problem hiding this comment.
Note
🤖 Automated review by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
Expert Code Review — PR #9158 · ci: raise AI-credit budgets for failing agentic workflows
Verdict Table
| # | Dimension | Rating | Notes |
|---|---|---|---|
| 1 | Correctness of fix | ✅ PASS | Overruns were +7.55 and +19.9 over a 1000-credit cap; doubling to 2000 provides adequate headroom without excessive waste |
| 2 | Value selection rationale | ✅ PASS | 2K (2× prior default) and 20K (4× enterprise daily default) are proportional to documented overruns and explained in the PR description |
| 3 | Hardcoded vs. variable configuration | Replaces ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS }} fallback expression with a literal "2000", removing centralized repo-variable override capability; acceptable given this is consistent with the pattern already established for review-on-open in #9115 |
|
| 4 | Lock file regeneration correctness | ✅ PASS | All three .lock.yml files updated; PR states gh aw compile --strict produced 0 errors, 0 warnings |
| 5 | Frontmatter hash consistency | ✅ PASS | frontmatter_hash changed in all three lock files, correctly reflecting that frontmatter was modified in each corresponding .md source |
| 6 | Body hash consistency | ✅ PASS | body_hash is identical before and after in all three lock files — correct, since max-ai-credits and max-daily-ai-credits are frontmatter directives, not body content |
| 7 | Source/lock file pairing completeness | ✅ PASS | Each of the three .md sources has its corresponding .lock.yml updated in the same change set |
| 8 | Strict mode compliance | ✅ PASS | All lock file metadata retains "strict":true; compiler invoked with --strict as required by repository conventions |
| 9 | No hand-edited lock files | ✅ PASS | Lock file diffs (metadata line + two env-var substitutions per workflow) are consistent with what gh aw compile would produce for frontmatter-only changes |
| 10 | PR description quality | ✅ PASS | Precise over-budget figures given for each workflow, issue numbers cited, recompile confirmation included |
| 11 | Issue references | ✅ PASS | Fixes #9062, #9059, #9053 cited in the PR body and explanatory comments in the .md files reference the relevant issue numbers |
| 12 | Daily budget governance | ✅ PASS | 20K daily cap is justified by the ~21 sub-agent fan-out scenario (~2K per sub-agent × 10 PRs/day); documented rationale is traceable |
| 13 | Per-run budget governance | ✅ PASS | 2K is the minimum increase that clears the observed overruns; does not overshoot into a budget that would mask runaway usage |
| 14 | Consistency across workflows | ✅ PASS | All three workflows now use 2K per-run; only review-on-open (which exhibits fan-out) receives the daily cap addition |
| 15 | Documentation quality in .md files |
✅ PASS | Inline comments in review-on-open.agent.md explain the fan-out rationale and reference #9053; no unexplained magic numbers |
| 16 | Security implications | ✅ PASS | Credit limits are cost governance controls only; no secrets, credentials, or permissions affected |
| 17 | Cost implications | The 20K daily cap is a 4× increase over the enterprise default; appropriate for the stated scenario but worth re-evaluating once actual usage data is available post-fix | |
| 18 | Backward compatibility | ✅ PASS | Pure CI infrastructure change; no production source code, public API, or test behaviour altered |
| 19 | K suffix translation |
✅ PASS | max-daily-ai-credits: 20K in the .md source correctly expands to "20000" in the compiled lock file, confirming the compiler handles the shorthand |
| 20 | Compiler version consistency | ✅ PASS | All three lock files use "compiler_version":"v0.79.4" consistently; no mixed-version artifacts |
| 21 | Agent ID and engine consistency | ✅ PASS | All three lock files retain "agent_id":"copilot","engine_versions":{"copilot":"1.0.60"} unchanged |
| 22 | Both GH_AW_MAX_DAILY_AI_CREDITS occurrences updated |
✅ PASS | Both env-var assignments in review-on-open.agent.lock.yml (approx. lines 85 and 155) are updated from the variable-fallback expression to the literal "20000" |
Summary
This is a minimal, well-scoped CI maintenance PR. The root causes (three documented credit-budget overruns) are clearly identified, the chosen ceiling values are proportional to the measured overruns, and all compilation and convention requirements are met.
What works well:
- Hash analysis confirms the compiled lock files are consistent with their source changes:
frontmatter_hashupdated,body_hashpreserved across all three workflows. - Both occurrences of
GH_AW_MAX_DAILY_AI_CREDITSinreview-on-open.agent.lock.ymlare updated — no partial fix. - Explanatory comments in the
.mdfiles make the intent traceable to specific issue numbers.
Minor observations (non-blocking):
- Dimension 3 — Hardcoded values: The switch from
${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }}to a literal"2000"means these workflows will no longer respond to a future change of theGH_AW_DEFAULT_MAX_AI_CREDITSrepo variable. This is already the established pattern forreview-on-open(since #9115), so the inconsistency is resolved rather than introduced, but it does mean centralized cost control now requires individual workflow edits. Consider documenting this trade-off in a follow-up issue if centralized control is desired long-term. - Dimension 17 — Cost: 20K/day is a 4× jump from the enterprise default. The rationale is sound for the observed fan-out scenario, but it would be worth tracking actual daily credit consumption after these workflows start completing normally to confirm whether 20K is the right steady-state ceiling or can be tuned down.
No blocking or major issues found. The changes are correct, consistent with established patterns, and directly address the documented failures.
🤖 Automated content by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Expert Code Review (on PR ready) workflow. · 457.6 AIC · ⌖ 14.2 AIC · ◷
Three agentic-workflow runs failed against their AI-credit guardrails. This raises the budgets so the runs complete normally.
1000per-runmax-ai-credits(over by ~7.55) and thecopilotengine terminated mid-run. Bumped to2000.1000per-run cap (over by ~19.9). Bumped to2000.max-daily-ai-credits(5K enterprise default) when a busy PR day fanned out ~21 sub-agent reviews. Added an explicitmax-daily-ai-credits: 20K(kept the existingmax-ai-credits: 2000per-run cap from [aw] Expert Code Review (on PR ready) failed #9115).Recompiled the affected
.lock.ymlfiles withgh aw compile --strict(0 errors, 0 warnings).Fixes #9062
Fixes #9059
Fixes #9053