Skip to content

Metered network connections support#289126

Draft
Copilot wants to merge 13 commits intomainfrom
copilot/sub-pr-288919
Draft

Metered network connections support#289126
Copilot wants to merge 13 commits intomainfrom
copilot/sub-pr-288919

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

Implements comprehensive metered connection detection and handling to reduce data usage on limited connections (mobile data, tethering, capped plans).

Architecture

Detection & State Flow

Network Information API (Browser)
  ├─ navigator.connection.saveData
  ├─ navigator.connection.metered
  └─ navigator.connection.effectiveType (2g, slow-2g, 3g)
         │
         ▼ onChange event
MeteredConnectionService (Renderer)
  ├─ Monitors network changes
  ├─ Reads update.respectMeteredConnections setting
  └─ isConnectionMetered = network_metered && setting_enabled
         │
         ▼ IPC (METERED_CONNECTION_CHANGED_CHANNEL)
MeteredConnectionMainService (Main Process)
  └─ Used by Update Service (downloads in main process)

When Connection Becomes Metered

All automatic operations pause while retaining explicit user actions:

  • Updates: Auto-checks/downloads skipped, manual "Check for Updates" works
  • Extension Updates: Auto-checks skipped (when reason provided), manual checks work
  • Settings Sync: Auto-sync skipped, manual sync works, resumes when non-metered
  • Telemetry: Events buffered (max 1000), flushed when non-metered
  • Git: Autofetch disabled, post-commit commands skipped, manual operations work

Implementation

Platform Service

  • IMeteredConnectionService: Platform service with isConnectionMetered property
  • Returns true only when network metered AND update.respectMeteredConnections enabled
  • Implementations: browser (navigator.connection), electron-browser (+ IPC to main), electron-main

Integration Points

  • Update Service: checkForUpdates(explicit), downloadUpdate(explicit)
  • Extensions Service: checkForUpdates(reason?) - skips if reason provided
  • UserDataSync: doSync() returns early, resumes via onDidChangeIsConnectionMetered
  • Telemetry: publicLog2() buffers to _meteredBufferedEvents, flushes on recovery
  • Git Extension: AutoFetcher disabled, post-commit commands skipped

Proposed API

env.isConnectionMetered: boolean
env.onDidChangeIsConnectionMetered: Event<boolean>

Status Bar

  • Icon $(radio-tower) shown when metered
  • Tooltip explains paused features
  • Clicking opens update.respectMeteredConnections setting

Setting

  • update.respectMeteredConnections (default: true)
  • When disabled: isConnectionMetered returns false regardless of network state
  • Fires state change event, all systems resume immediately

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add metered network connections support Metered network connections support Jan 20, 2026
Copilot AI requested a review from joaomoreno January 20, 2026 15:24
Base automatically changed from dev/dmitriv/metered-connections to main February 6, 2026 22:52
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.

3 participants