Breaking change: Remove fallback mechanism to Duo chat model for Duo chat subfeatures

Related to the code here:

          def chat_feature_setting(unit_primitive: nil)
            unless Feature.enabled?(:ai_duo_chat_sub_features_settings) # rubocop:disable Gitlab/FeatureFlagWithoutActor -- The feature flag is global
              return ::Ai::FeatureSetting.find_by_feature(:duo_chat)
            end

            feature_name = unit_primitive ? :"duo_chat_#{unit_primitive}" : :duo_chat
            feature_setting = ::Ai::FeatureSetting.find_by_feature(feature_name)

            # fallback to duo_chat if sub feature setting is not found
            feature_setting ||= ::Ai::FeatureSetting.find_by_feature(:duo_chat)

            feature_setting
          end

Historically, Duo chat has been just one feature. But now, we have split it down to sub-features like explain code and this is the direction we will be pursuing from now on.

Based on the code above, feature_setting record for features like explain code will fallback to duo_chat's feature_setting record, if no model has been set for explain code.

Screenshot_2025-03-17_at_12.42.24_PM

The above screenshot represents the state after sub-features have been implemented. We did not carry over the model settings of Duo chat to all the sub-features, so by default, they have no model selected when they were introduced.

Based on the above screenshot, explain code and other subfeatures will fallback to Duo Chat's Claude Sonnet on Bedrock model.

And this can remain in such a state, until an admin logs in and assigns a model to all sub-features.

Code like

            # fallback to duo_chat if sub feature setting is not found
            feature_setting ||= ::Ai::FeatureSetting.find_by_feature(:duo_chat)

is tech-debt, and we should not allow it to remain for long if different model per sub-feature is the direction we are going to follow:

Proposal

  • Make this a breaking change. ie, we announce before 18.0 that it is necessary that all sub-features requires its own model to work, and that fallback to Duo Chat's model will not work after 18.0
  • Remove the fallback code in 18.0
Edited by Manoj M J [OOO]