Skip to content

feat(sidebar): group threads by worktree#2708

Draft
RJWadley wants to merge 4 commits into
pingdotgg:mainfrom
RJWadley:worktree-grouping
Draft

feat(sidebar): group threads by worktree#2708
RJWadley wants to merge 4 commits into
pingdotgg:mainfrom
RJWadley:worktree-grouping

Conversation

@RJWadley
Copy link
Copy Markdown

@RJWadley RJWadley commented May 15, 2026

What Changed

  • add option to group threads by worktree, enabled by default
  • grouping only shows when there is more than one worktree with active threads
  • visible thread ordering after grouping so jump shortcuts, prewarming, and range selection match the rendered sidebar

Why

TLDR I wanna stop using conductor but T3's worktree's absolutely suck to use

T3's worktree support is capable but requires a lot of mental load. It's easy to run all your chats in the main worktree, and its easy to run all your chats in separate worktrees, but as soon as you want to do any amount of mixing and matching in different worktrees it gets absolutely impossible to manage.

This is one of the most obvious UX improvements here, and makes it much more clear when threads are operating in the same worktree. Better display of worktrees also paves the way for other improvements, like clearer UX around creating new threads in specific worktrees. Those improvements are beyond the scope of this PR.

UI Changes

Sort & group settings before and after:
Screenshot 2026-05-14 at 11 14 50 PMScreenshot 2026-05-14 at 11 15 31 PM

Sidebar before
Sidebar still looks like this when threads are not grouped by worktree
Screenshot 2026-05-14 at 11 14 40 PM

Sidebar after
Screenshot 2026-05-14 at 11 16 06 PM
Screenshot 2026-05-14 at 11 16 38 PM

indicators
Screenshot 2026-05-14 at 11 26 59 PM
Screenshot 2026-05-14 at 11 27 30 PM

Checklist

  • This PR is small and focused
    (not very small, but focused at least. my b)
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes
    n/a

Note

Medium Risk
Changes sidebar thread rendering/ordering and adds new persisted UI state and client settings defaults, which could affect navigation shortcuts/selection and user-configured sidebar behavior. Risk is moderated by extensive new unit test coverage for grouping/overflow/pinning edge cases.

Overview
Adds worktree-grouped thread lists in the sidebar (default behavior). Threads can now render under expandable worktree headers (with a special “Current checkout” group), while preserving a flat separate mode.

Introduces new sidebar render modeling in Sidebar.logic.ts (group building, overflow/preview limits per worktree, and “pin active thread” behavior) and updates Sidebar.tsx to use the grouped model for visible ordering (jump shortcuts, prewarming, range selection) plus new per-worktree and per-project “show more/less” controls.

Adds two new client settings in contracts/settings.tssidebarThreadGroupingMode and sidebarWorktreePreviewCount—wires them into the sort/group menu and “Restore defaults”, and persists collapsed worktree UI state via uiStateStore (collapsedWorktreeIds) with associated tests.

Reviewed by Cursor Bugbot for commit 20b9a1f. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Group sidebar threads by worktree with per-worktree expand/collapse controls

  • Adds a 'worktree' grouping mode to the sidebar that organizes threads under their associated worktree, with expandable group headers and per-worktree overflow controls. A 'separate' (flat) mode retains the previous behavior.
  • Introduces buildSidebarWorktreeThreadGroups, buildSidebarThreadRenderModel, and buildSidebarProjectThreadRenderState in Sidebar.logic.ts to compute grouped render state with pinned active thread, preview limits, and hidden/overflow accounting.
  • Adds sidebarThreadGroupingMode (default 'worktree') and sidebarWorktreePreviewCount (default 4, range 1–15) as persisted client settings, configurable from ProjectSortMenu.
  • Persists collapsed worktree IDs to localStorage via uiStateStore, restoring expansion state on reload.
  • Behavioral Change: the default sidebar view now groups threads by worktree rather than showing a flat list.

Macroscope summarized 20b9a1f.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d1eb0987-429c-4ccf-ab27-6c5ab52791fc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels May 15, 2026
@RJWadley RJWadley marked this pull request as ready for review May 15, 2026 06:10
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 15, 2026

Approvability

Verdict: Needs human review

This PR introduces a new user-facing feature (grouping sidebar threads by worktree) with new settings, UI components, and state management. New features of this scope warrant human review to ensure the implementation meets design expectations and UX requirements.

You can customize Macroscope's approvability policy. Learn more.

@RJWadley RJWadley marked this pull request as draft May 15, 2026 23:32
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 20b9a1f. Configure here.

const projectOverflowControlsWorktrees = threadGroupingMode === "worktree" && showWorktreeGroups;
const showProjectOverflowControl = projectOverflowControlsWorktrees
? hasOverflowingWorktrees || hasHiddenWorktrees
: hasOverflowingThreads;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overflow button label inconsistently switches between states

Low Severity

projectOverflowControlsWorktrees derives from showWorktreeGroups, which depends on the currently rendered groups. When collapsed with worktreePreviewCount=1 and the current checkout is the first group, showWorktreeGroups is false, so the button says "Show more threads". After clicking (expanding reveals other worktrees), showWorktreeGroups flips to true, and the collapse button says "Show fewer worktrees". The user clicks one label but sees a different label to undo the action, creating a confusing asymmetry.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 20b9a1f. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant