Update AgenticChatModelMetadataService to use dev_selectable_models for model validation
Summary
After !210909 (merged) is merged, the AgenticChatModelMetadataService needs to be updated to properly validate user-selected models against the list that includes dev_selectable_models for GitLab team members.
Background
Currently, AgenticChatModelMetadataService uses ModelDefinitionResponseParser to fetch and parse the list of selectable models from AI Gateway. This parser does not yet account for dev_selectable_models that are available only to GitLab team members.
The service performs an invalid_user_selected_model_identifier? check to prevent users from tampering with request params to use unauthorized models (e.g., forcing Claude Opus 4.1 when it's not allowed). However, this validation will not work correctly for team-member-only models after !210909 (merged) is merged.
Proposed Solution
Update the model validation logic in AgenticChatModelMetadataService to use Gitlab::Graphql::Representation::ModelSelection::FeatureSetting.decorate instead of ::Gitlab::Ai::ModelSelection::ModelDefinitionResponseParser. This will ensure the validation uses the same logic that merges dev_selectable_models based on GitLab team membership.
Reference
- Original note: !210909 (comment 2905091353)
- Parent MR: !210909 (merged)
- File to update:
ee/app/services/ai/duo_workflows/agentic_chat_model_metadata_service.rb(line 123)