You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(tui): ESC in dialog rejects background question #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.
The expected behavior is that ESC should only close the dialog, leaving the question visible and unanswered so the user can respond to it after the dialog is closed.
Steps to reproduce
Open a dialog (e.g. model picker via <leader>m)
Wait for the agent to ask a question in the background
Press ESC
Expected: Dialog closes, question remains visible. Actual: Dialog closes AND question is rejected, agent is interrupted.
Root cause
The QuestionPrompt component pushes a "question" mode onto the mode stack. When a dialog is open, the stack becomes ["modal", "question"]. The dialog's ESC binding has no mode restriction, and the question's ESC binding fires in "question" mode — both execute simultaneously.
The PermissionPrompt component avoids this by using OPENCODE_BASE_MODE, but QuestionPrompt uses a dedicated mode that stacks on top of "modal".
Thanks for the detailed write-up and root-cause analysis, @niho2!
The components you mention (QuestionPrompt, PermissionPrompt with OPENCODE_BASE_MODE) are from OpenCode v1 (0.x/1.x, the opencode-ai package). v1 only gets fixes for critical bugs such as data loss, security problems, or crashes with no workaround. This one interrupts the agent but can be worked around by prompting again, so it's unlikely to be fixed in v1.
We'd encourage upgrading to v2 (@opencode/cli). Its TUI is a separate implementation, and questions are handled by a different form component with its own keybinding handling.
If you can reproduce this on v2, please reply here with your opencode --version, OS and terminal, and we'll take another look. Please also reply if you think it's critical in v1.
Closing as not planned. This Escape/question conflict is in the v1 TUI (QuestionPrompt / OPENCODE_BASE_MODE), and v1 only gets critical fixes. We haven't heard that it also happens on v2.
If you see the same thing on v2 (@opencode/cli), please open a new issue with your opencode --version, OS, terminal and the steps to reproduce. Thanks again for the clear write-up, @niho2!
@yassine-safraoui Thanks for reporting this on v2! Could you share your exact opencode --version, OS and terminal, and confirm whether pressing Escape once closes the command palette/model picker AND rejects the pending background question? My original root-cause analysis was for v1; with a confirmed v2 reproduction, we can open a focused v2 issue and link back here.
I think this may be a duplicate of #52767. When I ran into this in the command palette I commented on both these issues. In this issue I attached as you can see, we do have a reproduction on V2.0.20 by the Opencode bot. Only difference between the two issues is in that issue question tool steals focus from Command palette not from rename dialog, I think this difference is minor and the root cause is very likely the same, so I suggest we close this as duplicate and continue the discussion in that other issue.
For the version I was using when I ran into this, I honestly don't remember exactly which version I was using, however from memory I think it was very likely either V2.0 or V2.1
Activity
yassine-safraoui commentedon Oct 21, 2026
just ran into this with the command palette
opencodejr commentedon Oct 28, 2026
Thanks for the detailed write-up and root-cause analysis, @niho2!
The components you mention (
QuestionPrompt,PermissionPromptwithOPENCODE_BASE_MODE) are from OpenCode v1 (0.x/1.x, theopencode-aipackage). v1 only gets fixes for critical bugs such as data loss, security problems, or crashes with no workaround. This one interrupts the agent but can be worked around by prompting again, so it's unlikely to be fixed in v1.We'd encourage upgrading to v2 (
@opencode/cli). Its TUI is a separate implementation, and questions are handled by a different form component with its own keybinding handling.If you can reproduce this on v2, please reply here with your
opencode --version, OS and terminal, and we'll take another look. Please also reply if you think it's critical in v1.opencodejr commentedon Oct 29, 2026
Closing as not planned. This Escape/question conflict is in the v1 TUI (
QuestionPrompt/OPENCODE_BASE_MODE), and v1 only gets critical fixes. We haven't heard that it also happens on v2.If you see the same thing on v2 (
@opencode/cli), please open a new issue with youropencode --version, OS, terminal and the steps to reproduce. Thanks again for the clear write-up, @niho2!yassine-safraoui commentedon Nov 2, 2026
I ran into this on V2 😕
niho2 commentedon Nov 2, 2026
@yassine-safraoui Thanks for reporting this on v2! Could you share your exact opencode --version, OS and terminal, and confirm whether pressing Escape once closes the command palette/model picker AND rejects the pending background question? My original root-cause analysis was for v1; with a confirmed v2 reproduction, we can open a focused v2 issue and link back here.
yassine-safraoui commentedon Nov 2, 2026
I think this may be a duplicate of #52767. When I ran into this in the command palette I commented on both these issues. In this issue I attached as you can see, we do have a reproduction on V2.0.20 by the Opencode bot. Only difference between the two issues is in that issue question tool steals focus from Command palette not from rename dialog, I think this difference is minor and the root cause is very likely the same, so I suggest we close this as duplicate and continue the discussion in that other issue.
yassine-safraoui commentedon Nov 2, 2026
For the version I was using when I ran into this, I honestly don't remember exactly which version I was using, however from memory I think it was very likely either V2.0 or V2.1