Add persistent filters to the classic sidebar - #4330
danieliser wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughAdds persisted sidebar filters, archived-thread unarchive actions, explicit unread state, first-seen completed-thread detection, and updated thread visitation handling. ChangesSidebar filtering and unread lifecycle
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ClientSettings
participant SidebarFilterMenu
participant Sidebar
participant UiStateStore
participant ChatViewContent
ClientSettings->>SidebarFilterMenu: provide persisted sidebar filters
SidebarFilterMenu->>ClientSettings: persist filter changes
Sidebar->>ClientSettings: read sidebar filters and provider metadata
Sidebar->>UiStateStore: read explicit unread and visit state
ChatViewContent->>UiStateStore: mark active thread visited
UiStateStore-->>Sidebar: expose updated unread state
Possibly related issues
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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. Comment |
|
@codex review |
|
@claude review |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/src/hooks/useMarkFirstSeenCompletedThreadsUnread.ts`:
- Around line 13-21: Update environmentSnapshotIdsAtom to produce a stable
value-based dependency, such as a memoized or canonical key derived from the
snapshot-ready environment IDs, instead of returning a newly allocated array on
unchanged recomputations. Adjust the consuming effect dependencies in
useMarkFirstSeenCompletedThreadsUnread to use that stable value while preserving
the existing environment-ID scan behavior.
- Around line 79-97: Update useMarkFirstSeenCompletedThreadsUnread to exclude
the currently active thread from newlyUnreadThreads before calling
markThreadUnread, using the existing active-thread state or selector. Preserve
marking all other first-seen completed threads unread and continue updating
seenThreadKeysByEnvironmentRef for every resolved thread.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 23485bac-d934-41ce-806f-1d6adf465b03
📥 Commits
Reviewing files that changed from the base of the PR and between b44ed83 and 54a5c4d4877c936347397221e4054746544cc1bf.
📒 Files selected for processing (14)
apps/web/src/components/ChatView.tsxapps/web/src/components/Sidebar.logic.test.tsapps/web/src/components/Sidebar.logic.tsapps/web/src/components/Sidebar.tsxapps/web/src/components/SidebarV2.tsxapps/web/src/components/ThreadStatusIndicators.tsxapps/web/src/components/ui/menu.tsxapps/web/src/hooks/useMarkFirstSeenCompletedThreadsUnread.test.tsapps/web/src/hooks/useMarkFirstSeenCompletedThreadsUnread.tsapps/web/src/routes/__root.tsxapps/web/src/uiStateStore.test.tsapps/web/src/uiStateStore.tspackages/contracts/src/settings.test.tspackages/contracts/src/settings.ts
There was a problem hiding this comment.
💡 Codex Review
https://github.com/pingdotgg/t3code/blob/54a5c4d4877c936347397221e4054746544cc1bf/apps/web/src/components/Sidebar.tsx#L1408-L1410
Exclude archived rows from range-selection order
When Include archived is enabled, visibleProjectThreads includes archived rows, but archived rows are intentionally non-navigable/non-selectable via handleRowClick. Keeping their keys in the Shift-click range list lets a user select active rows on either side of an archived row and silently add the archived key to selectedThreadKeys; the multi-select menu then counts that key but drops it when resolving active thread shells, so confirmations/actions operate on a different set than shown. Filter archived threads out of this ordered key list, matching visibleSidebarThreadKeys.
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c0d8c25 to
8195a3e
Compare
8195a3e to
d9ed295
Compare
6649c3f to
4116b9f
Compare
|
@coderabbitai review |
|
@codex review |
|
@claude review once |
✅ Action performedReview finished.
|
ApprovabilityVerdict: Needs human review New feature adding persistent sidebar filters with status, environment, source, and quick-filter options. Introduces new UI components, filtering logic, and settings persistence — scope warrants human review. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c618852d8
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4c61885 to
11b0109
Compare
3c31cb5 to
423ab5f
Compare
423ab5f to
32228d6
Compare
32228d6 to
82dfed7
Compare
6f0b05d to
613cf3d
Compare
613cf3d to
3bb8f73
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3bb8f732509d1f0a8be36d6491a25cc963a7c5cc. Configure here.
3bb8f73 to
f10ce1c
Compare
f10ce1c to
a60b0f2
Compare
|
Note 🤖 GPT-5.6 Sol responding on behalf of Theo Closing this PR after an automated pass over open pull requests. Adds filters to the old sidebar implementation instead of the current default sidebar. |

What changed
Scope
This PR intentionally covers the classic/V1 sidebar only. V2 integration and project grouping are held as follow-ups so this review stays below the repository's XXL cutoff: 994 effective production lines (
size:XL).Related prior art: #1043 and @jjjjjjjjjjjjjjjjacob's demo explored sidebar filtering, including Terminal and Unsent Draft facets. Those extra facets are not bundled into this smaller V1 review.
V2 readiness
This is not a classic-sidebar dead end. The persisted filter model and matching logic are sidebar-agnostic, and the working draft follow-up #4334 already applies the same controls to Sidebar V2 alongside project filtering and flat mode. That combined integration has been exercised in the patched nightly on both sidebar surfaces.
The V2 adapter is intentionally kept out of this diff so #4330 remains a direct-main
size:XLreview. #4334 stays draft until the foundation lands and its V2/grouping delta can be restacked without inherited history.Why
Large sidebars need focused views for recent and actionable work without exposing archived history by default. “Inbox” communicates the unread-or-needs-attention union without colliding with the existing “Needs attention” status.
UI changes
Before, the classic sidebar always showed the full active thread set and unchecked submenu rows reserved an awkward leading indicator column. After, a compact filter menu provides persistent facets with right-aligned checks and opt-in archived history.
Verification
@t3tools/contractsand@t3tools/webtypechecks passed.git diff --checkpassed.Checklist
mainNote
Add persistent thread filters to the classic sidebar
SidebarFilterMenuto the sidebar projects header, allowing users to filter threads by recency (7-day window), attention/unread status, explicit status facets, environment, provider source, and inclusion of archived threads.SidebarThreadFiltersto client settings so filter state persists across sessions, with schema validation and decoded defaults viaDEFAULT_SIDEBAR_THREAD_FILTERS.useArchivedThreadSnapshotswhen the archived filter is active, merged with live threads, and rendered in a disabled state with an inline Unarchive action.classifySidebarThreadFilterStatus,matchesSidebarThreadFilters,filterSidebarThreadsForActiveRoute, and related helpers;getVisibleThreadsForProjectis refactored from id-based to key-based selection.Macroscope summarized a60b0f2.
Note
Medium Risk
Large classic-sidebar behavior change with persisted settings and archived-thread merging, but logic is heavily unit-tested and active-route visibility is explicitly preserved to avoid navigation traps.
Overview
Adds persistent thread filtering to the classic sidebar, stored in client settings as
sidebarThreadFilters(status facets, environment, provider source, Recent / Inbox shortcuts, and opt-in Archived).New logic in
Sidebar.logic.tsclassifies each thread into exclusive filter statuses (needs_attention,working,unread,done), applies combined filters (including a 7-day recency window and inbox = unread ∪ needs attention), and always keeps the active route’s thread visible even when it would otherwise be filtered out—including collapsed projects and folded preview lists (getVisibleThreadsForProjectnow keys by scopedactiveThreadKey).The sidebar toolbar gets a Filter menu (
SidebarFilterMenu); checkbox menu items move indicators to the right for alignment. When Archived is enabled, snapshots load only for relevant environments, merge with live shells, and render as read-only rows (no navigation/rename/range select) with Unarchive in-row and context menu. Projects with no matching threads hide when narrowing filters are active; empty state distinguishes “no projects” vs “no matches.”packages/contractsadds theSidebarThreadFiltersschema and patch support with defaults and validation.Reviewed by Cursor Bugbot for commit a60b0f2. Bugbot is set up for automated code reviews on this repo. Configure here.