agent_ui: Keep threads pinned to their git worktree group#60776
Open
ivanbanov wants to merge 1 commit into
Open
agent_ui: Keep threads pinned to their git worktree group#60776ivanbanov wants to merge 1 commit into
ivanbanov wants to merge 1 commit into
Conversation
A thread's Agent-panel grouping is derived from its stored worktree paths, which were rewritten from freshly-computed project state on every worktree event and thread update. For git worktrees nested inside the repository, the computed main worktree path falls back to the folder path whenever git state is unavailable (e.g. while a worktree is being scanned), so a thread's resolved association with its main repository could regress and the thread would jump to a different worktree group. - WorktreePaths::add_path now replaces a stale pair when a folder's main path is resolved, instead of accumulating duplicate folder entries, and refuses to downgrade a resolved pair to the unresolved fallback. - WorktreePaths::preserving_resolved_main_paths keeps previously resolved main paths when merging freshly-computed paths into stored thread/terminal metadata. - AgentPanel only rewrites stored thread paths for threads that were tracking the project's previous path set, so threads associated with a different worktree keep their association. Fixes zed-industries#60553 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
a94bd4d to
adb0e5c
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.
Closes #60553
With git worktrees nested inside the repository, a thread's worktree group in the Agent panel could change while navigating the file tree. Two causes:
main-repo/worktree) could regress and the thread jumped to another group.WorktreePaths::add_pathaccumulated a duplicate pair for the same folder when its main path was re-resolved, corrupting the group key.Fix:
WorktreePaths::add_pathreplaces a stale same-folder pair and never downgrades a resolved pair to the unresolved fallback.WorktreePaths::preserving_resolved_main_pathskeeps previously-resolved main paths when merging freshly-computed paths into stored thread/terminal metadata.AgentPanelonly rewrites stored thread paths for threads that were tracking the project's previous path set, so threads associated with a different worktree keep their association.Covered by a regression test (fails without the fix), an end-to-end test with the nested-worktree layout from the issue, and unit tests for the new
WorktreePathssemantics.Verified manually on a repo with
<repo>/.worktrees/<name>worktrees — threads now stay pinned to their worktree while navigating:Release Notes:
🤖 Generated with Claude Code