GitLab Duo Chat fails to initialize in VS Code Web environment
Checklist
-
I'm using the latest version of the extension (see the latest version in the right column of this page) - Extension version: v6.8.0
-
I'm using the latest VS Code version (find the latest version here) - VS Code version: v_1.93.0_
-
I'm using a supported version of GitLab (see README for the supported version) - GitLab version: happens on
gitlab.com
- GitLab version: happens on
Summary
GitLab Duo Chat fails to load in VSCode for Web environments such as GitLab Workspaces and GitPod and very likely GitHub codespaces.
Steps to reproduce
In GitLab Workspaces, the GitLab VSCode Extension is not updated yet because of this bug. The following instructions explain how to launch the extension in a Workspace in debug mode.
- Create a Workspace https://gitlab.com/-/remote_development/workspaces/new?project=gitlab-org%2Fgitlab-vscode-extension&gitRef=main
- In the project reference field, choose version 6.8.0.
- Open the Workspace and wait until it is fully initialized (deps installed, etc.).
- Go to the debug panel in VSCode and click on "Build and Debug".
- Wait until VSCode shows you the "Debug anyway" button, then click it.
- A new VSCode window will open in a separate web browser tab.
- Open Duo Chat.
- The web view never loads.
In GitPod
- Create a new workspace in GitPod. The following link creates a Workspace for the GitLab UI project: https://gitpod.io/new/#https://gitlab.com/gitlab-org/gitlab-ui/-/tree/main/.
- Install the GitLab Workflow Extension.
- Authenticate using OAuth or access token.
- Open Duo Chat.
- The web view never loads.
What is the current bug behavior?
GitLab Duo Chat never loads.
What is the expected correct behavior?
I can use the GitLab Duo Chat feature.
Proposal
- Detect which environment each user is in: desktop vs. web, and adjust the feature visibility and loading method
Relevant logs and/or screenshots
GitLab Workspaces | GitPod |
---|---|
![]() |
![]() |
Relevant logs
In the Web Browser, GitLab VSCod Extension attempts to establish a connection to the URL:
http://127.0.0.1:40817/webview/duo-chat-v2
This URL is not accessible because the Web View server is running in the Remote Machine and the Web Browser cannot access directly to it.
Possible fixes
See the following documentation describes how to implement Web Views in a way that ensures they will work in a remote development environment: https://code.visualstudio.com/api/advanced-topics/remote-extensions#use-the-message-passing-api-for-dynamic-webview-content.