|
| 1 | +# Uninstalling OpenClaw Tray — MSIX Package |
| 2 | + |
| 3 | +> **Date:** 2026-05-07 |
| 4 | +> **Branch:** feat/wsl-gateway-uninstall |
| 5 | +
|
| 6 | +--- |
| 7 | + |
| 8 | +## MSIX Cannot Auto-Clean WSL State |
| 9 | + |
| 10 | +**Feasibility verdict:** `runFullTrust` MSIX packages do **not** support a |
| 11 | +`CustomInstall` / `CustomUninstall` extension that runs an arbitrary EXE |
| 12 | +at uninstall time. The supported extension points |
| 13 | +(`windows.startupTask`, `windows.appExecutionAlias`, `com.extension`, |
| 14 | +`windows.protocol`, etc.) do not include an uninstall hook. |
| 15 | + |
| 16 | +Therefore, removing the MSIX package via **Settings → Apps → OpenClaw Tray |
| 17 | +→ Uninstall** will silently leave behind: |
| 18 | + |
| 19 | +- **WSL distro** — `OpenClawGateway` remains in `wsl --list`. |
| 20 | +- **Roaming app data** under `%APPDATA%\OpenClawTray\` (device key, settings, |
| 21 | + mcp-token). |
| 22 | +- **Local app data** under `%LOCALAPPDATA%\OpenClawTray\` (setup state, logs, |
| 23 | + VHD parent directory). |
| 24 | + |
| 25 | +> **Note:** If the tray was installed with MSIX and the data landed in the |
| 26 | +> package-virtualized path (`%LOCALAPPDATA%\Packages\OpenClaw.Tray_<hash>\...`) |
| 27 | +> instead of real `%APPDATA%`, those directories are removed automatically by |
| 28 | +> MSIX on uninstall. Bostick's commit 7 validation test (Path A vs Path B) |
| 29 | +> confirms which layout applies. |
| 30 | +
|
| 31 | +--- |
| 32 | + |
| 33 | +## Recommended: Run "Remove Local Gateway" Before Uninstalling MSIX |
| 34 | + |
| 35 | +1. Open the tray icon. |
| 36 | +2. Navigate to **Settings → Local Gateway**. |
| 37 | +3. Click **"Remove Local Gateway"** (Mattingly's warning banner in commit 4 |
| 38 | + surfaces this step for MSIX users). |
| 39 | +4. Wait for the engine to complete — it stops keepalive processes, unregisters |
| 40 | + the WSL distro, nulls the device token, removes autostart, and cleans up app |
| 41 | + data. |
| 42 | +5. Uninstall the MSIX package via **Settings → Apps**. |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Manual Recovery (After MSIX Removed Without In-Tray Cleanup) |
| 47 | + |
| 48 | +If the MSIX was already removed and the WSL distro / app data remains: |
| 49 | + |
| 50 | +```powershell |
| 51 | +# 1. Unregister the distro (removes .vhdx from wsl's internal store) |
| 52 | +wsl --unregister OpenClawGateway |
| 53 | +
|
| 54 | +# 2. Remove VHD parent directory (wsl --unregister may leave the folder) |
| 55 | +Remove-Item "$env:LOCALAPPDATA\OpenClawTray\wsl\OpenClawGateway" ` |
| 56 | + -Recurse -Force -ErrorAction SilentlyContinue |
| 57 | +
|
| 58 | +# 3. Remove autostart registry entry |
| 59 | +Remove-ItemProperty ` |
| 60 | + -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" ` |
| 61 | + -Name "OpenClawTray" -ErrorAction SilentlyContinue |
| 62 | +
|
| 63 | +# 4. Remove local app data (setup state, logs) |
| 64 | +Remove-Item "$env:LOCALAPPDATA\OpenClawTray" -Recurse -Force -ErrorAction SilentlyContinue |
| 65 | +
|
| 66 | +# 5. Remove roaming app data (settings, device key — only if you want full purge) |
| 67 | +# NOTE: mcp-token.txt is intentionally preserved here; delete manually if needed. |
| 68 | +Remove-Item "$env:APPDATA\OpenClawTray\setup-state.json" -Force -ErrorAction SilentlyContinue |
| 69 | +``` |
| 70 | + |
| 71 | +Or use the validation script if it is available separately: |
| 72 | + |
| 73 | +```powershell |
| 74 | +.\validate-wsl-gateway-uninstall.ps1 -Mode Full -ConfirmDestructive |
| 75 | +``` |
0 commit comments