Skip to content

Add archive controls to Sidebar V2#4384

Open
Quicksaver wants to merge 22 commits into
pingdotgg:mainfrom
Quicksaver:feat/sidebar-v2-archive-controls
Open

Add archive controls to Sidebar V2#4384
Quicksaver wants to merge 22 commits into
pingdotgg:mainfrom
Quicksaver:feat/sidebar-v2-archive-controls

Conversation

@Quicksaver

@Quicksaver Quicksaver commented Jul 23, 2026

Copy link
Copy Markdown

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

  • Added adjacent un-settle and archive controls to settled rows, including hover and keyboard-focus visibility.
  • Added archive actions to active and settled root-thread context menus while keeping archive visible but disabled for running threads.
  • Added multi-select archive support with running-thread guards, confirmation handling, selection cleanup, and partial-failure reporting.
  • Added an Archive all action to the settled section that covers the complete current-project settled partition, including rows hidden behind settled-tail pagination, while excluding ineligible running threads.
  • Coordinated thread keys across confirmation and mutation for individual, multi-select, and all-settled archive flows. Waiting flows immediately reserve uncontested siblings, omit completed owner archives, and retry canceled or failed entries.
  • Published successful archive keys to waiters as each mutation completes, preserving coordination guarantees when a later mutation or navigation throws.
  • Re-checked live running state immediately before every selected-thread and all-settled mutation so newly ineligible entries are skipped without aborting the remaining batch.
  • Kept the disabled Archive all affordance as the pointer target during an in-flight batch and warned when confirmed entries became active before mutation, including the all-skipped case.
  • Preserved successful archive outcomes across later navigation or batch failures and refreshed archived-thread snapshots through the shared archive path.
  • Extracted Sidebar V2 lifecycle controls and settled-divider behavior into focused components and shared lifecycle helpers.
  • Added focused coverage for context-menu composition, settled-header visibility, running-session detection, archivable filtering, archive outcomes, and lifecycle behavior.
  • Documented Sidebar V2 archive ownership, interaction guarantees, and development ports in 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.
  • Targeted vp fmt --check, vp lint, @t3tools/web typecheck, and git diff --check passed.
  • Playwright exercised Sidebar V2 against an isolated server and disposable throwaway project on the branch ports. A disabled archive control retained pointer targeting, and two synchronous archive triggers produced exactly one thread.archived event and one archived projection.
  • Controlled-browser overlap passes verified both outcomes: a successful row owner narrowed a waiting Archive all confirmation 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.
  • A fresh fallback Playwright pass on the fixed worktree ports rendered three disposable settled rows and Archive all 3 settled threads; activating it removed the shelf, and SQLite confirmed all three authoritative projections received distinct archived_at timestamps.
  • A review-focused browser pass held Archive all in-flight and confirmed its disabled button retained pointer-events: auto and remained the center-point hit target. After both confirmed fixtures became live-running, the batch skipped them, showed No threads archived with 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 existing archiveThread path, clear selection for archived keys, and surface partial failures without implying rollbacks.

Sidebar.logic gains withCoordinatedThreadArchiveEntries so overlapping archive triggers serialize per thread (wait, omit already-archived keys, retry canceled/failed entries), plus canArchive/skippedThreadKeys on batch archive, isThreadSessionRunning, filterArchivableSidebarThreads, and buildSidebarV2ThreadContextMenuItems. useThreadActions uses 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

  • Adds per-row archive buttons on settled thread rows in SidebarV2.tsx, accessible on hover/focus alongside the existing un-settle button.
  • Adds an 'Archive all' action to the settled shelf divider header that bulk-archives eligible settled threads, with a disabled state during in-progress operations.
  • Adds archive actions to the per-thread and multi-select context menus; archive is disabled for running threads.
  • Introduces withCoordinatedThreadArchiveEntries in Sidebar.logic.ts to prevent race conditions when multiple archive flows target the same threads concurrently.
  • Extends archiveSelectedThreadEntries with canArchive and onArchived callbacks, and adds filterArchivableSidebarThreads and isThreadSessionRunning helpers to guard against archiving in-progress threads.

Macroscope summarized 0588f13.

- 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
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

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 Plus

Run ID: 14fb4d4b-191a-406b-beec-6c770f33706b

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

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 23, 2026
Comment thread apps/web/src/components/SidebarV2.tsx Outdated
Comment thread apps/web/src/components/SidebarV2.tsx
@macroscopeapp

macroscopeapp Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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
Comment thread apps/web/src/components/SidebarV2.tsx
…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
Comment thread apps/web/src/components/Sidebar.logic.ts Outdated
- 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
Comment thread apps/web/src/components/Sidebar.logic.ts Outdated
Comment thread apps/web/src/components/Sidebar.logic.ts Outdated
…hive-controls

# Conflicts:
#	apps/web/src/components/SidebarV2.tsx
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jul 24, 2026
Comment thread 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
Comment thread apps/web/src/components/SidebarV2.tsx Outdated
Comment thread apps/web/src/components/SidebarV2.tsx
- Keep disabled Archive all as the pointer target
- Warn when live eligibility skips confirmed batch entries
- Cover all-skipped archive outcomes with focused tests

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes using high effort 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 0588f13. Configure here.

const outcome = await archiveThreadEntries(entries, {
onArchived,
recheckLiveEligibility: true,
});

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.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0588f13. 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