--- name: windows-remote-desktop-connection-doctor description: Diagnose Windows App (Microsoft Remote Desktop / Azure Virtual Desktop / W365) connection quality issues on macOS. Analyze transport protocol selection (UDP Shortpath vs WebSocket), detect VPN/proxy interference with STUN/TURN negotiation, and parse Windows App logs for Shortpath failures. This skill should be used when VDI connections are slow, when transport shows WebSocket instead of UDP, when RDP Shortpath fails to establish, or when RTT is unexpectedly high. allowed-tools: Read, Grep, Bash --- # Windows Remote Desktop Connection Doctor Diagnose and fix Windows App (AVD/WVD/W365) connection quality issues on macOS, with focus on transport protocol optimization. ## Background Azure Virtual Desktop transport priority: **UDP Shortpath > TCP > WebSocket**. UDP Shortpath provides the best experience (lowest latency, supports UDP Multicast). When it fails, the client falls back to WebSocket over TCP 443 through the gateway, adding significant latency overhead. ## Diagnostic Workflow ### Step 1: Collect Connection Info Ask the user to provide the Connection Info from Windows App (click the signal icon in the toolbar). Key fields to extract: | Field | What It Tells | |-------|--------------| | Transport Protocol | Current transport: `UDP`, `UDP Multicast`, `WebSocket`, or `TCP` | | Round-Trip Time (RTT) | End-to-end latency in ms | | Available Bandwidth | Current bandwidth in Mbps | | Gateway | The AVD gateway hostname and port | | Service Region | Azure region code (e.g., SEAS = South East Asia) | If Transport Protocol is `UDP` or `UDP Multicast`, the connection is optimal — no further diagnosis needed. If Transport Protocol is `WebSocket` or `TCP`, proceed to Step 2. ### Step 2: Collect Network Evidence Gather evidence in parallel — do NOT make assumptions. Run the following checks simultaneously: #### 2A: Network Interfaces and Routing ```bash ifconfig | grep -E "^[a-z]|inet |utun" netstat -rn | head -40 scutil --proxy ``` Look for: - **utun interfaces**: Identify VPN/proxy TUN tunnels (ShadowRocket, Clash, Tailscale) - **Default route priority**: Which interface handles default traffic - **Split routing**: `0/1 + 128.0/1 → utun` pattern means a VPN captures all traffic - **System proxy**: HTTP/HTTPS proxy enabled on localhost ports #### 2B: RDP Client Process and Connections ```bash # Find the Windows App process (NOT "msrdc" — the new client uses "Windows" as process name) ps aux | grep -i -E 'msrdc|Windows' | grep -v grep # Check its network connections lsof -i -n -P 2>/dev/null | grep -i "Windows" | head -20 # Check for UDP connections lsof -i UDP -n -P 2>/dev/null | head -30 ``` Key evidence to look for: - **Source IP `198.18.0.x`**: Traffic is being routed through ShadowRocket/proxy TUN tunnel - **No UDP connections from Windows process**: Shortpath not established - **Only TCP 443**: Fallback to gateway WebSocket transport #### 2C: VPN/Proxy State ```bash # Environment proxy variables env | grep -i proxy # System proxy via scutil scutil --proxy # ShadowRocket config API (if accessible on local network) NO_PROXY="" curl -s --connect-timeout 5 "http://:8080/api/read" ``` #### 2D: Tailscale State (if running) ```bash tailscale status tailscale netcheck ``` The `netcheck` output reveals NAT type (`MappingVariesByDestIP`), UDP support, and public IP — valuable even when Tailscale is not the problem. ### Step 3: Analyze Windows App Logs This is the most critical step. Windows App logs contain transport negotiation details that no network-level test can reveal. **Log location on macOS:** ``` ~/Library/Containers/com.microsoft.rdc.macos/Data/Library/Logs/Windows App/ ``` Files are named: `com.microsoft.rdc.macos_v__