Fix: Agentic Chat can be used when Chat model selected

What does this MR do and why?

  • Previously, selecting a model for Chat would disable Agentic Chat in that namespace. This was done intentionally because Agentic Chat does not yet support model selection so it was potentially confusing that it would continue to work with a different model.
  • Instead, we found that this behavior was confusing, that selecting a model for Classic Chat disabled Agentic Chat entirely.
  • With our focus on defaulting to Agentic Chat instead of Classic, this behavior is also problematic. Agentic Chat is the future!
  • Now, we enable Agentic Chat when a model is selected in the UI for Classic Chat and we indicate in the settings Dashboard that this is the case.

References

There is no issue for this, just an issue we ran into locally.

Screenshots or screen recordings

models selected for Chat:

Screenshot_2025-09-11_at_12.07.36_PM

Before After
Agentic Chat not available Screenshot_2025-09-11_at_12.07.53_PM

How to set up and validate locally

Temporarily apply this git diff so you can use Agentic Chat in the Web UI (you may also need to follow these semi-broken instructions AND comment out authorize_additional_context in duo_workflow_service/server.py ):

diff --git a/ee/app/services/ai/model_selection/fetch_model_definitions_service.rb b/ee/app/services/ai/model_selection/fetch_model_definitions_service.rb
index febb7b5af9ae..a48d02cbfded 100644
--- a/ee/app/services/ai/model_selection/fetch_model_definitions_service.rb
+++ b/ee/app/services/ai/model_selection/fetch_model_definitions_service.rb
@@ -78,7 +78,7 @@ def cached_response
 
       def endpoint
         # GitLab Model selection data should always come from cloud connected, never from local AIGW
-        base_url = Gitlab::AiGateway.cloud_connector_url
+        base_url = Gitlab::AiGateway.url
         endpoint_route = 'models%2Fdefinitions'
 
         "#{base_url}/v1/#{endpoint_route}"
diff --git a/workhorse/internal/ai_assist/duoworkflow/handler.go b/workhorse/internal/ai_assist/duoworkflow/handler.go
index 37ba485cb5fc..33aaa9e0afba 100644
--- a/workhorse/internal/ai_assist/duoworkflow/handler.go
+++ b/workhorse/internal/ai_assist/duoworkflow/handler.go
@@ -11,7 +11,11 @@ import (
        "github.com/gorilla/websocket"
 )
 
-var upgrader = websocket.Upgrader{}
+var upgrader = websocket.Upgrader{
+    CheckOrigin: func(r *http.Request) bool {
+        return true
+    },
+}
 
 // Handler creates an HTTP handler for Duo Workflow WebSocket connections.
 func Handler(rails *api.API) http.Handler {

Then, while in SaaS mode, visit your root group with Duo enabled and go to the model selection page. For me this was http://localhost:3000/groups/gitlab-duo/-/settings/gitlab_duo/model_selection

Before this change: updating the model for Chat would make Agentic Chat unavailable on the group.

After this change: updating the model for Chat does not affect Agentic Chat.

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.

Edited by Jessie Young

Merge request reports

Loading