feat: add worktree grouping setting for sidebar#256
feat: add worktree grouping setting for sidebar#256mattleaverton merged 6 commits intodanshapiro:mainfrom
Conversation
Switch Claude provider back to resolveGitRepoRoot (matching Codex and Dan's original intent) so worktree sessions group under the parent repo. Compute checkoutPath separately via resolveGitCheckoutRoot and include it on sessions when it differs from projectPath. This provides both paths: projectPath for repo-level grouping, and checkoutPath for worktree-level grouping. A follow-up commit will add the client-side setting to choose between them. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add 'repo' | 'worktree' setting (default 'repo') to LocalSettings.sidebar. Include normalizer, default value, merge/resolve support, and a dropdown in WorkspaceSettings UI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…worktree' buildSessionItems now accepts worktreeGrouping parameter and uses session.checkoutPath as the effective project path for subtitle and grouping when the setting is 'worktree'. Default 'repo' mode uses projectPath as before. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three tests covering: - Default 'repo' mode uses projectPath for subtitle - 'worktree' mode uses checkoutPath when available - Falls back to projectPath when no checkoutPath in worktree mode Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 661528d1bd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| provider: item.provider, | ||
| sessionId: item.sessionId, | ||
| projectPath: item.projectPath, | ||
| ...(item.checkoutPath ? { checkoutPath: item.checkoutPath } : {}), |
There was a problem hiding this comment.
Preserve checkoutPath in sidebar search results
The new worktree grouping depends on checkoutPath, but this change only threads that field through the snapshot grouping path; searchSessions() still maps directory items into SearchResult without checkoutPath, so when a sidebar query is active sessions revert to repo-level subtitles/grouping even if sidebar.worktreeGrouping is set to 'worktree'. Please carry checkoutPath through the search response and searchResultsToProjects so filtered and unfiltered sidebar views behave consistently.
Useful? React with 👍 / 👎.
…olve # Conflicts: # test/unit/client/store/selectors/sidebarSelectors.test.ts
Add checkoutPath to SearchResult type and searchResultsToProjects mapping so worktree grouping works consistently when a sidebar search is active. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
resolveGitRepoRoot(matching Codex and the original intent from revert: restore v0.7.0 stable state #208) so worktree sessions group under the parent repo by defaultcheckoutPathfield toCodingCliSession— populated when the session's checkout root differs from the repo rootsidebar.worktreeGroupingsetting ('repo'|'worktree', default'repo') as a per-browser local settingbuildSessionItemsusescheckoutPathfor subtitle and grouping when the setting is'worktree'Context
Sessions from git worktrees were always grouped as separate projects (each showing the worktree directory name). This was changed in Feb to fix a labeling issue where multiple worktrees all showed the same name. But it broke the original intent of grouping worktree sessions under the parent repo.
This PR provides both modes as a setting — "Repository" groups all worktrees under the repo name (cattle workflow), "Worktree" gives each worktree its own group (pets workflow).
Test plan
🤖 Generated with Claude Code