GitLab Duo Chat fails to initialize in VS Code Remote SSH environments
### Checklist - [x] I'm using the latest version of the extension - Extension version: 6.10.0 - [x] I'm using the latest VS Code version - VS Code version: 1.99.3 - [x] I'm using a supported version of GitLab - GitLab version: happens on `gitlab.com` ### Summary GitLab Duo Chat fails to initialize when using VS Code with Remote Development SSH extension, showing a timeout error: "The webview didn't initialize in 10000ms". This only affects the main Duo Chat panel - Quick Chat functionality works correctly in the same environment. ### Steps to reproduce 1. Install VS Code with Remote Development SSH extension 2. Connect to a remote server (e.g., EC2 instance in `ap-northeast-1`) 3. Open a project in the remote environment 4. Try to open GitLab Duo Chat panel from the sidebar 5. Observe the error: "The webview didn't initialize in 10000ms" ### What is the current _bug_ behavior? When attempting to open GitLab Duo Chat in a VS Code Remote SSH session, the webview fails to initialize within the [hardcoded](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/main/src/common/webview/duo_chat/duo_chat_controller.ts#L9) 10-second timeout, resulting in an error message. The chat panel shows an error screen instead of loading properly. ### What is the expected _correct_ behavior? GitLab Duo Chat should initialize successfully in Remote SSH environments, possibly with an extended timeout to accommodate the additional latency introduced by the distant SSH connection. ### Relevant logs and/or screenshots Error from the extension log: ``` 2025-04-17T10:57:19:416 [error]: { "userMessage": "The webview didn't initialize in 10000ms", "errorMessage": "The webview didn't initialize in 10000ms", "stack": [ "Error: The webview didn't initialize in 10000ms", " at Timeout.<anonymous> (/home/ec2-user/.vscode-server/extensions/src/common/webview/duo_chat/duo_chat_controller.ts:73:18)", " at listOnTimeout (node:internal/timers:581:17)", " at processTimers (node:internal/timers:519:7)" ] } ``` ### Possible fixes The issue is in `duo_chat_controller.ts` where the timeout is hardcoded to 10 seconds: https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/main/src/common/webview/duo_chat/duo_chat_controller.ts#L9 ```typescript const WAIT_TIMEOUT_MS = 10000; ``` This constant is tested against where the error is raised: https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/main/src/common/webview/duo_chat/duo_chat_controller.ts#L71-73 ```typescript } else if (Date.now() - startTime >= WAIT_TIMEOUT_MS) { clearInterval(interval); reject(new Error(`The webview didn't initialize in ${WAIT_TIMEOUT_MS}ms`)); ``` Possible fixes: 1. Make the timeout configurable via VS Code settings 2. Automatically extend the timeout when running in Remote SSH environments 3. Implement a progressive timeout that increases with retry attempts The current user setting `gitlab.webviewTimeoutSeconds` mentioned in https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/merge_requests/2497+ doesn't affect this particular timeout because it's hardcoded in the controller. ### Workaround See our troubleshooting [documentation](https://docs.gitlab.com/editor_extensions/visual_studio_code/troubleshooting/#known-issue-gitlab-duo-chat-fails-to-initialize-in-remote-environments) for a workaround.
issue