fix(projects): keep worktrees when unreachable [2]#145
Draft
AbysmalBiscuit wants to merge 1 commit into
Draft
Conversation
AbysmalBiscuit
marked this pull request as draft
July 23, 2026 14:46
A failed wsl.exe round trip returned Project::placeholder, the same single pseudo-worktree a non-git folder gets, so refresh and poll_project_refreshes copied it over the real worktree list. One transient WSL outage was indistinguishable from "every worktree in this project was deleted", and the sidebar collapsed to a single row until a later refresh happened to succeed. Discovery now returns Discovered, pairing the project with whether the backend could vouch for the answer, and callers adopt through Project::apply, which drops a non-authoritative result. A distro that answers "not a repository" is still authoritative; only a round trip that never landed, or came back without even a main checkout, is not. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
AbysmalBiscuit
force-pushed
the
fix/wsl-discovery-authoritative
branch
from
July 25, 2026 08:32
1c97a30 to
a4da122
Compare
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.
A transient
wsl.exefailure silently collapses a WSL project's worktree list to a single pseudo-worktree.Project::discovernow reports whether its answer is authoritative, and callers adopt throughProject::apply, which drops a result the backend could not vouch for.The bug
discover_wslreturnedProject::placeholderon a failed round trip — the same single pseudo-worktree a non-git folder gets. BothProject::refreshandAlacritreeApp::poll_project_refreshescopied that straight overworktreesanddefault_branch, so one flaky round trip was indistinguishable from "every worktree in this project was deleted". The sidebar collapsed to one row and stayed that way until a later refresh happened to succeed.Same failure shape as
17f95c23 fix(wsl): keep last probe when helper is briefly down, which fixed the foreground-TUI probe cache: a transport error collapsing into the same value as a definitive negative answer.The change
Project::discoverreturnsDiscovered { project, authoritative }.classify_wsl_answer(reached, is_repo, worktrees_parsed) -> WslAnsweris a pure function, so all three outcomes are reachable in a test without a WSL host.discover_wslclassifies once at the end rather than returning early three times.Project::applyadopts a result, ignoring a non-authoritative one.expanded,shell_override, andlabelremain untouched either way, as before.app.rsandcli/offline.rstake.project; the background refresh channel carriesDiscovered.A distro that answers "this is not a repository" is still authoritative — that is the truth, and the placeholder is correct. Only a round trip that never landed, or one that came back claiming a repo with no main checkout, is treated as unknown.
Testing
Four new tests in
projects::tests. They failed to compile first, then the finished code was hotpatched to drop theif !found.authoritative { return; }guard, reproducing the bug:Guard restored, green. Full suite: 480 passed.
cargo clippy -p alacritree --all-targetswarning count unchanged frommaster, none in the touched files.Still to verify manually: add a project on a WSL path, break
wsl.exeonPATH, force a refresh, and confirm the worktree list survives.🤖 Generated with Claude Code