Stop the team-member AI bypass for pilot groups
What does this MR do and why?
GitLab team members currently bypass AI quota checks in every namespace. The default-off internal_ai_usage flag lets pilot groups remove that bypass while keeping gitlab_team_member=true. Non-pilot, non-team-member, nil-namespace, and non-SaaS token cases retain their existing cutoff behavior.
Caller claims can no longer override generated identity and billing claims. AI Gateway and DWS receive the pilot flag for the namespace supplied by each caller. This MR does not change billing attribution, model context, or tool-policy resolution.
DWS direct access and the ws/execute connection config (Ai::DuoWorkflows::ConnectionConfigService) still use the requested root namespace, not the resolved billing namespace. A team member in a public group they do not belong to can get a pilot decision on these paths that differs from the Rails quota check. Billing-namespace alignment for both paths is deferred to https://gitlab.com/gitlab-org/gitlab/-/work_items/631120.
References
Closes https://gitlab.com/gitlab-org/gitlab/-/work_items/631119
- Related resolver change: !254204 (merged)
- Downstream enforcement: https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/work_items/2951
- Feature flag rollout: https://gitlab.com/gitlab-org/gitlab/-/work_items/631121
- Parent rollout: https://gitlab.com/gitlab-org/customers-gitlab-com/-/work_items/18936
Screenshots or screen recordings
Not applicable: no UI change.
How to set up and validate locally
- Use a local environment with a test group, a user identified as a GitLab team member, and a configured DWS connection.
- In a local Rails console, enable the flag for that test group with
Feature.enable(:internal_ai_usage, group). - Make an AI Gateway or DWS direct-access request in that group. Compare the Cloud Connector claims and enabled-feature-flags header with the flag off and on: team identity stays true, while the pilot claim sets
skip_usage_cutoff=false.
These manual checks require local team-member configuration and downstream service setup. Do not enable the flag on production groups as part of this MR.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
- The feature flag is default-off; rollout operations are outside this MR.
- Before enablement, complete the rollout prerequisites and verify downstream enforcement is deployed.