Skip to content

feat: add network slowness detection with configurable threshold#891

Open
EhabY wants to merge 3 commits intomainfrom
feat/slowness-detection-887
Open

feat: add network slowness detection with configurable threshold#891
EhabY wants to merge 3 commits intomainfrom
feat/slowness-detection-887

Conversation

@EhabY
Copy link
Copy Markdown
Collaborator

@EhabY EhabY commented Apr 15, 2026

What this adds

  • New setting coder.networkThreshold.latencyMs (default 250ms, set to 0 to disable) that triggers a yellow status-bar warning when the workspace connection latency crosses the threshold.
  • Warning state is debounced over 2 consecutive polls to avoid flicker on single-sample spikes. Counter drains symmetrically on healthy polls.
  • Clicking the warning runs coder.pingWorkspace (latency diagnostic); tooltip action links also offer direct shortcuts to the ping command and the settings entry for the threshold.

Tooltip layout

  • P2P: $(zap) Directly connected peer-to-peer.
  • Relay: $(broadcast) Connected via <DERP> relay. Will switch to peer-to-peer when available. (preserves the helpful fallback note from the old tooltip)
  • Coder Connect: dedicated message — the CLI only sets using_coder_connect: true and leaves latency/throughput at zero, so the tooltip doesn't render empty metric lines and warnings are suppressed for this path.
  • Slow connection (non-Coder-Connect): adds $(warning) Slow connection detected header + action links ("Run latency test", "Configure threshold").
  • Stale readings: tilde in status bar ((~50ms)) + $(history) footer in the tooltip.
  • Latency line hidden when the reading is 0 (avoids ghost values).

Closes #887

@EhabY EhabY marked this pull request as draft April 15, 2026 09:09
@EhabY EhabY force-pushed the feat/slowness-detection-887 branch from 814b25e to 9187650 Compare April 16, 2026 15:36
@EhabY EhabY self-assigned this Apr 18, 2026
EhabY added 2 commits April 20, 2026 11:40
Extract status bar presentation and threshold logic into networkStatus.ts
with a NetworkStatusReporter class. SshProcessMonitor delegates status bar
updates to the reporter.

Warn users when latency, download, or upload cross configurable thresholds
(debounced over 3 consecutive polls). Clicking the warning runs relevant
diagnostics. Tooltip shows live metrics with codicons and a link to
configure thresholds.
The download_bytes_sec/upload_bytes_sec fields from the Coder CLI
measure actual tunnel traffic during the poll window, not link
capacity. Idle SSH sessions always dipped below the 5 Mbps default
even on fast networks, producing spurious warnings.

Keep latency as the only slowness signal. Display throughput in the
tooltip as informational data only. Replace the warning-icon-mid-line
layout with a bold header, tight metric rows, and an action row
containing explicit Ping workspace and Configure threshold links.
@EhabY EhabY force-pushed the feat/slowness-detection-887 branch from 411f5f8 to 9e4101d Compare April 20, 2026 08:40
- Extract connection label/summary helpers; treat Coder Connect as a
  first-class case (early-return tooltip, explicit warning suppression)
  since the CLI only sets the flag and leaves stats at zero.
- Debounce warning state over 2 consecutive polls (down from 3); drop
  getThresholdConfig and isLatencySlow exports, inline both.
- Tooltip leads with a friendly connection summary, keeps action links
  only when the warning fires, and appends a stale-data footer.
- Rename MockStatusBar to MockStatusBarItem and have it implement the
  vscode.StatusBarItem interface; remove the 'as unknown' cast from
  call sites.
- Share makeNetworkInfo fixture between network and ssh process tests.
- Bump default latency threshold from 200ms to 250ms.
@EhabY EhabY marked this pull request as ready for review April 20, 2026 10:17
@EhabY EhabY changed the title feat: add network slowness detection with configurable thresholds feat: add network slowness detection with configurable threshold Apr 20, 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.

Proactive slowness detection with status bar warning

1 participant