Skip to content

fix(tui): skip question reject when dialog is open - #45306

Open
niho2 wants to merge 1 commit into
anomalyco:devfrom
niho2:fix-question-esc-dialog
Open

fix(tui): skip question reject when dialog is open#45306
niho2 wants to merge 1 commit into
anomalyco:devfrom
niho2:fix-question-esc-dialog

Conversation

@niho2

@niho2 niho2 commented Aug 26, 2026

Copy link
Copy Markdown

Fixes #45304

When a dialog is open (e.g. model picker) and the agent asks a question in the background, pressing ESC closes the dialog AND rejects the question simultaneously. The question disappears and the agent's execution is interrupted.

What changed

Guard the ESC and app.exit handlers in QuestionPrompt to skip reject() when a dialog is currently open (dialog.stack.length > 0). This prevents the question from being rejected while a dialog is being dismissed. Once the dialog is closed, ESC works normally to reject the question.

How to verify

  1. Open model picker (<leader>m)
  2. Have agent ask a question in the background
  3. Press ESC — dialog closes, question remains visible
  4. Press ESC again — question is rejected (as expected when no dialog is open)

Guard ESC and app.exit handlers in QuestionPrompt to skip reject()
when a dialog is currently open (dialog.stack.length > 0). This
prevents the question from being rejected while the user is closing
a dialog such as the model picker.

Previously, pressing ESC with both a dialog and a pending question
would fire both handlers simultaneously — closing the dialog and
rejecting the question. The agent's execution was interrupted and
the question disappeared.

Fixes anomalyco#45304
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.

fix(tui): ESC in dialog rejects background question

1 participant