Loading
Wire Gemini model pin, timeout, and FF push for feature search
What does this MR do and why?
Feature Discovery Search's Tier 3 (Gemini) call resolved model routing through Ai::ModelSelection::NamespaceFeatureSetting, but that model's feature enum didn't recognize feature_discovery_search yet, so resolution always raised ArgumentError. The completion base already rescues that error, so on SaaS the AI Gateway was silently never reached at all -- Tier 3 quietly no-opped in production.
This MR:
- Registers
feature_discovery_searchin the model-selectionFEATURESvocabulary so resolution succeeds. A blankoffered_model_refalready defers to the Gemini default AI Gateway has configured for this unit primitive, so no explicit ref needs pinning in Rails. Visibility on the Model Selection settings page is gated behind the existing feature flag viaFEATURES_UNDER_FLAGS, since the feature is still internal/experimental. - Adds a short (3s) AI Gateway timeout so a slow or unavailable Gemini degrades to the rules-only tiers instead of blocking the synchronous search request.
- Pushes the feature flag state to AI Gateway per the AI feature playbook.
- Exposes an
ai_search_availablesignal on the search response so a future frontend change can distinguish "no AI results" from "AI search unavailable" without another backend round trip.
Note: this MR is stacked on !242696 (merged) (#603091) since that hasn't merged yet -- the diff here is only the commit on top of it.
References
- Related: https://gitlab.com/gitlab-org/gitlab/-/work_items/603092
- Depends on: !242696 (merged) (https://gitlab.com/gitlab-org/gitlab/-/work_items/603091)
How to set up and validate locally
Same setup as !242696 (merged) (enable feature_library_modal and feature_discovery_gemini_search, simulate SaaS, create a trial group), plus:
- Confirm model-selection resolution no longer raises: in the Rails console,
Ai::FeatureSettingSelectionService.new(user, 'feature_discovery_search', namespace).executeshould return success with aNamespaceFeatureSettingpayload instead of raisingArgumentError. - Confirm a slow/unreachable AI Gateway degrades to
[]within ~3s instead of hanging.