fix(watch): show only the worktrees that are still on disk - #41
Merged
Conversation
The dashboard listed every worktree a daemon had ever run in. A daemon never drops a session from its own list and flushes that list once more as it exits, so its registry file outlives it naming worktrees removed weeks ago — here six sessions, four of them pointing at directories that were gone. Those rows were dead ends: enter on one starts an agent in a directory that is not there. sessions.visible is the rule now, and both read paths go through it — the live snapshot and the fallback the registry provides. The dashboard puts the same test on git's worktree list, which goes on reporting a worktree whose directory was deleted until someone prunes it. A session still running in a deleted worktree is dropped with the rest, and `lcc open --stop-all` is what ends it; nothing produces Status.orphan after that, so it goes too. A registry row reading `unknown` is no longer a match either. It was hiding the status recovered from the hooks for every worktree its daemon had touched, which is precisely when that file is the only thing left able to report one.
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.
sessions.visibleis the single rule now, and both read paths go through it — plus git's own worktree list, which goes on reporting one whose directory was removed until someone prunes it.lcc open --stop-allis what reaches it. That leaves nothing producingStatus.orphan, so the status goes too.unknownno longer counts as a session either. It was hiding the status recovered from the hooks for every worktree its daemon had touched — which is precisely when that file is the only thing left able to report one.Checked against the same fixtures on
masterand on this branch: 6 sessions → 2 inlcc open --json; arm -rf'd worktree that git still lists loses its row; a dead daemon plus a hook file reads● waiting(1h) instead of? unknown(56y).