Suppress false ET rate-limit failures with max-ai-credits budget reconciliation#37581
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
max-ai-credits is configured
|
@copilot max effective tokens should be completely replaced my max ai credits |
|
@copilot merge main, recompile, fix conflicts |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated in |
max-ai-credits is configuredmax-ai-credits budget reconciliation
There was a problem hiding this comment.
Pull request overview
Updates the setup action’s failure-state reconciliation so legacy effective-token (ET) rate-limit signals are only suppressed based on an ET-equivalent ceiling derived from max-ai-credits, preventing misclassification for AI-credit-budgeted workflows.
Changes:
- Derives
maxEffectiveTokensexclusively frommax_ai_credits(1 AIC = 10,000 ET; supports fractional credits) for ET rate-limit suppression. - Updates/extends unit tests to reflect AI-credit-only ET reconciliation behavior and precedence.
- Refreshes embedded action pin data in both workflow and actionpins packages.
Show a summary per file
| File | Description |
|---|---|
actions/setup/js/effective_tokens_context.cjs |
Adds AI-credits-to-ET conversion and switches ET reconciliation to use only max_ai_credits. |
actions/setup/js/handle_agent_failure.test.cjs |
Updates and adds tests covering AI-credit-only ET reconciliation, precedence, and fractional conversion. |
pkg/actionpins/data/action_pins.json |
Updates embedded action pin entries with additional versions/SHAs. |
pkg/workflow/data/action_pins.json |
Mirrors the embedded action pin updates for workflow compilation/runtime usage. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 5
| /** | ||
| * Derive an ET-equivalent budget from AI credits when only max-ai-credits is available. | ||
| * Conversion uses 1 AIC = 10,000 ET and rounds down to avoid over-reporting ET capacity. | ||
| * @param {string} maxAICredits | ||
| * @returns {string} | ||
| */ |
| // Fallback for numeric strings not matched by decimal regex (for example scientific notation). | ||
| const parsed = Number.parseFloat(normalized); | ||
| if (!Number.isFinite(parsed) || parsed <= 0) return ""; | ||
| const converted = Math.floor(parsed * EFFECTIVE_TOKENS_PER_AI_CREDIT); | ||
| if (!Number.isSafeInteger(converted) || converted <= 0) return ""; | ||
| return String(converted); |
| expect(resolveEffectiveTokensFailureState()).toEqual({ | ||
| effectiveTokens: "25000000", | ||
| maxEffectiveTokens: "25000000", | ||
| maxEffectiveTokens: "", | ||
| effectiveTokensRateLimitError: true, | ||
| }); |
|
|
||
| expect(resolveEffectiveTokensFailureState()).toEqual({ | ||
| effectiveTokens: "10000000", | ||
| maxEffectiveTokens: "100000000", | ||
| maxEffectiveTokens: "", | ||
| effectiveTokensRateLimitError: false, | ||
| }); |
| "actions/checkout@v4": { | ||
| "repo": "actions/checkout", | ||
| "version": "v4", | ||
| "sha": "34e114876b0b11c390a56381ad16ebd13914f8d5" | ||
| }, | ||
| "actions/checkout@v6.0.2": { | ||
| "repo": "actions/checkout", | ||
| "version": "v6.0.2", | ||
| "sha": "de0fac2e4500dabe0009e67214ff5f5447ce83dd" | ||
| }, |
…rchestrator-failure Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in |
The meta-orchestrator failure path was classifying runs as legacy effective-token budget failures even when workflows were budgeted via
max-ai-credits. This produced incorrect issue context and failure categorization for runs that were under budget.Failure-state reconciliation update
effective_tokens_context.cjs,resolveEffectiveTokensFailureState()now derives the ET-equivalent ceiling exclusively from AI credits.max_effective_tokensis no longer used for ET failure-state suppression logic.1 AIC = 10,000 ET, with support for fractional credit values.Behavior hardening for AI-credit-budgeted workflows
max_ai_credits.max_ai_creditsis not configured, ET rate-limit signals are no longer reconciled bymax_effective_tokensfallback values.Targeted coverage additions
handle_agent_failure.test.cjsto reflect AI-credit-only ET reconciliation.max_effective_tokensis present (no AI-credit reconciliation).max_ai_creditstaking precedence when bothmax_ai_creditsandmax_effective_tokensare present.Branch sync and recompilation
maininto this branch..lock.ymlfiles with current workflow sources after the merge.