Repository navigation
Description
Bug
After running the full uninstall flow (WSL uninstall from tray app followed by MSIX uninstall), two empty directories remain on disk:
%LOCALAPPDATA%\OpenClawTray\wsl\- empty folder (parent of where the VHD lived)%LOCALAPPDATA%\OpenClawTray\- now-empty parent directory
Repro Steps
- Install OpenClaw Tray (MSIX, v0.4.4.0)
- Run through easy-button setup (WSL distro provisions successfully)
- Use tray app - Settings - Remove Local Gateway (WSL uninstall completes)
- Uninstall the MSIX package via Windows Settings
- Inspect
%LOCALAPPDATA%\OpenClawTray\
Expected
%LOCALAPPDATA%\OpenClawTray\ should not exist after uninstall.
Actual
%LOCALAPPDATA%\OpenClawTray\wsl\ remains as an empty directory. The parent OpenClawTray\ folder also persists.
Root Cause
In the 13-step uninstall engine (LocalGatewayUninstall.cs), Step 7 deletes the VHD directory at %LOCALAPPDATA%\OpenClawTray\wsl\OpenClawGateway\ but does not clean up the parent wsl\ directory. After all steps complete, the OpenClawTray\ folder is left behind because it still contains the empty wsl\ subdirectory.
Suggested Fix
After Step 7 removes the VHD subdirectory, also remove the parent wsl\ directory if it is empty. Then, as a final cleanup step, remove the %LOCALAPPDATA%\OpenClawTray\ directory itself if it is empty (i.e., no logs, result files, or other artifacts remain).
// After deleting wsl\OpenClawGateway:
var wslDir = Path.Combine(localAppData, "OpenClawTray", "wsl");
if (Directory.Exists(wslDir) && !Directory.EnumerateFileSystemEntries(wslDir).Any())
{
Directory.Delete(wslDir);
}
// Final cleanup - remove OpenClawTray dir if empty
var appDir = Path.Combine(localAppData, "OpenClawTray");
if (Directory.Exists(appDir) && !Directory.EnumerateFileSystemEntries(appDir).Any())
{
Directory.Delete(appDir);
}The validation script (scripts/validate-wsl-gateway-uninstall.ps1) should also be updated to assert that the wsl\ parent directory is absent after uninstall.
Additional Note
A separate empty temp directory at %LOCALAPPDATA%\Temp\WSLDVCPlugin\OpenClawGateway\ also persists, but since this is in the system Temp folder it is lower priority and will be cleaned up by normal temp maintenance.
Environment
- Windows 11
- OpenClaw Tray v0.4.4.0 (MSIX, test-signed)
- WSL2
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
fix(uninstall): prune empty wsl\ and %LOCALAPPDATA%\OpenClawTray\ pos…
shanselman commentedon May 19, 2026
Thanks @indierawk2k2 ? this is a good catch and the root-cause analysis looks right. Leaving an empty
%LOCALAPPDATA%\OpenClawTray\wsl\keeps the parent%LOCALAPPDATA%\OpenClawTray\around after the MSIX is removed, which makes uninstall feel incomplete even though the VHD itself is gone.I labeled this as
bug. The fix should clean up empty parent directories only when they are truly empty, so we do not remove logs, result files, or any other artifacts the user might still need. The uninstall validation script should also assert thewsl\parent is gone after the WSL distro/VHD cleanup path.fix(uninstall): clean up empty wsl\ parent dir after VHD removal
github-actions commentedon May 20, 2026
🤖 This is an automated response from Repo Assist.
I investigated and implemented the fix described in this issue. The root cause is exactly as @indierawk2k2 identified: Step 5a in
LocalGatewayUninstall.csremoves the distro-specific VHD directory but not thewsl\parent.I have opened a draft PR with:
%LOCALAPPDATA%\OpenClawTray\wsl\if empty after Step 5a (non-empty directories are preserved safely)WslParentDirAbsentpostcondition so the uninstall engine self-validates the fixvalidate-wsl-gateway-uninstall.ps1) to assertwsl_parent_dir_absentin postcondition checksThe
%LOCALAPPDATA%\OpenClawTray\root itself is left for the MSIX uninstaller to clean up once empty, consistent with the existing approach.fix(uninstall): clean up empty WSL parent after VHD removal