Skip to content

Modernizes extension: native fetch, ESM, and dependency cleanup#4997

Draft
eamodio wants to merge 6 commits intomainfrom
debt/fetch
Draft

Modernizes extension: native fetch, ESM, and dependency cleanup#4997
eamodio wants to merge 6 commits intomainfrom
debt/fetch

Conversation

@eamodio
Copy link
Copy Markdown
Member

@eamodio eamodio commented Feb 21, 2026

Closes #4994

Summary

  • Updates VS Code engine to v1.101.0
  • Migrates from node-fetch to native fetch, replacing https-proxy-agent with VS Code's built-in proxy support and removing the custom gitlens.proxy configuration
  • Removes unused shim patches (debug.js, tr46.js, whatwg-url.js)
  • Removes iconv-lite dependency, replacing it with a delegated decoding mechanism using the workspace's native decoding capabilities
  • Switches extension (node) to ESM

Test plan

  • Verify extension activates and runs correctly in desktop VS Code
  • Verify proxy configuration works through VS Code's built-in proxy settings
  • Verify git operations with non-UTF-8 encoding still decode correctly
  • Verify all fetch-based operations (AI providers, integrations, telemetry) work
  • Verify extension builds and bundles successfully

 - Switches out deprecated method
 - Replaces `https-proxy-agent` with VS Codes built-in proxy support
 - Removes the custom `gitlens.proxy` configuration in favor of standard VS Code and OS proxy settings
 - Replaces the external iconv-lite library with a delegated decoding mechanism using the workspace's native decoding capabilities
@eamodio eamodio added this to the 17.11 milestone Feb 21, 2026
@eamodio eamodio linked an issue Feb 21, 2026 that may be closed by this pull request
@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Feb 21, 2026

🤖 Augment PR Summary

Summary: Modernizes the GitLens extension runtime by moving the Node build to ESM, adopting native fetch, and trimming legacy proxy/encoding dependencies.

Changes:

  • Bumped VS Code engine/types to ^1.101.0
  • Switched the extension entrypoint to dist/gitlens.mjs and updated build outputs to emit .mjs for Node targets
  • Replaced node-fetch-based networking with native globalThis.fetch and simplified request call sites
  • Removed the custom gitlens.proxy setting and dropped https-proxy-agent plumbing
  • Removed iconv-lite and delegated non-UTF8 decoding of git output to workspace.decode
  • Updated various integrations/providers to use explicit JSON casts and refreshed TreeItem icon paths to use Uri

Technical Notes: Node-side SSL-ignore behavior is now implemented by temporarily toggling NODE_TLS_REJECT_UNAUTHORIZED within a wrapper.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 4 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

const alias = {
'@env': path.resolve(__dirname, 'src', 'env', target === 'webworker' ? 'browser' : target),
// Stupid dependency that is used by `http[s]-proxy-agent`
// Stupid dependency that is used by `http[s]-proxy-agent` (via @gitkraken/provider-apis)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esbuild.mjs still aliases debug/tr46/whatwg-url to files under patches/, but those patch files are removed in this PR, so this script will fail to resolve them if it’s used. Consider either keeping the patch shims or removing/updating these aliases consistently.

Severity: medium

Other Locations
  • scripts/esbuild.tests.mjs:43

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

process.env.NODE_TLS_REJECT_UNAUTHORIZED = previousRejectUnauthorized;
_forceInsecureSSL--;
if (_forceInsecureSSL === 0) {
globalThis.process.env.NODE_TLS_REJECT_UNAUTHORIZED = '1';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrapForForcedInsecureSSL toggles NODE_TLS_REJECT_UNAUTHORIZED globally for both ignoreSSLErrors === true and 'force', and then forces it back to '1' rather than restoring the prior value. This can leak TLS-verification state outside the wrapped request if it was previously unset or intentionally '0'.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

const encodingExists = (await import(/* webpackChunkName: "lib-encoding" */ 'iconv-lite')).encodingExists;
return encodingExists(encoding) ? encoding : 'utf8';
function getEncoding(uri: Uri): string {
return configuration.getCore('files.encoding', uri) ?? 'utf8';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getEncoding() now returns whatever files.encoding is set to without checking it’s a supported encoding; downstream workspace.decode(..., { encoding }) may throw for invalid values. Previously this fell back to 'utf8', so it may be worth keeping a guard to avoid breaking git operations on misconfigured settings.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

constructor(public readonly gitUri: GitUri) {
this.uri = gitUri.documentUri;

this.encoding = 'utf-8';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EmptyTextDocument sets encoding = 'utf-8', but other code paths treat 'utf8' as the canonical value (and VS Code’s setting value is typically 'utf8'). If callers compare encodings or feed this into decoding logic, the hyphenated form could be treated as non-standard unexpectedly.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Base automatically changed from debt/provider-apis to main February 23, 2026 13:57
@d13 d13 modified the milestones: 17.11, 17.12 Mar 4, 2026
@gitkraken-services
Copy link
Copy Markdown

⚠️ Rebase Warning

Skipped — rebase produced zero commits, push aborted to protect PR

Summary

Metric Value
Status All commits were dropped during rebase
Target main
Source debt/fetch

What happened? Git determined that all commits in this PR are already included in the target branch (e.g. due to rename detection). The push was skipped to prevent GitHub from auto-closing this PR.


Generated by Merge Mate at 2026-03-09 17:05:52 UTC

@d13 d13 marked this pull request as draft March 10, 2026 20:43
@d13
Copy link
Copy Markdown
Member

d13 commented Mar 10, 2026

Converted to draft as this is not ready yet.

@d13 d13 removed this from the 17.12 milestone Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Raise minimum version to 1.101

2 participants