feat(tasks): add delete behavior setting#2535
Conversation
Greptile SummaryThis PR adds a new task delete behavior setting with two options:
Confidence Score: 4/5Safe to merge with one concern: in 'ask' mode the branch checkbox now opens pre-checked, which silently changes the outcome for users who click through without inspecting the dialog. The branch deletion checkbox changed from starting unchecked to starting checked in 'ask' mode. Users who habitually click Delete without examining the modal — including everyone on the default 'ask' setting after upgrading — will now have their branches deleted when they previously would not have. Everything else in the change (schema, defaults, settings UI, dirty-file warning, scope notice) is well-structured and correct. apps/emdash-desktop/src/renderer/features/tasks/delete-task-modal.tsx — specifically the initial value of the deleteBranch state and when the scope notice is displayed.
|
| Filename | Overview |
|---|---|
| apps/emdash-desktop/src/renderer/features/tasks/delete-task-modal.tsx | Integrates deleteBehavior setting; the branch checkbox is now pre-checked in 'ask' mode (changed from false→true), making branch deletion the implicit default when the user doesn't examine the dialog. |
| apps/emdash-desktop/src/main/core/tasks/operations/deleteTask.ts | Default for deleteBranch changed from false to true; all current callers pass explicit values so no runtime regression, but the default is now more destructive. |
| apps/emdash-desktop/src/main/core/settings/schema.ts | Adds taskDeleteBehaviorSchema enum and deleteBehavior field to taskSettingsSchema; looks correct. |
| apps/emdash-desktop/src/main/core/settings/settings-registry.ts | Defaults deleteBehavior to 'ask', which is appropriate for safe upgrade behavior. |
| apps/emdash-desktop/src/renderer/features/settings/components/TaskSettingsRows.tsx | Adds TaskDeleteBehaviorRow with Select UI wired to useTaskSettings; implementation looks correct. |
| apps/emdash-desktop/src/renderer/features/tasks/hooks/useTaskSettings.ts | Extends TaskSettingsModel with deleteBehavior, updateDeleteBehavior, and resetDeleteBehavior; falls back to 'ask' when the field is absent. |
| apps/emdash-desktop/src/shared/core/app-settings.ts | Exports new TaskDeleteBehavior type; straightforward addition. |
| apps/emdash-desktop/src/renderer/features/settings/components/SettingsPage.tsx | Registers TaskDeleteBehaviorRow in the General settings page; no issues. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User clicks Delete task] --> B[Open DeleteTaskModal]
B --> C{taskSettings.loading?}
C -- yes --> D[Show Loading... / disable button]
D --> C
C -- no --> E{deleteBehavior}
E -- ask --> F[Fetch preflight data]
F --> G{hasWorktree?}
G -- yes --> H[Show worktree checkbox checked=true]
G -- no --> I[No worktree checkbox]
H --> J{hasDeletableBranch?}
J -- yes --> K[Show branch checkbox checked=true]
J -- no --> L[No branch checkbox]
K --> M[User confirms]
I --> M
L --> M
M --> N[onSuccess with checkbox values]
E -- delete-worktree-and-branch --> O[Show scope notice + dirty warning if needed]
O --> P[User confirms]
P --> Q[onSuccess with deleteWorktree:true deleteBranch:true]
N --> R[deleteTask IPC call]
Q --> R
R --> S[deleteTask.ts deleteWorktree + deleteBranch]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[User clicks Delete task] --> B[Open DeleteTaskModal]
B --> C{taskSettings.loading?}
C -- yes --> D[Show Loading... / disable button]
D --> C
C -- no --> E{deleteBehavior}
E -- ask --> F[Fetch preflight data]
F --> G{hasWorktree?}
G -- yes --> H[Show worktree checkbox checked=true]
G -- no --> I[No worktree checkbox]
H --> J{hasDeletableBranch?}
J -- yes --> K[Show branch checkbox checked=true]
J -- no --> L[No branch checkbox]
K --> M[User confirms]
I --> M
L --> M
M --> N[onSuccess with checkbox values]
E -- delete-worktree-and-branch --> O[Show scope notice + dirty warning if needed]
O --> P[User confirms]
P --> Q[onSuccess with deleteWorktree:true deleteBranch:true]
N --> R[deleteTask IPC call]
Q --> R
R --> S[deleteTask.ts deleteWorktree + deleteBranch]
Reviews (2): Last reviewed commit: "fix(tasks): make delete behavior safer" | Re-trigger Greptile
Description
Screenshot/Recording (if applicable)
https://streamable.com/rzfsq6
Checklist
messages and, when possible, the PR title