fix: prevent token exhaustion causing zero-output agentic workflow runs#2850
Merged
Conversation
Contributor
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: size-xs Label Categories
For more information, see |
Contributor
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…without safe output Root cause: Agent exhausted ~23M/25M token budget on data gathering/analysis and session terminated before reaching PR creation phase (no safe output call). Changes: - 00-base-contract.md: Add Rule #9 (mandatory safe output), Timer C (token budget), mid-run checkpoint warning, strengthen output contract - 01-bash-and-shell-safety.md: Add mandatory mid-run checkpoint at minute 20 with escalation policy for token-budget awareness - 07-commit-and-pr.md: Rewrite deadline enforcement with Timer C, token-budget awareness tips, and noop fallback if PR call fails - news-month-ahead.md: Add token-budget awareness warning to time budget section - news-quarter-ahead.md, news-year-ahead.md, news-election-cycle.md: Add same token-budget awareness warning (all Tier-C aggregation workflows) Closes #2849 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix workflow failure in News: Month Ahead
fix: prevent token exhaustion causing zero-output agentic workflow runs
May 31, 2026
Contributor
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
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.
News: Month Ahead workflow consumed 23M/25M tokens on MCP data gathering, then session terminated before any safe output call — producing zero value from a 20-minute run.
Root cause
Token budget (~25M) is the binding constraint for opus models doing heavy MCP work, not the 60-minute time limit. The agent can exhaust tokens in ~20 minutes without ever reaching the PR creation phase. Existing prompts only enforced time-based deadlines.
Changes
Shared prompt modules (apply to all news workflows):
00-base-contract.md— Added Rule Bump actions/checkout from 4.3.1 to 6.0.2 #9 (MANDATORY safe output call before exit), Timer C (token budget as binding constraint), critical mid-run checkpoint at minute 2001-bash-and-shell-safety.md— Added mandatory mid-run checkpoint with diagnostic script and escalation policy: compress scope → minimal PR →safeoutputs___noopfallback07-commit-and-pr.md— Rewrote deadline enforcement with Timer C awareness, token-budget tips (batch MCP calls, avoid re-reads of large files), mandatorysafeoutputs___noopif PR creation failsWorkflow-level reinforcement (Tier-C aggregation workflows most at risk):
news-month-ahead.md,news-quarter-ahead.md,news-year-ahead.md,news-election-cycle.md— Added 🔴 token-budget awareness warning: checkagent_minutebefore every phase transition, compress scope if ≥20 min with no artifacts on diskKey enforcement mechanism