Skip to content

Metered network connections support#288919

Merged
dmitrivMS merged 53 commits intomainfrom
dev/dmitriv/metered-connections
Feb 6, 2026
Merged

Metered network connections support#288919
dmitrivMS merged 53 commits intomainfrom
dev/dmitriv/metered-connections

Conversation

@dmitrivMS
Copy link
Contributor

@dmitrivMS dmitrivMS commented Jan 19, 2026

Fixes #103451

Includes public API, user setting, status bar icon and a new service to support metered network connections.
Updates code in various areas performing automated actions using network to delay/pause network operations while network connection is being metered.

While connection is metered:

  • Automatic update downloads (but not checks) will be paused unless the user takes explicit action to download.
  • Automatic extension updates will be paused unless user takes explicit action to update.
  • User settings sync will be paused unless explicitly invoked by the user.
  • Git auto-sync operations will be paused (skipped) unless explicitly invoked by the user.
  • Telemetry upload will be paused.

Once connection is no longer metered, all automatic operations will resume on their normal schedule/triggers.

Status bar update:
image

New user setting:
update.respectMeteredConnections
image

Copilot AI review requested due to automatic review settings January 19, 2026 15:44
@dmitrivMS dmitrivMS added the install-update VS Code installation and upgrade system issues label Jan 19, 2026
@dmitrivMS dmitrivMS requested a review from joaomoreno January 19, 2026 15:44
@dmitrivMS dmitrivMS self-assigned this Jan 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements comprehensive support for detecting and respecting metered network connections (such as mobile data or tethering) to reduce data usage on limited connections.

Changes:

  • Adds new proposed API env.isConnectionMetered and env.onDidChangeIsConnectionMetered for extensions
  • Implements metered connection detection using the Network Information API with fallback logic
  • Pauses automatic operations (updates, extension updates, Settings Sync, telemetry, and Git operations) when on metered connections
  • Adds status bar indicator when a metered connection is detected

Reviewed changes

Copilot reviewed 45 out of 46 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/vscode-dts/vscode.proposed.envIsConnectionMetered.d.ts Defines proposed API for metered connection detection
src/vs/platform/meteredConnection/common/meteredConnection.ts Core service interface and Network Information API types
src/vs/platform/meteredConnection/browser/meteredConnectionService.ts Browser implementation monitoring navigator.connection
src/vs/platform/meteredConnection/electron-browser/meteredConnectionService.ts Electron renderer implementation with IPC to main process
src/vs/platform/meteredConnection/electron-main/meteredConnectionMainService.ts Electron main process service receiving IPC updates
src/vs/workbench/api/common/extHostMeteredConnection.ts Extension host implementation for proposed API
src/vs/workbench/api/browser/mainThreadMeteredConnection.ts Main thread bridge for extension API
src/vs/workbench/contrib/meteredConnection/browser/meteredConnectionStatus.ts Status bar indicator when metered
src/vs/platform/update/electron-main/abstractUpdateService.ts Skips automatic update checks/downloads on metered connections
src/vs/platform/telemetry/common/telemetryService.ts Buffers telemetry events when metered, flushes when recovered
src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts Skips automatic extension update checks on metered connections
src/vs/platform/userDataSync/common/userDataAutoSyncService.ts Skips Settings Sync on metered connections
extensions/git/src/autofetch.ts Disables Git autofetch on metered connections
extensions/git/src/postCommitCommands.ts Skips automatic post-commit operations on metered connections
src/vs/platform/update/common/update.config.contribution.ts Adds update.respectMeteredConnections configuration setting
src/vs/workbench/workbench.*.main.ts Registers metered connection services in workbench layers
src/vs/code/electron-main/app.ts Sets up IPC handling for metered connection status updates
Comments suppressed due to low confidence (1)

src/vs/platform/meteredConnection/browser/meteredConnectionService.ts:56

  • The configuration value is read at the end of the constructor after event listeners are set up. This creates a timing issue where if the configuration changes between lines 55-56, the event listener (lines 45-53) might fire before the initial value is set. This could cause the service to fire an event with stale data. Consider reading the configuration value before setting up the change listener, or ensure the initial event firing happens consistently.
		this._register(this.configurationService.onDidChangeConfiguration(e => {
			if (e.affectsConfiguration(METERED_CONNECTION_SETTING_KEY)) {
				const value = this.configurationService.getValue<boolean>(METERED_CONNECTION_SETTING_KEY);
				if (this._respectMeteredConnections !== value) {
					this._respectMeteredConnections = value;
					this._onDidChangeIsConnectionMetered.fire(this.isConnectionMetered);
				}
			}
		}));

		this._respectMeteredConnections = this.configurationService.getValue<boolean>(METERED_CONNECTION_SETTING_KEY);
		this._isConnectionMetered = getIsConnectionMetered();

@dmitrivMS dmitrivMS requested a review from deepak1556 January 19, 2026 17:04
@dmitrivMS dmitrivMS marked this pull request as ready for review January 19, 2026 21:23
@vs-code-engineering
Copy link

vs-code-engineering bot commented Jan 19, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@rzhao271

Matched files:

  • src/vs/workbench/contrib/preferences/browser/settingsLayout.ts

@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 19, 2026
@joaomoreno
Copy link
Member

@copilot Show me diagrams explaining the flows here. What happens when a user goes into a metered connection? Which systems are affected? What happens when a user disables respecting metered connection state?

Copy link
Contributor

Copilot AI commented Jan 20, 2026

@joaomoreno I've opened a new pull request, #289126, to work on those changes. Once the pull request is ready, I'll request review from you.

@joaomoreno
Copy link
Member

FYI kicked off a new build for testing: https://dev.azure.com/monacotools/Monaco/_build/results?buildId=394456&view=results

sandy081
sandy081 previously approved these changes Feb 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 50 out of 51 changed files in this pull request and generated 2 comments.

@dmitrivMS dmitrivMS merged commit fa6cfe1 into main Feb 6, 2026
59 of 62 checks passed
@dmitrivMS dmitrivMS deleted the dev/dmitriv/metered-connections branch February 6, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

install-update VS Code installation and upgrade system issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposed API for metered network connection support Support metered connections

7 participants