GitLab Duo Chat fails to initialize in remote environments
Overview
GitLab Duo Chat webview fails to initialize when using VS Code with Remote Development extensions, causing timeout errors and preventing users from accessing the main Chat panel functionality.
Description
When attempting to open GitLab Duo Chat in VS Code Remote SSH or WSL sessions, the webview fails to initialize within the hardcoded 10-second timeout, resulting in the error The webview didn't initialize in 10000ms
. This affects the main Duo Chat panel.
Impacted offerings:
- GitLab.com
- GitLab Dedicated
- GitLab Self-Managed
Impacted versions:
GitLab VS Code Extension: 6.8.0 and later
VS Code: All versions with Remote Development extensions (Remote SSH, Remote WSL)
Resolution
In VS Code, on the top bar, go to Code > Settings > Settings.
- On the top right corner, select Open Settings (JSON) to edit your
settings.json
file.- Alternatively, press F1, enter Preferences: Open Settings (JSON), and select it.
- Add or modify this setting:
"gitlab.featureFlags.languageServerWebviews": false
- Save your changes and reload VS Code.
Cause
The webview initialization timeout is hardcoded to 10 seconds in `duo_chat_controller.ts`. Remote environments introduce additional latency that exceeds this timeout period. The extension may also attempt to incorrectly connect to a 127.0.0.1 address.
Symptom
- Error message: "The webview didn't initialize in 10000ms"
- Blank or non-loading Chat panel in sidebar
- Extension logs show timeout errors in remote SSH/WSL environments
- Quick Chat functionality remains operational
Root Cause
Hardcoded timeout constant `WAIT_TIMEOUT_MS = 10000` in the GitLab VS Code extension's duo_chat_controller.ts file does not account for the additional latency introduced by remote development environments. The extension may also attempt to connect to inaccessible localhost addresses in remote contexts.
Related Links
- [GitLab VS Code Extension Issue #1943](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/1943)
- [Related Issue #1944](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/1944)
- [VS Code Troubleshooting Documentation](https://docs.gitlab.com/editor_extensions/visual_studio_code/troubleshooting/#known-issue-gitlab-duo-chat-fails-to-initialize-in-remote-environments)