Loading
Add cap_code_completion_context feature flag
What does this MR do and why?
Adds the cap_code_completion_context feature flag (default off) and pushes it to the AI gateway via x-gitlab-enabled-feature-flags.
When enabled, the AI gateway caps additional code completion context (open tabs, imports) at 2,048 tokens. Evals and production data show no quality gain above that size, while completion input tokens carry 99.6% of inference cost. Expected saving: 55-62% of completion input tokens. The cap applies to code completions only; generations are unaffected.
Evidence and rollout plan: #607984 AI gateway change: gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!6453
How to set up and validate locally
- Enable the flag:
Feature.enable(:cap_code_completion_context). - Request a code completion with an IDE connected to the instance.
- Observe
cap_code_completion_contextin thex-gitlab-enabled-feature-flagsheader sent to the AI gateway.