Add support for pinned threads in the sidebar #1824
main fromrefs/pull/1824/head·opened View on GitHubWhat changed#
This PR adds support for pinning threads in the UI so important conversations are easier to keep in view.
Pinned threads now:
- Can be pinned and unpinned from the sidebar thread context menu
- Appear in a dedicated Pinned section above the project folders
- Still remain visible inside their original project folder
- Show a minimal folder indicator in the pinned section so it’s clear which project they belong to
- Stay pinned across reloads via persisted UI state
Why#
Made it easier to keep track of important threads
Details#
- Pin state is stored in the existing web UI state store
- Pinned threads are sorted ahead of unpinned threads
- Sidebar navigation keeps a deduplicated logical ordering so keyboard traversal and jump hints do not treat the same pinned thread as two separate entries
UI#
Checklist#
- This PR is small and focused
- I explained what changed and why
- I included before/after screenshots for any UI changes
- I included a video for animation/interaction changes
Testing#
bun fmtbun lintbun typecheckbun run test
Note
Medium Risk
Moderate risk: changes sidebar rendering/order and navigation indexes, plus persists new pinnedThreadIds in localStorage; regressions could affect thread selection, sorting, and post-delete navigation.
Overview
Adds pinned threads support in the sidebar: threads can now be pinned/unpinned via single- and multi-select context menus, and pinned items render in a new Pinned section above projects with a pin indicator and optional project folder suffix.
Updates thread ordering logic so sortThreadsForSidebar prioritizes isPinned, and rebuilds visibleSidebarThreadIds as pinned-first then projects with deduping to keep keyboard traversal/jump hints stable even when a thread appears in both places.
Extends uiStateStore to store/persist pinnedThreadIds (including pruning on syncThreads/clearThreadUi) and updates delete fallback selection in useThreadActions to respect pin ordering; includes new unit tests for pin state.
Note
Add pinned threads support to the sidebar#
- Introduces a
Pinnedsection at the top of the sidebar that shows pinned threads with a pin icon and folder label suffix. - Adds
setThreadPinnedto uiStateStore.ts, persisting pin state in localStorage and pruning stale ids when threads are deleted. - Single and multi-select context menus expose a
toggle-pinaction;sortThreadsForSidebarin Sidebar.logic.ts now places pinned threads before unpinned ones. - Fallback thread selection after deletion in useThreadActions.ts now respects pin ordering.
- Behavioral Change:
visibleSidebarThreadIds(used for keyboard navigation) is rebuilt as pinned threads first, then per-project threads, deduplicated.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
🟠 High
The
deleteThreadcallback readspinnedThreadIdsfrom closure-captured state (line 26) but readsthreadsfresh viauseStore.getState()(line 73). If pins change between render and invocation,getFallbackThreadIdAfterDeletereceives staleisPinnedvalues mixed with fresh thread data, causing incorrect fallback thread selection. Consider readingpinnedThreadIdsfresh inside the callback viauseUiStateStore.getState().pinnedThreadIds.✅ Resolved in b164956ea70d03d8383360237c9c68ea921b6a48
Approvability#
Verdict: Needs human review
This PR introduces a new user-facing feature allowing threads to be pinned in the sidebar, with new UI sections, sorting behavior, and persistence. While self-contained and including tests, new features that introduce user-facing behavior and workflows warrant human review to verify the implementation meets product expectations.
You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit b164956ea70d03d8383360237c9c68ea921b6a48. Configure [here](https://www.cursor.com/dashboard/bugbot).
@@ -147,3 +168,6 @@147168 );148169 }149170171+function threadIdListsEqual(left: readonly ThreadId[], right: readonly ThreadId[]): boolean {172+ return left.length === right.length && left.every((threadId, index) => threadId === right[index]);173+}New function duplicates existing array equality helper#
Low Severity
The newly added
threadIdListsEqualfunction has an identical implementation to the existingprojectOrdersEqualfunction — both check length equality and element-wise identity on a readonly branded-string array. A single generic helper (e.g.,arraysEqual<T>) could replace both, reducing duplication and maintenance surface.Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit b164956ea70d03d8383360237c9c68ea921b6a48. Configure [here](https://www.cursor.com/dashboard/bugbot).Additional Locations (1)
Closing as part of backlog cleanup: this PR is stale, currently conflicting with main, has no approval, and has not had active remediation for 30+ days. If the change is still relevant, please rebase onto current main and request reopening or submit a focused current diff. Thank you for the contribution.
juliusmarminge closed this
Sign in to join this conversation.

Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
40e6eacd-3858-4814-9456-35b9c2535e74You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
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