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:

  1. Adds isKeepAliveAffectedNodeVersion() — a utility that returns true only for Node 24.17.x (the affected minor version).
  2. Updates getHttpAgentOptions() to set keepAlive: !isKeepAliveAffectedNodeVersion() — keep-alive is disabled only on the affected version, and enabled on all others.
  3. Adds a keepAlive option to DefaultApiClientOptions to conditionally send the Connection: keep-alive header (working around the VS Code proxy issue at https://github.com/microsoft/vscode/issues/173861).
  4. Passes keepAlive: !isKeepAliveAffectedNodeVersion() from GitLabService when constructing the API client.
  5. Adds unit tests for the version detection utility and the keepAlive option in DefaultApiClient.

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.

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 DefaultApiClient to verify Connection: keep-alive header is sent when keepAlive: true and absent when keepAlive: false.
  • If src/browser or src/common has 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.
  1. Install VSCode 1.128 version from https://code.visualstudio.com/updates/v1_128
  2. Link this MR with gitlab-org/editor-extensions/gitlab-lsp!3847 (merged)
  3. 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

Merge request reports

Loading
Loading