[Repo Assist] fix(uninstall): clean up empty wsl\ parent dir after VHD removal#472
Draft
github-actions[bot] wants to merge 1 commit into
Draft
Conversation
After Step 5a removes the distro-specific VHD directory (e.g. %LOCALAPPDATA%\OpenClawTray\wsl\OpenClawGateway\), the parent wsl\ directory was left as an empty orphan, which also prevented the %LOCALAPPDATA%\OpenClawTray\ directory from being removed by the MSIX uninstaller. Changes: - Add Step 5b in LocalGatewayUninstall.cs: after VHD parent dir cleanup, delete the wsl\ parent directory if it is empty. Non-empty wsl\ dirs (e.g. other distros still present) are preserved safely. - Add WslParentDirAbsent postcondition; include it in AllRequiredPostconditionsMet and AppendPostconditionErrors. - Update validate-wsl-gateway-uninstall.ps1: add wsl_parent_dir path constant, include wsl_parent_dir_absent in postconditions and required-checks list, and capture it in the pre-state snapshot. - Add 3 unit tests (WslParentDirCleanup_*) covering empty→deleted, non-empty→skipped, and already-absent→skipped scenarios. Closes #467 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
After the WSL uninstall flow removes the distro-specific VHD directory (
%LOCALAPPDATA%\OpenClawTray\wsl\OpenClawGateway\), the parentwsl\directory was left as an empty orphan. This prevented the MSIX uninstaller from removing%LOCALAPPDATA%\OpenClawTray\cleanly.Closes #467
Root Cause
Step 5a in
LocalGatewayUninstall.cscallsDirectory.Delete(vhdDir, recursive: true)on the distro-specific subdirectory but does not clean up thewsl\parent. After all 13 steps complete, the emptywsl\directory holds%LOCALAPPDATA%\OpenClawTray\open, so it survives MSIX uninstall.Fix
LocalGatewayUninstall.cs: after VHD parent dir cleanup, delete thewsl\parent directory if it is empty. Non-emptywsl\dirs (e.g. other distros still present) are preserved safely.WslParentDirAbsentpostcondition added; included inAllRequiredPostconditionsMetandAppendPostconditionErrors.validate-wsl-gateway-uninstall.ps1updated: added$wslParentDirPath,wsl_parent_dir_absentto postconditions and required-checks list, andwsl_parent_dir_existsin pre-state snapshot.Trade-offs
wsl\cleanup is guarded withEnumerateFileSystemEntries(...).Any()— it will not delete the directory if any other files or subdirectories remain, so this is safe for machines that have other WSL distros under%LOCALAPPDATA%\OpenClawTray\wsl\.%LOCALAPPDATA%\OpenClawTray\root directory itself is left for the MSIX uninstaller to clean up once empty, which is consistent with the existing pattern.Test Status
All failures are pre-existing. No regressions introduced.