Lock Supacode worktrees so prune can't drop them#339
Merged
Conversation
Resolves #338 by writing a JSON-tagged `locked` payload (`owner: "supacode"`) to every Supacode-managed worktree's git admin entry. The lock survives any `git worktree prune` (locked entries are skipped), and Supacode-initiated removal is the sole release path. Reload reconciles instead of pruning, so a transiently offline working dir no longer disappears from the sidebar. Missing-dir worktrees are surfaced explicitly with an `isMissing` flag, orange warning icon, and a dedicated detail view that offers Delete (the only sensible action). All shell-spawning entry points (terminal create, split, run script, deeplink) are gated so an orphan row can't pivot to a broken `cd`. The CLI socket response surfaces a real error instead of silent ok=true. Includes lock-round-trip tests, orphan-discovery tests, and a deeplink test pinning at least one spawning and one cleanup case of the action matrix.
Repositories that fail to load now get the same orphan treatment as missing worktrees: a dedicated pink-triangle sidebar section that mirrors a healthy repository (header, ellipsis menu, selectable row) and a `Repository unavailable` detail view showing the original path as a monospaced, selectable line. The path's `.help()` tooltip carries the underlying load failure for diagnostics. Removal flows through a `Remove Repository…` confirmation alert that honors Cmd+Enter, drops the persisted sidebar customization, clears a stale `.failedRepository` selection from every reload entry point, and matches the healthy-repo phrasing (`Nothing on disk is changed.`). The window title, sidebar header, and confirmation alert all resolve a custom title via the shared `Repository.sidebarDisplayName` helper. Includes reducer tests for the alert + helper, plus a `WindowTitle` case for the failed-repository selection branch.
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.
Summary
Resolves the disappearing-worktree bug behind #338 by tagging every Supacode-managed worktree with an owned
git worktree lock, so anygit worktree prune(manual, scheduled, or kicked off by Supacode itself) skips them entirely. Backfill happens on every repo load and the lock is released only when Supacode itself removes the worktree.lockedpayload (owner: "supacode", version/build forensics) to each worktree's git admin entry. Reload reconciles instead of pruning; a transiently offline working dir no longer vanishes from the sidebar.isMissingflag, orange warning icon, and a dedicated detail view offering Delete as the only action. Every shell-spawning path (terminal create/split, run script, deeplinks) is gated so an orphan row can't pivot to a brokencd; CLI deeplinks surface a real error instead of silentok=true.Repository unavailabledetail view with selectable monospaced path, and aRemove Repository…confirmation alert (Cmd+Enter aware) that drops persisted customization to match the healthy-repo flow.Test plan
make test(lock round-trip, orphan discovery, deeplink-action matrix, failed-repo alert + helper,WindowTitle.failedRepositorybranch — all pass locally)Closes #338