Skip to content

network: use native metered connection detection - #331897

Draft
Dmitriy Vasyura (dmitrivMS) wants to merge 14 commits into
mainfrom
dev/dmitriv/use-vscode-metered
Draft

Dmitriy Vasyura (dmitrivMS) wants to merge 14 commits into
mainfrom
dev/dmitriv/use-vscode-metered

Conversation

@dmitrivMS

@dmitrivMS Dmitriy Vasyura (dmitrivMS) commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Fixes #321334
Fixes #330586

  • Add the published @vscode/metered dependency and use its native monitor in Electron main.
  • Propagate initial state and runtime changes to renderer/shared processes with explicit whenInitialized readiness; keep browser Network Information detection scoped to vscode.dev.
  • Include product-update service/readiness changes, the metered status UI, and extension API state propagation.
  • Remove existing telemetry-metered coupling in both directions (will be done in a separate PR).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 21, 2026 03:56
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added the network Network related issues label Aug 21, 2026
@dmitrivMS Dmitriy Vasyura (dmitrivMS) changed the title meteredConnection: use native platform monitor Use native metered connection monitor Aug 21, 2026

Copilot AI commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Install dependencies

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Uses native OS metered-connection detection on desktop while retaining browser detection for vscode.dev.

Changes:

  • Adds @vscode/metered monitoring and IPC propagation.
  • Refactors browser and Electron metered services.
  • Adds packaging configuration and regression tests.
Show a summary per file
File Description
src/vs/platform/meteredConnection/test/electron-main/meteredConnectionMainService.test.ts Tests native monitoring lifecycle and updates.
src/vs/platform/meteredConnection/test/electron-browser/meteredConnectionService.test.ts Tests IPC state synchronization.
src/vs/platform/meteredConnection/electron-main/meteredConnectionMainService.ts Implements native OS monitoring.
src/vs/platform/meteredConnection/electron-main/meteredConnectionChannel.ts Removes renderer-to-main state updates.
src/vs/platform/meteredConnection/electron-browser/meteredConnectionService.ts Uses the main-process IPC state.
src/vs/platform/meteredConnection/common/meteredConnectionIpc.ts Updates IPC commands and synchronization.
src/vs/platform/meteredConnection/common/meteredConnection.ts Generalizes underlying connection state.
src/vs/platform/meteredConnection/browser/meteredConnectionService.ts Scopes browser detection to web.
src/vs/platform/environment/test/node/nativeModules.integrationTest.ts Verifies native module loading.
src/vs/code/electron-main/app.ts Wires the native main service.
package.json Adds and allowlists the dependency.
package-lock.json Locks native module dependencies.
eslint.config.js Allowlists the module import.
build/.moduleignore Packages the native binary.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 13/14 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread src/vs/platform/meteredConnection/common/meteredConnectionIpc.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 34/36 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread src/vs/code/electron-main/app.ts Outdated

Copilot AI commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Install dependencies

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verified the diff. Changes align with project standards.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Base: ac717e6c Current: 51adc90f

No screenshot changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Install dependencies

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Sysrooted Linux linking is broken, prerequisites are missing from other Linux build paths, and the proposed API documentation needs initialization qualification.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity · 2 Medium severity

New issues introduced by this change (2)
Severity Finding
High severity package.json — Adding this native addon currently breaks Linux dependency installation under VS Code's sysrooted…
Medium severity package.json — The Linux build dependency for this native package is only added to three workflows. Other…
Pre-existing issues (1)
Severity Finding
Medium severity src/​vs/​code/​electron-main/​app.ts — This wires telemetry only into the metered service; the main-process TelemetryService config at… View comment

Comment thread package.json
Comment thread package.json
Comment thread src/vs/code/electron-main/app.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

A critical buffering flaw can transmit telemetry generated while the connection was metered.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity src/​vs/​platform/​telemetry/​common/​telemetryService.ts — Buffered events are classified only from the connection state at flush time. If the native monitor…
Issues resolved since last review (3)
Severity Finding
Medium severity package.json — The Linux build dependency for this native package is only added to three workflows. Other… View resolved comment
High severity package.json — Adding this native addon currently breaks Linux dependency installation under VS Code's sysrooted… View resolved comment
Medium severity src/​vs/​code/​electron-main/​app.ts — This wires telemetry only into the metered service; the main-process TelemetryService config at… View resolved comment

Comment thread src/vs/platform/telemetry/common/telemetryService.ts Outdated
Comment thread src/vs/platform/telemetry/common/telemetryService.ts
Comment thread build/.moduleignore
Comment thread src/vs/platform/meteredConnection/common/meteredConnectionIpc.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dmitrivMS Dmitriy Vasyura (dmitrivMS) changed the title Use native metered connection monitor Use native metered detection and pause desktop telemetry Sep 18, 2026
Comment thread src/vs/platform/meteredConnection/common/meteredConnection.config.contribution.ts Outdated
Comment thread src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts Outdated
Keep native detection, packaging, initialization, defaults and update handling in the primary PR. Move telemetry, Settings Sync, plugin updates and extension auto-updates to separate stacked changes.

Temporarily remove existing telemetry metered gating and state-change instrumentation so the primary branch is independent of the telemetry integration. Default auto-detection to Insiders only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the Insiders-only default condition so all build qualities retain auto detection. Compare the configured extension auto-update preference, not network-gated availability, before an explicit preference change.

Cover pending native initialization, metered enablement, cancellation and redundant actions while preserving conservative gating for automatic requests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The IPC client silently corrects its provisional state, leaving event-driven background services suspended on initially unmetered connections.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)


this.whenInitialized = channel.call<boolean>(MeteredConnectionCommand.IsConnectionMetered).then(value => {
if (!receivedEvent) {
this._isConnectionMetered = value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

network Network related issues

Projects

None yet

3 participants