Skip to content

-1 and K/M values in GH_AW_DEFAULT_MAX_AI_CREDITS fall back to the default budget #77140

Done

Description

@rabeckett

The enterprise controls docs say an organization can set vars.GH_AW_DEFAULT_MAX_AI_CREDITS to -1 to remove the per-run AI credit budget, and that positive values accept K/M suffixes such as 100M. The threat-detection docs say the same of vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS. The AI credits specification makes the first a requirement: a runtime -1 MUST disable the budget and omit maxAiCredits from the firewall config (section 10.5, test T-AIC-PR-003).

Neither works today. Since #58116 moved the expression into the step environment, the compiled AWF step only accepts a plain whole number and resets anything else to the built-in default. Every compiled workflow has this guard, for example in smoke-copilot.lock.yml:

GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-1000}"
if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^[0-9]+$ ]]; then
  GH_AW_MAX_AI_CREDITS="1000"
fi

So an organization that sets the variable to -1 still gets a budget of 1000 credits (400 for threat detection), and one that sets 100M gets 1000. Nothing in the run says the value was ignored. max-ai-credits: -1 in frontmatter still works, because the compiler writes the literal and AWF treats a maxAiCredits of -1 as no budget. GH_AW_DEFAULT_EVALS_MAX_AI_CREDITS goes through the same guard.

What we'd like

The runtime variables should accept what the docs and spec promise: -1 removes the budget, and K/M suffixes are expanded the same way the compiler expands them in frontmatter. Any other value should still fall back to the default, but with a warning in the step log that names the variable, so an organization can see that its setting was ignored. The spec's T-AIC-PR-003 needs a test that covers the compiled step, not just the expression.

If maintainers would rather keep the runtime variables to plain whole numbers, the docs and spec section 10.5 should say so instead, and the warning is still worth adding.

gh-aw#77087 (docs for AWF's budget notices) describes the current fallback in the enterprise controls and threat-detection pages, adds an implementation-status note to section 10.5, and marks T-AIC-PR-003 as not yet implemented. Those should be updated or removed with whichever fix lands here.

Activity

  1. added
    bug
    on Nov 12, 2026
  2. added
    backlog:ai-credits
    on Nov 21, 2026
  3. rabeckett commented on Nov 24, 2026

    @rabeckett
    CollaboratorAuthor

    Closing this as done. #77479 made the compiled step accept -1, so an organization variable of -1 now removes the budget as section 10.5 requires (T-AIC-PR-003). For K/M suffixes we went with the second option: the enterprise controls and threat-detection docs now say the runtime variables take a plain whole number or -1, and that anything else, such as 100M, falls back to the default.

    The one piece that didn't land is a warning in the step log when a value is ignored. It was part of #77185, which was closed without merging. If that bites anyone, I'll open a separate issue for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

backlog:ai-creditsbugcompilerworkflows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions