Follow-up to AIGOV-190, AIGOV-188, and AIGOV-194. Once we have the basic diagnostic commands in place, we should proactively detect slowness and prompt the user to run them, and optionally visualize speedtest results.
1. Proactive slowness detection & notification
When a user is connected to a workspace and experiencing network slowness, the extension should detect this and prompt them to run diagnostic commands (coder ping, coder speedtest, or coder support bundle).
Detection approaches to explore
The extension already has infrastructure we can build on:
NetworkInfo from SshProcessMonitor — The extension already polls a network info JSON file written by the Coder CLI proxy. This provides latency (ms), p2p status, preferred_derp, derp_latency, upload_bytes_sec, and download_bytes_sec. We can set thresholds on these values to trigger notifications.
- Latency threshold: e.g. if
latency consistently exceeds 200ms over several polls, trigger a notification.
- Throughput threshold: e.g. if
download_bytes_sec drops below a certain threshold (indicating degraded tunnel performance).
- P2P fallback: If
p2p is false and latency is high, this could indicate a suboptimal relay path.
- DERP latency spikes — The
derp_latency map gives per-region latencies. A sudden spike in the preferred DERP region could indicate a network issue.
- Connection state transitions — The
WorkspaceMonitor and WorkspaceStateMachine already track workspace state. We could add connection quality as another dimension to monitor.
- VS Code remote reconnection events — When VS Code itself detects a remote connection drop and reconnects, that's a strong signal the user is experiencing issues. We could listen for remote authority reconnection patterns.
Notification UX
When slowness is detected, show an information message like:
"Your workspace connection appears slow (latency: 350ms). Would you like to run diagnostics?"
With action buttons:
- "Run Ping" — executes
Coder: Ping Workspace
- "Run Speed Test" — executes
Coder: Speed Test
- "Create Support Bundle" — executes
Coder: Create Support Bundle
- "Dismiss"
Considerations:
- Avoid notification fatigue — only notify once per session or use a cooldown timer.
- Make the thresholds configurable via extension settings.
- Show the actual detected values in the notification so the user has context.
2. Speedtest JSON visualization in VS Code
The coder speedtest --output json produces interval-based throughput data that lends itself well to visualization. Rather than just saving raw JSON, we could optionally render it in a lightweight webview.
Approach: Lightweight webview with Chart.js
- Use a VS Code webview panel to render a simple line/bar chart of throughput over time intervals.
- Load Chart.js via CDN (secured with CSP nonces) — this is a proven pattern used by other VS Code extensions (e.g. DotCommand analytics dashboard) and keeps the bundle lightweight.
- The webview would show:
- A throughput chart (Mbps over time intervals).
- An overall summary (total throughput, duration, direction).
- Buttons to "Copy JSON" or "Save to File" from within the webview.
Considerations
- This should be opt-in or offered as an alternative to the save dialog (e.g. "View Results" button alongside "Save to File" after the speed test completes).
- Keep it lightweight — no heavy frameworks. Vanilla JS + Chart.js CDN is sufficient.
- If Chart.js is too heavy, a simple ASCII-style bar chart rendered in a VS Code virtual document could also work as a minimal alternative.
Related issues
- AIGOV-190 —
coder ping command (base implementation)
- AIGOV-188 —
coder speedtest command (base implementation)
- AIGOV-194 —
coder support bundle command (base implementation)
Created on behalf of @EhabY
Follow-up to AIGOV-190, AIGOV-188, and AIGOV-194. Once we have the basic diagnostic commands in place, we should proactively detect slowness and prompt the user to run them, and optionally visualize speedtest results.
1. Proactive slowness detection & notification
When a user is connected to a workspace and experiencing network slowness, the extension should detect this and prompt them to run diagnostic commands (
coder ping,coder speedtest, orcoder support bundle).Detection approaches to explore
The extension already has infrastructure we can build on:
NetworkInfofromSshProcessMonitor— The extension already polls a network info JSON file written by the Coder CLI proxy. This provideslatency(ms),p2pstatus,preferred_derp,derp_latency,upload_bytes_sec, anddownload_bytes_sec. We can set thresholds on these values to trigger notifications.latencyconsistently exceeds 200ms over several polls, trigger a notification.download_bytes_secdrops below a certain threshold (indicating degraded tunnel performance).p2pisfalseand latency is high, this could indicate a suboptimal relay path.derp_latencymap gives per-region latencies. A sudden spike in the preferred DERP region could indicate a network issue.WorkspaceMonitorandWorkspaceStateMachinealready track workspace state. We could add connection quality as another dimension to monitor.Notification UX
When slowness is detected, show an information message like:
With action buttons:
Coder: Ping WorkspaceCoder: Speed TestCoder: Create Support BundleConsiderations:
2. Speedtest JSON visualization in VS Code
The
coder speedtest --output jsonproduces interval-based throughput data that lends itself well to visualization. Rather than just saving raw JSON, we could optionally render it in a lightweight webview.Approach: Lightweight webview with Chart.js
Considerations
Related issues
coder pingcommand (base implementation)coder speedtestcommand (base implementation)coder support bundlecommand (base implementation)Created on behalf of @EhabY