Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: remove ai-gateway-cost-control experiment flag - #27579

Merged
ssncferreira merged 2 commits into
mainfrom
susana/aigov-443-remove-ai-gateway-cost-control-experiment-flag-once-feature
Jul 29, 2026
Merged

chore: remove ai-gateway-cost-control experiment flag#27579
ssncferreira merged 2 commits into
mainfrom
susana/aigov-443-remove-ai-gateway-cost-control-experiment-flag-once-feature

Conversation

@ssncferreira

@ssncferreira ssncferreira commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

Closes AIGOV-443.

The AI Gateway cost control feature has been released, so this removes the ExperimentAIGatewayCostControl experiment and all of its gating. The cost control API endpoints remain gated by the FeatureAIBridge license feature (the AI Governance add-on), so this only drops the experiment layer.

Changes

  • codersdk/deployment.go: remove the ExperimentAIGatewayCostControl const, its DisplayName() case, and its ExperimentsKnown entry.
  • enterprise/coderd/coderd.go: remove the httpmw.RequireExperiment(...) gating from the AI cost control routes. They keep RequireFeatureMW(codersdk.FeatureAIBridge). Affected endpoints:
    • GET /organizations/{organization}/groups/ai/spend
    • GET /organizations/{organization}/groups/{groupName}/members/ai/spend
    • GET /organizations/{organization}/ai/spend/export
    • GET /groups/{group}/members/ai/spend
    • GET /groups/{group}/ai/spend
    • GET/PUT/DELETE /users/{user}/ai/budget/override and GET /users/{user}/ai/spend
  • enterprise/coderd/aibridge_test.go: drop the experiment from test setup and remove the now-obsolete RequiresExperiment negative-path tests.
  • Frontend (site/src/...): remove the ai-gateway-cost-control experiment checks from the cost control UI (Groups pages, user dropdown) and their stories/mocks. The feature is now driven solely by the aibridge feature visibility.
  • Generated: regenerated coderd/apidoc/*, docs/reference/api/schemas.md, and site/src/api/typesGenerated.ts.

Out of scope

The dogfood CODER_EXPERIMENTS config lives in a separate infra repo, not coder/coder. Leaving ai-gateway-cost-control there is harmless: unknown experiment values are logged as "ignoring unknown experiment" at startup and otherwise ignored, so no ordering dependency or breakage. That cleanup can be a follow-up.

Implementation notes
  • Verified how unknown experiments are handled in coderd/coderd.go ReadExperiments: unknown values produce a warning log and are inert, so removing the definition before the dogfood config is updated is safe.
  • Noticed the group ai/budget routes (/groups/{group}/ai/budget) were already gated only by FeatureAIBridge, never by the experiment. After this change all cost control routes are uniformly feature-gated, resolving that inconsistency.
  • Removed an obsolete RequiresExperiment subtest in TestUserAISpendStatus that only asserted a 403 from the experiment gate; with the gate gone it would no longer be blocked pre-RBAC.

This PR was created by Coder Agents on behalf of @ssncferreira.

The AI Gateway cost control feature is now GA, so remove the
ExperimentAIGatewayCostControl experiment and its gating:

- Drop the experiment from codersdk/deployment.go (const, DisplayName,
  ExperimentsKnown).
- Remove RequireExperiment gating from the AI cost control API endpoints
  in enterprise/coderd; these remain gated by FeatureAIBridge.
- Remove experiment checks and now-obsolete negative-path tests.
- Remove the experiment gate from the cost control frontend UI.
- Regenerate API docs and TypeScript types.
@linear-code

linear-code Bot commented Jul 28, 2026

Copy link
Copy Markdown

AIGOV-443

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

…ve-ai-gateway-cost-control-experiment-flag-once-feature

# Conflicts:
#	docs/reference/api/schemas.md
@ssncferreira
ssncferreira marked this pull request as ready for review July 29, 2026 13:49
@ssncferreira
ssncferreira requested a review from a team as a code owner July 29, 2026 13:49
@ssncferreira
ssncferreira requested review from EhabY and johnstcn July 29, 2026 13:50
@coderagents

coderagents Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

New Documentation Needed

  • docs/ai-coder/ai-gateway/cost-controls.md - Removing ExperimentAIGatewayCostControl makes cost controls generally available to any deployment with the AI Governance add-on, but the page is still a stub containing only <!-- TODO(AIGOV-476): Document AI Gateway cost controls. -->. Before this ships as GA it needs the user-facing behavior: setting group and user budgets, budget periods/overrides, spend visibility (group, member, and org spend), the CSV export, and what happens when a budget is exhausted. Tracked in AIGOV-476, so if that lands separately before the release, this is already covered.

Notes

  • No stale references to the ai-gateway-cost-control experiment exist elsewhere in docs/, so nothing else needs cleanup.
  • docs/reference/api/schemas.md is regenerated correctly and needs no manual edit.

Automated review via Coder Agents

@ssncferreira
ssncferreira merged commit 3deecb4 into main Jul 29, 2026
40 of 41 checks passed
@ssncferreira
ssncferreira deleted the susana/aigov-443-remove-ai-gateway-cost-control-experiment-flag-once-feature branch July 29, 2026 14:00
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants