Skip to content

feat(sidebar): support multi-select conversation deletion#225

Open
NotToday1024 wants to merge 3 commits into
Stack-Cairn:mainfrom
NotToday1024:feat/issue-211-bulk-delete
Open

feat(sidebar): support multi-select conversation deletion#225
NotToday1024 wants to merge 3 commits into
Stack-Cairn:mainfrom
NotToday1024:feat/issue-211-bulk-delete

Conversation

@NotToday1024

Copy link
Copy Markdown

Closes #211

Summary

  • Add an explicit Select multiple entry to the conversation sidebar, with a tooltip that advertises the supported shortcuts.
  • Support Shift range selection, Ctrl/Command toggle selection, and Ctrl/Command + Shift additive ranges.
  • Add the same behavior to the GUI and Gateway WebUI, including the Gateway mobile long-press menu.
  • Add one confirmation for a batch and reuse the existing single-conversation delete path serially.
  • Keep running/mutating conversations unavailable, lock the selection while deletion is in progress, and retain only failed conversations for retry.

Design Notes

  • The selection applies to the currently loaded sidebar list; it does not introduce a new backend or protobuf batch-delete contract.
  • GUI/WebUI shared selection and deletion helpers are mirrored and covered by focused tests.
  • Workspace changes clear an in-progress selection so selections cannot cross scopes.

Verification

  • pnpm build in crates/agent-gui
  • pnpm lint in crates/agent-gui (exit 0; existing repository warnings only)
  • pnpm test:frontend in crates/agent-gui (1147 passed)
  • pnpm build in crates/agent-gateway/web
  • pnpm lint in crates/agent-gateway/web (exit 0; existing repository warnings only)
  • pnpm test in crates/agent-gateway/web (380 passed)
  • go test ./... in crates/agent-gateway with Go 1.25.12 (passed)
  • node scripts/check-mirror.mjs (97 mirrored files passed)
  • git diff origin/main...HEAD --check
  • Chromium/Playwright desktop and 390x844 mobile interaction checks for both frontends, including partial failure and deletion locking

cargo check --manifest-path crates/agent-gui/src-tauri/Cargo.toml --tests was not run locally because this environment does not have Cargo or the required WebKit/AppIndicator development packages; the repository Tauri CI job will run it.

No protobuf files were changed, so make proto is not required.

Copilot AI review requested due to automatic review settings July 22, 2026 13:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds multi-select conversation deletion to the chat history sidebar in both the Tauri GUI frontend and the Gateway WebUI, including keyboard range/toggle selection and a shared serial batch-delete helper.

Changes:

  • Introduces shared sidebar helpers for selection state (selection.ts) and serial batch deletion (batchDelete.ts), mirrored across GUI/WebUI.
  • Updates both ChatHistorySidebar implementations to support selection mode UI, Shift/Ctrl/Command selection gestures, and a single batch confirmation flow with retry-on-failure behavior.
  • Adds focused tests in both frontends to cover selection reconciliation and batch delete continuation behavior, plus new i18n strings for the selection/delete UI.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/mirror-manifest.json Adds the new mirrored sidebar helper modules to the mirror manifest.
crates/agent-gui/test/chat/sidebar-selection.test.mjs Adds GUI tests for multi-select selection behavior and serial batch delete continuation.
crates/agent-gui/src/pages/chat/sidebar/ChatSidebarContainer.tsx Wires bulk deletion handler into the GUI sidebar container using the new batch-delete helper.
crates/agent-gui/src/lib/sidebar/selection.ts Implements sidebar selection updates (toggle, range, additive range) and reconciliation.
crates/agent-gui/src/lib/sidebar/batchDelete.ts Implements serial deletion with per-item success/failure aggregation.
crates/agent-gui/src/i18n/config.ts Adds GUI i18n strings for selection mode and bulk delete confirmation text.
crates/agent-gui/src/components/chat/ChatHistorySidebar.tsx Adds selection mode UI/UX, keyboard handling, and batch-delete confirmation + retry selection behavior in the GUI sidebar.
crates/agent-gateway/web/test/sidebar-selection.test.mjs Adds WebUI tests for selection behavior and serial batch delete continuation.
crates/agent-gateway/web/src/lib/sidebar/selection.ts Adds the mirrored selection helper to the WebUI codebase.
crates/agent-gateway/web/src/lib/sidebar/batchDelete.ts Adds the mirrored batch-delete helper to the WebUI codebase.
crates/agent-gateway/web/src/i18n/config.ts Adds WebUI i18n strings for selection mode and bulk delete confirmation text.
crates/agent-gateway/web/src/components/chat/ChatHistorySidebar.tsx Adds selection mode UI/UX, mobile handling, and batch-delete confirmation + retry selection behavior in the WebUI sidebar.
crates/agent-gateway/web/src/app/sidebar/GatewaySidebarContainer.tsx Wires bulk deletion handler into the Gateway sidebar container, including local-draft handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1205 to +1207
const result = await handleDeleteConversations(ids);
const failedIds = result.failedIds.filter((id) => orderedConversationIds.includes(id));
setSelectedConversationIds(new Set(failedIds));
Comment on lines +1637 to +1639
const result = await handleDeleteConversations(ids);
const failedIds = result.failedIds.filter((id) => orderedConversationIds.includes(id));
setSelectedConversationIds(new Set(failedIds));
@su-fen

su-fen commented Jul 22, 2026

Copy link
Copy Markdown
Member

Pushed 455ad5a addressing two review follow-ups on both frontends:

Escape scoping — the selection-mode keydown listener now ignores events whose target is an INPUT/TEXTAREA/contentEditable element (same idiom as SkillsHubPage) and events that were already defaultPrevented, so pressing Escape in the composer or while a popup closes no longer exits selection mode.

Cancellable bulk delete — previously the X button and Escape were disabled during isBulkDeleting, so one hung store.remove locked the user in selection mode indefinitely. Now:

  • deleteSidebarConversations takes an optional shouldStop callback, polled before each delete; unattempted ids are reported in a new skippedIds bucket (mirrored byte-identically on both ends, manifest unchanged).
  • exitSelectionMode bumps a run token: the serial loop stops issuing further deletes, and the stale continuation stops touching state (this also fixes a latent bug where a workspace switch mid-batch could resurrect the failed-id selection in the new scope).
  • X and Escape stay enabled while deleting — cancel takes effect immediately in the UI; the single in-flight delete settles on its own.

Added a shouldStop/skippedIds unit test per end. tsc, both test suites (1165 + 381), biome on touched files, and check-mirror all pass locally.

NotToday1024 and others added 3 commits July 23, 2026 01:14
The selection-mode Escape listener now ignores events from INPUT/TEXTAREA/
contentEditable targets and already-handled (defaultPrevented) events, so
Escape in the composer or a closing popup no longer exits selection mode.

Bulk deletion is cancellable mid-batch: deleteSidebarConversations accepts
a shouldStop callback (unattempted ids surface as skippedIds), and the
sidebar keeps the cancel button and Escape enabled while deleting. Exiting
selection mode bumps a run token that stops the serial loop between items
and marks the in-flight continuation stale, so a hung delete can no longer
lock the selection UI.
@NotToday1024
NotToday1024 force-pushed the feat/issue-211-bulk-delete branch from 455ad5a to 0c716be Compare July 22, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

对话列表建议支持按住 Shift 多选批量删除

3 participants