Skip to content

Fix FetchModelDefinitionsService to handle SM

What does this MR do and why?

Fix GraphQL crash in GitLab Duo Self-Hosted model configuration after v18.4 upgrade

Issue: After upgrading to GitLab v18.4, customers lose complete access to Duo Self-Hosted model configuration due to GraphQL errors. The FetchModelDefinitionsService returns nil instead of a ServiceResponse object, causing NoMethodError: undefined method 'payload' for nil:NilClass in the GraphQL resolver.

Root Cause: The service checks the wrong feature flag (:ai_model_switching for group-level selection) when self-managed instances need instance-level model definitions regardless of group-level settings.

Fix:

  1. Remove :ai_model_switching check from FetchModelDefinitionsService - only check duo_features_enabled
  2. Always return ServiceResponse objects (never nil) with graceful error handling
  3. Update GraphQL resolver to safely handle ServiceResponse objects

Impact:

  • Fixes complete Duo feature outage for self-managed customers
  • Allows instance-level model selection without requiring group-level features
  • Provides graceful degradation for network/API errors

Related Issues:

How to set up and validate locally

  • Try to edit or create a self-hosted model, with ai_model_switching FF disabled.

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.

Merge request reports

Loading