Interrupting Session via ESC does not work
Description
When I try to interrupt a session via ESC, it just does nothing. Worked with previous TUI but not in v1.
This is somewhat a show stopper.
OpenCode version
1.0.7
Steps to reproduce
Starting a session and sending a prompt.
Screenshot and/or share link
No response
Operating System
macOSX Sonoma 14.4
Terminal
Ghostty
This issue might be a duplicate of existing issues. Please check:
- #1179: ESC often doesn't work - Reports ESC not working for interrupting sessions, with similar symptoms
- #1734: Esc not working on agent hangs - Specifically mentions ESC not interrupting when agent is in 'working' state
- #848: ESC isn't interrupting anything - Direct report that ESC doesn't interrupt anything in version 0.2.23
- #1418: working getting stuck and double esc not exiting - Reports getting stuck on working and double ESC not working
- #684: interrupt sometimes has no effect - Reports interrupt API having no effect and needing multiple presses
- #682: TUI becomes unresponsive upon running a non-terminating process - Reports ESC having no effect when TUI is unresponsive
Feel free to ignore if none of these address your specific case.
i'm not able to replicate this - it absolutely never works for you?
i'm not able to replicate this - it absolutely never works for you?
After the update, the child session doesn't show me options to "always allow," "accept," or "decline," and I cannot exit the session. That is, my main agent delegates a task to a sub-agent, I can see that there's an attempt to edit a file, but I can't do anything - neither exit nor confirm. I also agree with the observation that other bugs have appeared: such as non-working default theme.
i'm not able to replicate this - it absolutely never works for you?
After the update, the child session doesn't show me options to "always allow," "accept," or "decline," and I cannot exit the session. That is, my main agent delegates a task to a sub-agent, I can see that there's an attempt to edit a file, but I can't do anything - neither exit nor confirm. I also agree with the observation that other bugs have appeared: it's impossible to assign keybindings for navigating through child sessions, as well as a non-working default theme.
is any of this relevant to this issue? those are other issues right
is any of this relevant to this issue? those are other issues right
This is the only scenario where ESC doesn't work for me, when an agent delegates a task to a sub-agent. I haven't seen any open tickets on this topic, so I decided not to create additional issues and wrote here instead. If it's more convenient for you that I describe the problem with the non-working ESC in my case, I'll do that. Sorry for any possible confusion.
i'm not able to replicate this - it absolutely never works for you?
Yes, not a single time.
I have already downgraded to 0.15.31 to get it back working.
I'm experiencing the same problem. I'm running several sub agents usually so this might be related.
It used to work in the previous versions, it stopped working recently.
I tested in several terminal emulators: WezTerm, Kitty, Ghostty.
In previous versions I had to keep pressing ESC or rapidly tap it for a while, but that doesn't work in the current version.
i'm not able to replicate this - it absolutely never works for you?
Are you able to use ESC when a sub agent is running?
Might it be related to keyboard mapping? I'm also experiencing the keybind issues that several users reported.
My system:
- Ubuntu
- Wayland
- KDE
I'll do a test in shell without DE to see if that makes a difference. Will report back here.
@thdxr Is there a way to test which keys are being registered? I mean a simple script which logs all key combinations received by the new OpenTUI library. If you point me in the right direction I can write a quick test script and share the results with you.
I'm seeing the same behavior without any subagents. Escape key never stops the agent while actively outputting text or waiting on a command to complete. I am running inside a Nvim terminal on Ghostty which might be some non-standard behavior. C-v still pastes images just fine, but it no longer seems to paste large text chunks as it used to. Might be related 🤷
pushing a version that allows you to interrupt in the ctrl+p command bar
i want to just see if clicking that option successfully interrupts things?
Noticed this happening with permissions, can't esc at all
fixed the permissions one
I have found the issue on my install and why ESC is never working. @thdxr & @rekram1-node
As soon as I have this in my opencode.json config file:
"keybinds": {
"leader": "ctrl+x",
"app_exit": "ctrl+c,<leader>q",
"editor_open": "<leader>e",
"theme_list": "<leader>t",
"session_export": "<leader>x",
"session_new": "<leader>n",
"session_list": "<leader>l",
"session_share": "<leader>s",
"session_unshare": "none",
"session_interrupt": "esc",
"session_compact": "<leader>c",
"messages_page_up": "pgup,shift+up",
"messages_page_down": "pgdown,shift+down",
"messages_half_page_up": "ctrl+alt+u",
"messages_half_page_down": "ctrl+alt+d",
"messages_first": "ctrl+g",
"messages_last": "ctrl+alt+g",
"messages_copy": "<leader>y",
"messages_undo": "<leader>u",
"messages_redo": "<leader>r",
"model_list": "<leader>m",
"model_cycle_recent": "f2",
"model_cycle_recent_reverse": "shift+f2",
"agent_list": "<leader>a",
"agent_cycle": "tab",
"agent_cycle_reverse": "shift+tab",
"input_clear": "ctrl+c",
"input_paste": "ctrl+v",
"input_submit": "enter",
"input_newline": "shift+enter,ctrl+j",
"session_child_cycle": "ctrl+right,<leader>right,ctrl+shift+right",
"session_child_cycle_reverse": "ctrl+left,<leader>left,ctrl+shift+left"
},
ESC does not work.
The moment I delete this whole block, ESC works as intended. I am not sure yet which one of the key binds in this config is triggering the issue.
It is part of the config I had in the 0.15.31 config.
Tested in version 1.0.24
Update:
Turns out it is the key bind: "session_interrupt": "esc",
@thdxr @webboty Removing the session_interrupt keybind works at my side. (using version 1.0.25).
However, I'd like to note that I previously removed the keybinds block completely from my opencode config and the issue persisted.
Right now the esc key works correctly with the session_interrupt keybind removed, and also with all keybinds removed from config. Quite weird since I'm 99% sure that it didn't work with all keybinds removed previously.
I've tested using versions 1.0.20 and 1.0.25. Both work OK now.
@thdxr FYI: As mentioned above the esc session interrupt works at my side now. However, the ctrl+p session interrupt doesn't work. (using WezTerm native install)
(The menu option is visible, but nothing happens if I press enter or click on it)
i just pushed a change so "esc" will be converted to "escape" to prevent others from running into that