Add archive controls to Sidebar V2#4384
Conversation
- Add single, selected, and all-settled archive actions - Preserve lifecycle guards, confirmations, and failure feedback - Cover context menus and settled-header visibility
- Await archive mutations after failed draft navigation - Clear direct archive successes from thread selection - Document Sidebar V2 archive state guarantees
- Preserve optimistic state until archive completion - Limit bulk archive to eligible root threads - Keep bulk state from re-rendering unrelated rows - Add focused archive outcome and lifecycle tests
…hive-controls # Conflicts: # apps/web/src/components/SidebarV2.tsx
…hive-controls # Conflicts: # apps/web/src/components/Sidebar.logic.test.ts # apps/web/src/components/SidebarV2.tsx
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the 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. Comment |
ApprovabilityVerdict: Needs human review This PR introduces a new feature adding archive controls to Sidebar V2, including new UI buttons, context menu items, bulk 'Archive all' functionality, and coordination logic for concurrent archive operations. New features with this scope warrant human review. You can customize Macroscope's approvability policy. Learn more. |
- Keep disabled archive buttons as pointer targets - Ignore duplicate per-thread archive attempts
…hive-controls # Conflicts: # apps/web/src/components/SidebarV2.tsx
- Reserve thread keys across confirmation and archive mutation - Skip overlapping bulk entries and release reservations reliably - Cover shared reservations with focused concurrency tests
- Wait for current per-thread owners before running later flows - Retry canceled and failed entries while omitting completed archives - Verify owner success and cancellation in logic and browser tests
…hive-controls # Conflicts: # apps/web/src/components/SidebarV2.tsx
- Reserve uncontested batch siblings while waiting for archive owners - Publish completed archive keys when a later operation throws - Recheck live eligibility before each bulk archive mutation
- Keep disabled Archive all as the pointer target - Warn when live eligibility skips confirmed batch entries - Cover all-skipped archive outcomes with focused tests
…idebar-v2-archive-controls
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 0588f13. Configure here.
| const outcome = await archiveThreadEntries(entries, { | ||
| onArchived, | ||
| recheckLiveEligibility: true, | ||
| }); |
There was a problem hiding this comment.
Archive all ignores settle changes
Medium Severity
archiveAllSettled snapshots settled threads at click time, then only re-checks live running state after coordination and confirmation. Overlap waits leave the UI interactive, so a reserved thread can be un-settled before mutation and still get archived even though it left the settled partition the action claims to cover.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0588f13. Configure here.


Summary
Add complete archive lifecycle controls to Sidebar V2 for individual threads, multi-selection, and the settled partition. The controls retain Sidebar V2's current row and pagination structure while using the existing archive confirmation, optimistic visibility, archived-snapshot refresh, and failure-feedback paths.
Archive actions remain unavailable for running conversations and omit nested subagent rows. Successfully archived threads stay archived and leave the active selection even when a later bulk mutation or post-archive navigation fails. Row, multi-select, and all-settled flows share per-thread completion reservations so overlapping triggers wait for the current owner, omit its successful archives, and retry entries it canceled or failed to archive. Waiting bulk flows reserve uncontested siblings, publish partial completion to waiters even when later work throws, and re-check running state before each mutation.
What Changed
Archive allaction to the settled section that covers the complete current-project settled partition, including rows hidden behind settled-tail pagination, while excluding ineligible running threads.Archive allaffordance as the pointer target during an in-flight batch and warned when confirmed entries became active before mutation, including the all-skipped case.BRANCH_DETAILS.md.Why
Sidebar V2 already distinguishes active, settled, and archived conversations, but it lacked the archive actions available in the established thread lifecycle. Users need to archive a single conversation, a selected group, or the entire settled partition without switching sidebar implementations or exposing invalid actions for running work.
The implementation also makes partial success explicit: completed archives must not appear rolled back merely because a subsequent navigation or bulk operation fails.
Validation
pnpm exec vp test run apps/web/src/components/Sidebar.logic.test.ts— 92 focused tests passed.vp fmt --check,vp lint,@t3tools/webtypecheck, andgit diff --checkpassed.thread.archivedevent and one archived projection.Archive allconfirmation from two visible rows to the remaining row, while a canceled owner released the full two-row scope to the waiting bulk flow without emitting a duplicate archive command.Archive all 3 settled threads; activating it removed the shelf, and SQLite confirmed all three authoritative projections received distinctarchived_attimestamps.Archive allin-flight and confirmed its disabled button retainedpointer-events: autoand remained the center-point hit target. After both confirmed fixtures became live-running, the batch skipped them, showedNo threads archivedwith an explicit two-thread warning, and SQLite confirmed both projections remained unarchived.Proof
No durable screenshots or screencasts are attached. The integrated passes used runtime DOM inspection plus the disposable server's event and projection state to verify the review fixes.
Note
Medium Risk
Touches thread lifecycle UI and concurrent bulk mutations with reservation coordination; mistakes could double-archive, drop requests, or leave inconsistent selection state, though logic is heavily unit-tested.
Overview
Adds archive as a first-class Sidebar V2 lifecycle action alongside settle, wired through row hover controls, context menus, multi-select, and an Archive all control on the settled shelf.
Settled rows get paired un-settle and archive buttons; active/settled root threads get Archive thread in the context menu (disabled while a session is running). The settled divider gains Archive all, covering the full settled partition including paginated tail rows, excluding running threads. Bulk and single flows honor
confirmThreadArchive, reuse the existingarchiveThreadpath, clear selection for archived keys, and surface partial failures without implying rollbacks.Sidebar.logicgainswithCoordinatedThreadArchiveEntriesso overlapping archive triggers serialize per thread (wait, omit already-archived keys, retry canceled/failed entries), pluscanArchive/skippedThreadKeyson batch archive,isThreadSessionRunning,filterArchivableSidebarThreads, andbuildSidebarV2ThreadContextMenuItems.useThreadActionsuses the shared running-session guard for archive blocking.Reviewed by Cursor Bugbot for commit 0588f13. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add archive controls to Sidebar V2 threads
withCoordinatedThreadArchiveEntriesin Sidebar.logic.ts to prevent race conditions when multiple archive flows target the same threads concurrently.archiveSelectedThreadEntrieswithcanArchiveandonArchivedcallbacks, and addsfilterArchivableSidebarThreadsandisThreadSessionRunninghelpers to guard against archiving in-progress threads.Macroscope summarized 0588f13.