fix(portfolio-analyst): add max-turns and max-ai-credits to prevent turn runaway#40858
Conversation
…prevent turn runaway The Workflow Portfolio Analyst ran for 95 turns and exhausted the 1000 AIC daily cap (baseline: 9 turns). Add a turn ceiling and a per-run AIC budget guard so the workflow fails fast instead of draining the daily budget. Closes #40854 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Hey One gap before this lands:
If you'd like a hand, here's a prompt you can assign to your coding agent:
|
There was a problem hiding this comment.
Pull request overview
This pull request adds explicit per-run guardrails to the Workflow Portfolio Analyst agentic workflow to prevent excessive turn count and AI Credit (AIC) spend from runaway runs, aligning the workflow’s runtime behavior with cost-control expectations for the gh-aw compiled/locked execution path.
Changes:
- Added
max-turns: 20andmax-ai-credits: 250toportfolio-analyst.mdfrontmatter. - Recompiled
portfolio-analyst.lock.ymlto enforce those limits in both the Claude harness (--max-turns 20) and the AWF API proxy config (maxRuns: 20,maxAiCredits: 250), and to surface the budget value in failure handling viaGH_AW_MAX_AI_CREDITS.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/portfolio-analyst.md |
Adds per-run turn and AIC caps in frontmatter to prevent runaway execution. |
.github/workflows/portfolio-analyst.lock.yml |
Recompiled lock workflow to propagate/enforce the new caps in the AWF config and Claude invocation. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
The Workflow Portfolio Analyst ran for 95 turns (~10× the 9-turn baseline) and exhausted the 1 000 AIC daily provider cap, costing $10.18 with zero writes before terminating on a 403.
Changes
portfolio-analyst.md: adds two frontmatter guardrails:portfolio-analyst.lock.yml: recompiled — propagates--max-turns 20,GH_AW_MAX_TURNS,GH_AW_MAX_AI_CREDITS: "250", andmaxRuns/maxAiCreditsinto the AWF proxy config so both the Claude engine and the API proxy enforce the limits independently.