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

## Description

Closes
[AIGOV-443](https://linear.app/codercom/issue/AIGOV-443/remove-ai-gateway-cost-control-experiment-flag-once-feature-is-stable).

The AI Gateway cost control feature is planned for GA on the upcoming
release, 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.

<details>
<summary>Implementation notes</summary>

- 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.

</details>

---

_This PR was created by Coder Agents on behalf of @ssncferreira._
This commit is contained in:
Susana Ferreira
2026-07-29 14:59:58 +01:00
committed by GitHub
parent d6a5c8e9f8
commit 3deecb481e
14 changed files with 14 additions and 207 deletions
-4
View File
@@ -20315,13 +20315,11 @@ const docTemplate = `{
"minimum-implicit-member",
"workspace-capable-licensing",
"ai-gateway-seat-exclusion",
"ai-gateway-cost-control",
"chat-advisor",
"chat-virtual-desktop",
"agent-lifecycle-hooks"
],
"x-enum-comments": {
"ExperimentAIGatewayCostControl": "Enables AI Gateway cost control functionality.",
"ExperimentAIGatewaySeatExclusion": "Excludes AI Gateway (AI Bridge) usage from AI Governance seat consumption.",
"ExperimentAgentLifecycleHooks": "Enables chat lifecycle hook webhooks for agent chats.",
"ExperimentAutoFillParameters": "This should not be taken out of experiments until we have redesigned the feature.",
@@ -20349,7 +20347,6 @@ const docTemplate = `{
"Allows organizations to deviate from the default organization-member roles, in support of Gateway Accounts.",
"Counts only users holding the workspace-create permission toward the license seat limit.",
"Excludes AI Gateway (AI Bridge) usage from AI Governance seat consumption.",
"Enables AI Gateway cost control functionality.",
"Enables the advisor tool for root agent chats.",
"Enables virtual desktop and computer use provider for agents.",
"Enables chat lifecycle hook webhooks for agent chats."
@@ -20366,7 +20363,6 @@ const docTemplate = `{
"ExperimentMinimumImplicitMember",
"ExperimentWorkspaceCapableLicensing",
"ExperimentAIGatewaySeatExclusion",
"ExperimentAIGatewayCostControl",
"ExperimentChatAdvisor",
"ExperimentChatVirtualDesktop",
"ExperimentAgentLifecycleHooks"
-4
View File
@@ -18449,13 +18449,11 @@
"minimum-implicit-member",
"workspace-capable-licensing",
"ai-gateway-seat-exclusion",
"ai-gateway-cost-control",
"chat-advisor",
"chat-virtual-desktop",
"agent-lifecycle-hooks"
],
"x-enum-comments": {
"ExperimentAIGatewayCostControl": "Enables AI Gateway cost control functionality.",
"ExperimentAIGatewaySeatExclusion": "Excludes AI Gateway (AI Bridge) usage from AI Governance seat consumption.",
"ExperimentAgentLifecycleHooks": "Enables chat lifecycle hook webhooks for agent chats.",
"ExperimentAutoFillParameters": "This should not be taken out of experiments until we have redesigned the feature.",
@@ -18483,7 +18481,6 @@
"Allows organizations to deviate from the default organization-member roles, in support of Gateway Accounts.",
"Counts only users holding the workspace-create permission toward the license seat limit.",
"Excludes AI Gateway (AI Bridge) usage from AI Governance seat consumption.",
"Enables AI Gateway cost control functionality.",
"Enables the advisor tool for root agent chats.",
"Enables virtual desktop and computer use provider for agents.",
"Enables chat lifecycle hook webhooks for agent chats."
@@ -18500,7 +18497,6 @@
"ExperimentMinimumImplicitMember",
"ExperimentWorkspaceCapableLicensing",
"ExperimentAIGatewaySeatExclusion",
"ExperimentAIGatewayCostControl",
"ExperimentChatAdvisor",
"ExperimentChatVirtualDesktop",
"ExperimentAgentLifecycleHooks"