Skip to content

Fix test-improver workflow AI credits rate limit#8265

Merged
lpcox merged 4 commits into
mainfrom
log-guard-policy-enhancement
Jun 29, 2026
Merged

Fix test-improver workflow AI credits rate limit#8265
lpcox merged 4 commits into
mainfrom
log-guard-policy-enhancement

Conversation

@lpcox

@lpcox lpcox commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #8252 — the Test Improver workflow hit the AI credits rate limit (used 2K of 1K max).

Root Cause

Multiple factors drove up token consumption:

  1. Default budget too lowmax-ai-credits: 2000 was barely enough for a workflow that analyzes, modifies, and verifies test files
  2. No DataOps — the agent spent tokens discovering test files and checking for duplicate PRs
  3. Unconfigured tool references — the prompt referenced "Serena" which isn't configured, causing the agent to waste tokens trying to use it
  4. Verbose prompt — 340+ lines of instructions consumed significant input tokens on every turn
  5. Broad coverage analysisgo test ./... instead of targeting the specific package
  6. Incorrect context — prompt said "this project does NOT use testify" (it does), causing confusion

Changes

Change Token Impact
Increase max-ai-credits to 2500 Prevents rate limit with headroom
Add DataOps steps (test file discovery + existing PR check) Saves ~2-3 agent turns of file listing
Remove Serena references Eliminates wasted tool-search turns
Trim prompt from ~340 → ~55 lines ~70% reduction in per-turn input tokens
Scope coverage to specific package Faster execution, less output to parse
Reduce stability runs from 5 → 3 Saves bash execution time
Correct testify context Eliminates go.mod check confusion

Validation

✓ .github/workflows/test-improver.md (88.7 KB)
⚠ Compiled 1 workflow(s): 0 error(s), 2 warning(s)

Warnings are informational (shell injection protection auto-applied, /tmp path advisory).

lpcox and others added 2 commits June 28, 2026 12:27
… log

Use the idiomatic Go %t format verb instead of %v for the boolean
optional parameter in the NormalizeIntegrityLevel debug log message.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Test Improver workflow was exceeding its default AI credits budget
(used 2K of 1K max). Increase the limit to 2000 to prevent rate limit
failures.

Closes #8252

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 29, 2026 03:15
GitHub Advanced Security started work on behalf of lpcox June 29, 2026 03:15 View session
GitHub Advanced Security finished work on behalf of lpcox June 29, 2026 03:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the Test Improver agentic workflow’s AI credit budget to prevent failures caused by exceeding the default max-ai-credits guardrail.

Changes:

  • Increased the Test Improver workflow max-ai-credits budget to 2000.
  • Tweaked a Go debug log format string in guard policy normalization.
Show a summary per file
File Description
internal/config/guard_policy.go Minor debug log formatting change (appears unrelated to the stated PR goal).
.github/workflows/test-improver.md Increases workflow max-ai-credits to avoid AI credit rate-limit failures.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread internal/config/guard_policy.go Outdated
- Increase max-ai-credits from 2000 to 2500 for headroom
- Add DataOps steps to pre-compute test file inventory and existing PR
  check, saving agent tokens on file discovery
- Remove references to unconfigured Serena tool that wasted agent
  tokens trying to invoke it
- Trim verbose prompt (~340 lines → ~55 lines) to reduce input tokens
- Scope coverage analysis to specific package instead of ./...
- Reduce stability verification from 5 runs to 3
- Correct misleading 'project does NOT use testify' section (it does)

Fixes #8252

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
GitHub Advanced Security started work on behalf of lpcox June 29, 2026 03:19 View session
@lpcox lpcox changed the title Increase test-improver max-ai-credits from 1K to 2K Fix test-improver workflow AI credits rate limit Jun 29, 2026
GitHub Advanced Security finished work on behalf of lpcox June 29, 2026 03:20
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
GitHub Advanced Security started work on behalf of lpcox June 29, 2026 05:11 View session
GitHub Advanced Security finished work on behalf of lpcox June 29, 2026 05:12
@lpcox lpcox merged commit bf13b42 into main Jun 29, 2026
33 checks passed
@lpcox lpcox deleted the log-guard-policy-enhancement branch June 29, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw] Test Improver hit AI credits rate limit

2 participants