Skip to content

feat: add apiProxy.steering.budget as the switch for budget notices - #11478

Merged
lpcox merged 2 commits into
mainfrom
copilot/add-api-proxy-steering-budget
Nov 11, 2026
Merged

lpcox merged 2 commits into
mainfrom
copilot/add-api-proxy-steering-budget

Conversation

Copilot AI commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Budget notices (AI-credit and time) are switched on by apiProxy.enableTokenSteering / --enable-token-steering, but "token" is the wrong name for what they cover. This PR adds apiProxy.steering.budget as the main switch and keeps the old names as aliases. Notices stay off by default; turning them on by default is #11477.

apiProxy:
  maxAiCredits: 300      # credit notices (hard cap when unset)
  steering:
    budget: true
container:
  agentTimeout: 20       # time notices

Config / schema

  • Adds apiProxy.steering to the schema: a closed object (additionalProperties: false) with a boolean budget key. src/awf-config-schema.json is regenerated.
  • validateAwfFileConfig rejects enableTokenSteering and steering.budget set to different values.
  • The mapper resolves either name into one CLI option, steeringBudget.

CLI

  • New flags: --steering-budget and --no-steering-budget. --enable-token-steering stays as an alias.
  • resolveSteeringBudget (in parsers/rate-limit-parsers.ts) works out the final value as steeringBudget ?? enableTokenSteering ?? false. buildConfig exits with an error when --enable-token-steering is combined with --no-steering-budget.
  • Precedence: applyConfigFilePrecedence now has an alias table, so --enable-token-steering on the CLI counts as setting steeringBudget. A CLI flag under either name overrides the config file, so --enable-token-steering plus steering.budget: false in the file resolves to on rather than erroring.
  • WrapperConfig.enableTokenSteering and the AWF_ENABLE_TOKEN_STEERING env var are unchanged, so containers/api-proxy needs no changes.

Docs

  • awf-config-spec.md: the option mapping list and §10.1.
  • api-proxy-sidecar.md: the "Runtime and AI-credit steering" section.
  • CLI reference and --help text.
  • Schema descriptions for maxAiCredits and container.agentTimeout now refer to steering.budget.

Review notes

  • schemas/token-usage.schema.json is deliberately left out of the diff: npm run generate:schema also reformats it, and I reverted that.

Copilot AI changed the title [WIP] Add apiProxy.steering.budget switch for budget notices feat: add apiProxy.steering.budget as the switch for budget notices Nov 11, 2026
Copilot AI requested a review from rabeckett November 11, 2026 19:13
@rabeckett
rabeckett requested a max review from Copilot November 11, 2026 19:13
@lpcox
lpcox marked this pull request as ready for review November 11, 2026 19:14

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.

🟢 Approval recommended

No active review issues block the steering budget configuration change.

No open issues 🎉

What changed in this PR

Adds apiProxy.steering.budget as the primary switch for AWF’s AI-credit and time budget notices, while preserving legacy aliases and keeping notices off by default.

Changes:

  • Adds the closed steering configuration object and validates conflicting alias values.
  • Introduces explicit enable/disable CLI flags with alias-aware config precedence.
  • Adds regression coverage and updates schemas, help text, and documentation without changing the proxy’s runtime interface.
File Description
src/​parsers/​rate-limit-parsers.ts Resolves steering options and detects CLI conflicts.
src/​parsers/​rate-limit-parsers.test.ts Covers defaults, aliases, and conflicts.
src/​config-mapper.ts Maps both config names to steeringBudget.
src/​config-file.ts Adds steering types and alias conflict validation.
src/​config-file-validation.test.ts Covers steering values, unknown keys, and conflicts.
src/​config-file-mapping.test.ts Tests canonical steering option mapping.
src/​commands/​preflight.ts Makes CLI precedence aware of aliases.
src/​commands/​preflight.test.ts Tests legacy alias precedence recognition.
src/​commands/​build-config.ts Resolves steering into the existing runtime setting.
src/​commands/​build-config.test.ts Tests steering assembly and conflict rejection.
src/​cli-options.ts Registers enable/disable flags and legacy alias help.
src/​cli-options.test.ts Tests parsing of steering flags.
src/​awf-config-schema.json Updates the generated schema with steering settings.
docs/​awf-config.schema.json Defines steering settings and revised descriptions.
docs/​awf-config-spec.md Documents configuration, aliases, and precedence.
docs/​api-proxy-sidecar.md Updates budget-notice configuration guidance.
docs-site/​src/​content/​docs/​reference/​cli-reference.md Documents the new CLI flags and alias.

Review effort: Max

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11478 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 4d39897

@lpcox
lpcox merged commit e9a765c into main Nov 11, 2026
50 of 51 checks passed
@lpcox
lpcox deleted the copilot/add-api-proxy-steering-budget branch November 11, 2026 19:53
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.

Add apiProxy.steering.budget as the switch for budget notices

4 participants