confirm() pre-selects "Yes" for irreversible actions: one Enter deletes the session (/delete) or drops the goal
Summary
The interactive confirm() dialog always opens with Yes pre-selected, including for irreversible actions. One stray Enter — or an automated keypress into a terminal driving omp — permanently:
- deletes the current session (
Delete Session,selector-controller.ts: "This will permanently delete the current session."), or - drops the goal record (
Drop goal?,interactive-mode.ts: "This removes the goal record.").
Same pattern as #13327 (saved-reset prompt pre-selecting "Yes"), but in the generic confirm used by builtins and extensions.
Where
packages/coding-agent/src/modes/controllers/extension-ui-controller.ts:
async showHookConfirm(title: string, message: string, dialogOptions?: ExtensionUIDialogOptions): Promise<boolean> {
const result = await this.showHookSelector(`${title}\n${message}`, ["Yes", "No"], dialogOptions);
return result === "Yes";
}showHookSelector highlights index 0, so every confirm defaults to its affirmative action. There is no way for a caller to say "this one is destructive, default to No" short of passing initialIndex: 1 (which interactive-mode.showHookConfirm does not even forward — it takes only (title, message)).
Repro
- Interactive TUI, a saved session.
/delete(or the session-delete action) → "Delete Session" dialog appears with❯ Yes.- Press Enter → the session file is deleted.
(Same for /goal drop with an active goal.)
Expected
Confirmations for irreversible actions open on No; the affirmative requires a deliberate move. Reversible confirms (exit plan mode, effort-change warning) can keep defaulting to Yes.
Proposed fix (implemented in our fork, happy to PR)
ExtensionUIDialogOptions.destructive?: boolean—confirmonly; opens on "No" (setsinitialIndex: 1unless the caller set one). Keeps the familiar Yes/No order, so muscle memory for the option layout is unchanged.InteractiveModeContext.showHookConfirm(title, message, dialogOptions?)forwards options.Delete SessionandDrop goal?pass{ destructive: true }; extensions can use the same flag viactx.ui.confirm(title, message, { destructive: true }).
Related: #13327.
Source: can1357/oh-my-pi