Add vulnerability_context_flow model selection feature setting

What does this MR do and why?

Gives the Vulnerability Context Flow its own model selection feature setting, vulnerability_context_flow, like the other security flows. The flow is billed at a flat rate, so it can only use the models from its cost analysis. The sdlc_context_agent_trigger flag hides the new row in model selection, like the flow itself.

Closes https://gitlab.com/gitlab-org/gitlab/-/work_items/641421

Screenshots

Before After
before-model-selection after-model-selection

How to set up and validate locally

  1. Go to a top-level group's Settings > GitLab Duo > Configure features > Model selection.
  2. Check that Vulnerability Context Flow has its own row.

Database

A data migration copies the Self-Hosted "Agents & flows" (duo_agent_platform) model setting to vulnerability_context_flow, so Self-Hosted admins keep the model they picked.

INSERT INTO ai_feature_settings (created_at, updated_at, ai_self_hosted_model_id, feature, provider)
SELECT NOW(), NOW(), ai_self_hosted_model_id, 31, provider
FROM ai_feature_settings
WHERE feature = 16
ON CONFLICT (feature) DO NOTHING

Plan: https://console.postgres.ai/gitlab/projects/gitlab-production-main/sessions/103440/commands/208614 (Index Scan on index_ai_feature_settings_on_feature, 0 rows, 0.02 ms warm, buffers: 4 hit / 0 read)

  • Rows: at most 1. feature is unique, and GitLab.com has no duo_agent_platform row, so it inserts nothing there.
  • If it goes wrong: Self-Hosted admins would see the wrong model for Vulnerability Context Flow and could change it in the AI settings.
  • Rollback: down deletes the vulnerability_context_flow row.
Edited by Charlie Kroon

Merge request reports

Loading
Loading