#13331·oh-my-pi

confirm() pre-selects "Yes" for irreversible actions: one Enter deletes the session (/delete) or drops the goal

Author: XytronixCreated Sep 25, 2026Updated Oct 1, 2026
Labelsenhancementtuiuxsdktriaged

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:

typescript
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

  1. Interactive TUI, a saved session.
  2. /delete (or the session-delete action) → "Delete Session" dialog appears with ❯ Yes.
  3. 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 — confirm only; opens on "No" (sets initialIndex: 1 unless 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 Session and Drop goal? pass { destructive: true }; extensions can use the same flag via ctx.ui.confirm(title, message, { destructive: true }).

Related: #13327.