Skip to content

feat: add batch task management - #289

Merged
alwaysmavs merged 2 commits into
mainfrom
codex/batch-task-management
Jul 29, 2026
Merged

feat: add batch task management#289
alwaysmavs merged 2 commits into
mainfrom
codex/batch-task-management

Conversation

@alwaysmavs

Copy link
Copy Markdown
Contributor

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

  • Add hover/focus task-heading actions aligned with the task timestamps.
  • Persist the selected task sort mode and keep running and pinned ordering rules intact.
  • Add a searchable, sortable task-management modal with select-all, batch archive, and batch delete controls.
  • Add scoped archiveMany and removeMany session-service operations with deduplication, a 500-session limit, consolidated persistence/event updates, and per-session failure results.
  • Clean renderer runtime, queue, retry, composer, and knowledge-base state only for successful batch mutations.
  • Add English and Chinese interface copy.

Validation

  • pnpm lint
  • pnpm ts-check
  • pnpm format
  • pnpm test — 281 files and 2,118 tests passed
  • pnpm build
  • git diff --check

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 78989663-8e71-428e-aa18-f409a957f988

📥 Commits

Reviewing files that changed from the base of the PR and between 4267a97 and b3eb25f.

📒 Files selected for processing (2)
  • electron/session/node.test.ts
  • electron/session/node.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • electron/session/node.ts

Summary by CodeRabbit

  • New Features
    • Added a “Manage Tasks” dialog to search, sort, select, and bulk archive or delete tasks with partial-failure results.
    • Updated the sidebar with task management controls (manage archived tasks, and sorting by title/created/updated) and persisted the selected sort mode.
  • Bug Fixes
    • Improved bulk-operation behavior so failures no longer remove or overwrite local data for the affected tasks.
  • Documentation
    • Added task-management UI translations (including partial-failure and toast messaging) for supported languages.

Walkthrough

This 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
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the batch task management change and follows the required type-subject format.
Description check ✅ Passed The description is mostly complete with summary, implementation, and validation, but it omits the template's Safety and Compatibility checklist.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/batch-task-management

Comment @coderabbitai help to get the list of available commands.

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
electron/session/node.ts (1)

676-707: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoff

Sequential agent.deleteSession calls 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 with Promise.allSettled would help, but note it changes the current "abort remaining work on runtime change" semantics (the throw error path 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

📥 Commits

Reviewing files that changed from the base of the PR and between 835d721 and 4267a97.

📒 Files selected for processing (14)
  • electron/session/common.ts
  • electron/session/node.test.ts
  • electron/session/node.ts
  • src/components/app-shell/AppShell.tsx
  • src/components/app-shell/AppShellNavigationSidebar.tsx
  • src/components/app-shell/sidebar-persistence.test.ts
  • src/components/app-shell/sidebar-persistence.ts
  • src/components/app-shell/sidebar-sessions.test.ts
  • src/components/app-shell/sidebar-sessions.ts
  • src/components/app-shell/use-app-shell-sidebar-sessions.ts
  • src/hooks/useSessions.ts
  • src/i18n/app-messages.en.ts
  • src/i18n/app-messages.zh.ts
  • src/routes/Tasks/index.tsx

Comment thread electron/session/node.ts
@alwaysmavs

Copy link
Copy Markdown
Contributor Author

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.

@alwaysmavs
alwaysmavs merged commit 1b3d724 into main Jul 29, 2026
3 checks passed
@alwaysmavs
alwaysmavs deleted the codex/batch-task-management branch July 29, 2026 10:55
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.

1 participant