feat: add batch task management - #289
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
WalkthroughThis change adds batch archive and removal APIs with per-session success and failure results. The session hook and application shell expose these operations to a new task-management dialog. The dialog supports searching, sorting, selection, confirmation, bulk actions, partial-failure handling, and runtime cleanup. Task sorting is persisted locally and exposed through the tasks sidebar menu. English and Chinese task-management translations and backend/frontend tests are added. Sequence Diagram(s)sequenceDiagram
participant User
participant TasksDialog
participant useSessions
participant SessionServiceImpl
User->>TasksDialog: Select tasks and confirm action
TasksDialog->>useSessions: archiveMany or removeMany(ids)
useSessions->>SessionServiceImpl: Invoke batch request with scope
SessionServiceImpl-->>useSessions: BatchSessionResult
useSessions-->>TasksDialog: Succeeded IDs and failures
TasksDialog-->>User: Update selection and show result toast
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
electron/session/node.ts (1)
676-707: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoffSequential
agent.deleteSessioncalls hold the mutation queue for the whole batch.Up to 500 ids are deleted one at a time inside
enqueueMutation, so all other session mutations (create/rename/pin/archive/…) queue behind a large batch delete. Parallelizing withPromise.allSettledwould help, but note it changes the current "abort remaining work on runtime change" semantics (thethrow errorpath when!this.runtimeMatches), so this needs care rather than a drop-in swap.🤖 Prompt for 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. In `@electron/session/node.ts` around lines 676 - 707, Update the batch deletion flow containing agent.deleteSession so independent session deletions can run concurrently instead of serially holding the mutation queue. Preserve per-id validation, success/failure bookkeeping, cleanup callbacks, and runtime revision checks. Ensure a runtime change still aborts remaining work with the original error semantics rather than allowing parallel tasks to silently continue; use coordinated cancellation or equivalent synchronization around runtimeMatches and assertRuntimeMatches.
🤖 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 `@electron/session/node.ts`:
- Around line 564-577: Normalize optional session scopes before comparison in
both batch mutations: update archiveManyMutation at electron/session/node.ts
lines 564-577 and removeManyMutation at electron/session/node.ts lines 676-685
to pass normalizeSessionScope(current.scope) into sessionScopeMatches,
preserving existing failure handling.
---
Nitpick comments:
In `@electron/session/node.ts`:
- Around line 676-707: Update the batch deletion flow containing
agent.deleteSession so independent session deletions can run concurrently
instead of serially holding the mutation queue. Preserve per-id validation,
success/failure bookkeeping, cleanup callbacks, and runtime revision checks.
Ensure a runtime change still aborts remaining work with the original error
semantics rather than allowing parallel tasks to silently continue; use
coordinated cancellation or equivalent synchronization around runtimeMatches and
assertRuntimeMatches.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9d6fdaee-dd43-44f2-b297-4c2101cd60d6
📒 Files selected for processing (14)
electron/session/common.tselectron/session/node.test.tselectron/session/node.tssrc/components/app-shell/AppShell.tsxsrc/components/app-shell/AppShellNavigationSidebar.tsxsrc/components/app-shell/sidebar-persistence.test.tssrc/components/app-shell/sidebar-persistence.tssrc/components/app-shell/sidebar-sessions.test.tssrc/components/app-shell/sidebar-sessions.tssrc/components/app-shell/use-app-shell-sidebar-sessions.tssrc/hooks/useSessions.tssrc/i18n/app-messages.en.tssrc/i18n/app-messages.zh.tssrc/routes/Tasks/index.tsx
|
Addressed the actionable performance review in b3eb25f: batch session deletion now uses bounded concurrency (4 workers), preserves per-ID outcomes and cleanup, stops dispatching queued deletions on a runtime revision change, waits for already-dispatched work to settle, and then preserves the original abort semantics. Added tests for the concurrency bound and runtime-change cutoff. The scope-normalization thread was resolved without a code change because sessionScopeMatches already performs that normalization internally. |
Summary
Wanta's task sidebar previously exposed only per-task controls, which made routine cleanup expensive once a workspace accumulated many conversations. The task list also had a fixed creation-time order and no contextual list actions near the section heading.
This change adds a compact task-list action area and a modal task manager. Users can sort independent tasks by recent activity, creation time, or title; open the archived-task view; create a task from the section heading; and select multiple tasks for archive or permanent deletion. Running tasks remain protected from batch actions, confirmation dialogs explain the consequences, and partial failures remain selected for retry.
Implementation
archiveManyandremoveManysession-service operations with deduplication, a 500-session limit, consolidated persistence/event updates, and per-session failure results.Validation
pnpm lintpnpm ts-checkpnpm formatpnpm test— 281 files and 2,118 tests passedpnpm buildgit diff --check