Loading
chore: re-enable HTTP keep-alive with dynamic Node version check
Description
Re-enables HTTP keep-alive by checking the Node.js version at runtime, instead of unconditionally disabling it.
Background: VS Code 1.128.0 ships Electron 42.5.0 with Node 24.17.0, which introduced a regression in http.Agent keep-alive socket handling that breaks node-fetch v2 gzip/chunked responses, causing authentication failures (#2306 (closed)). The fix was released in Node 24.18.0.
What this MR does:
- Adds
isKeepAliveAffectedNodeVersion()— a utility that returnstrueonly for Node 24.17.x (the affected minor version). - Updates
getHttpAgentOptions()to setkeepAlive: !isKeepAliveAffectedNodeVersion()— keep-alive is disabled only on the affected version, and enabled on all others. - Adds a
keepAliveoption toDefaultApiClientOptionsto conditionally send theConnection: keep-aliveheader (working around the VS Code proxy issue at https://github.com/microsoft/vscode/issues/173861). - Passes
keepAlive: !isKeepAliveAffectedNodeVersion()fromGitLabServicewhen constructing the API client. - Adds unit tests for the version detection utility and the
keepAliveoption inDefaultApiClient.
Result:
- Users on VS Code 1.128.0 (Node 24.17.0) continue to have keep-alive disabled as a workaround.
- Users on newer VS Code versions (Node 24.18.0+) benefit from keep-alive being re-enabled, restoring performance.
Related Issues
Resolves #2307 (closed)
How has this been tested?
- Unit tests added for
isKeepAliveAffectedNodeVersion()covering Node 24.17.x (affected), Node 24.18.0+ (fixed), and unrelated major versions.- Unit tests added/updated for
DefaultApiClientto verifyConnection: keep-aliveheader is sent whenkeepAlive: trueand absent whenkeepAlive: false.
- Unit tests added/updated for
- If
src/browserorsrc/commonhas been modified, please consider interoperability with the Web IDE. See Running the Extension in WebIDE. - Consider an end-to-end test for significant new features that aren't covered by integration tests.
- Install VSCode 1.128 version from https://code.visualstudio.com/updates/v1_128
- Link this MR with gitlab-org/editor-extensions/gitlab-lsp!3847 (merged)
- Run the extension locally and verify authentication works and Duo Agentic Chat loads without any token issue.
I also manually tested against latest VSCode version 1.132.0 and 1.127.0 confirming that versions before and after the affected one correctly set keep-alive to true and work without issue.
Screenshots (if appropriate)
N/A
What CHANGELOG entry will this MR create?
-
fix:Bug fix fixes - a user-facing issue in production - included in changelog -
feature:New feature - a user-facing change which adds functionality - included in changelog -
BREAKING CHANGE:(fix or feature that would cause existing functionality to change) - should bump major version, mentioned in the changelog - None - other non-user-facing changes
Edited by Juhee Lee