Report features not served by a self-hosted model
What does this MR do and why?
gitlab:duo:verify_self_hosted_setup skips every feature that has no self-hosted model, so a feature left on a GitLab-managed model, saved or never touched, never shows up in its output. A saved vendored row sends its requests to the GitLab-managed AI Gateway (Ai::FeatureSetting#base_url), and a feature with no row does the same through the instance-level fallback in FeatureSettingSelectionService#select_for_self_managed, unless the instance has an offline cloud license. Once !272504 (merged) lands, a Duo Agent Platform flow on such a feature is refused instead on an offline cloud license that has no duo_workflow.service_url configured.
This MR adds a second list. It takes the features the Admin area GitLab Duo page lists, built with FeatureSettingFinder as that page is, so an allowed feature with no saved setting counts as unassigned. Each one without a self-hosted model on a vendored or unassigned provider is listed under its provider. A disabled feature, or one the instance does not allow, is left out, because nothing serves it. For Duo Agent Platform flows, that holds once !272504 (merged) lands: it refuses a disabled feature on every license. The Agent Platform features are read only when the page shows them: it hides them on an offline cloud license without the self-hosted Agent Platform add-on.
The count of self-hosted assignments does not change. It still reads every saved row that has a self-hosted model, so a row for a feature the instance no longer allows is still counted and listed under its model.
The section status stays OK. The new warning sits under its own key, unserved_features_warning, so it does not mix with the existing WARNING for an instance with no feature setting configured. The run continues.
flowchart TD
A["Saved rows with a self-hosted model"] --> C["Counted and listed under the model<br/>(unchanged)"]
B["Admin page features<br/>(FeatureSettingFinder: saved rows plus defaults)"] --> D{"Self-hosted model assigned?"}
D -- yes --> G["Already counted above"]
D -- no --> E{"Provider"}
E -- "vendored or unassigned" --> F["Listed under its provider, under unserved_features_warning<br/>(status stays OK; before this change: never reported)"]
E -- disabled --> H["Left out: the feature is off"]The rake task is the only caller of the verifier.
References
- Closes #630385
Screenshots or screen recordings
Before, on 19.4.0 with two feature settings, one moved to a GitLab-managed model:
Checking feature settings and model assignments...
1 feature settings configured across 1 models ✔
Code Model: 1 feature(s) assigned (code_generations)After, on GitLab 19.6.1 with this change applied, an offline cloud license with the self-hosted Agent Platform add-on, no saved feature settings, and a stub answering the AI Gateway health check:
Checking feature settings and model assignments...
No feature settings configured ⚠
Models may not be available for any GitLab Duo features
14 feature(s) not served by a self-hosted model ⚠
duo_agent_platform: unassigned
duo_agent_platform_agentic_chat: unassigned
duo_developer: unassigned
recommend_reviewers_assign: unassigned
code_generations: unassigned
code_completions: unassigned
duo_chat: unassigned
duo_chat_explain_code: unassigned
duo_chat_write_tests: unassigned
duo_chat_refactor_code: unassigned
duo_chat_fix_code: unassigned
review_merge_request: unassigned
review_merge_request_dap: unassigned
secret_vulnerability_fp_detection: unassigned
To serve them with a self-hosted model, assign one on the Admin area GitLab Duo page,
under Configure models for GitLab Duo, on the AI-native features tab.How to set up and validate locally
- On a self-hosted Duo instance, assign a self-hosted model to one feature on the Admin area GitLab Duo page and leave a second feature untouched.
- Run
sudo gitlab-rake gitlab:duo:verify_self_hosted_setup. - Confirm every untouched feature appears under the not-served list with its provider, and that the count sits under
unserved_features_warningin the diagnostic summary, with the sectionstatusstayingOKwhen a saved row exists.
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.