opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Esc key doesn't interrupt AI generation in the Opencode VS Code extension

Open mossbergmaverick opened this issue 1 month ago • 11 comments

Description

When using the Opencode extension in VS Code, pressing the Esc key does not stop the AI generation process. Expected behavior: Pressing Esc should interrupt/stop the ongoing AI response generation. Actual behavior: The Esc key has no effect - the AI continues generating the response and cannot be interrupted.

Environment:

VS Code version: 1.105.1 (Universal) Opencode version: v1.0.65 Opencode extension version: 0.0.12

OpenCode version

v1.0.65

Steps to reproduce

  1. Give a task/prompt to the AI in the Opencode extension
  2. While the AI is generating a response, press Esc to try to stop it
  3. The AI generation continues and cannot be stopped

Screenshot and/or share link

No response

Operating System

macOS 15.6

Terminal

No response

mossbergmaverick avatar Nov 15 '25 19:11 mossbergmaverick

I double-checked again: this problem is not limited to the VSCode extension and is related to the permission dialog not being displayed. If I remove

permission:
  edit: ask

then ESC works every time, both during agent generation and when the sub-agent executes a task.

mossbergmaverick avatar Nov 15 '25 20:11 mossbergmaverick

Image

@mossbergmaverick I can't replicate? You can't get permission dialogs to show up ever?

Was this specifically with a subagent?

rekram1-node avatar Nov 16 '25 21:11 rekram1-node

Was this specifically with a subagent?

I apologize for the imprecise description. Here's my specific use case:

  1. Create an agent with configuration in an .md file
  2. Create a subagent in a second file with configuration in an .md file, set ask permissions for write and edit operations
  3. Ask the agent to assign a write and edit task to the subagent

In this scenario, the permission dialog doesn't appear and the ESC button fails to interrupt the process.

mossbergmaverick avatar Nov 16 '25 22:11 mossbergmaverick

Gotcha yeah, currently the permission modals only show up for subagnets if you go to the subagnet view, this is confusing and non ideal I will fix

rekram1-node avatar Nov 17 '25 16:11 rekram1-node

It often doesn’t stop with ESC in the JetBrains Rider console either. I don't use subagents, only have Plan/Build. There is an animation (progress bar?), which can't be stopped either. I can type "STOP", but it goes to a queue.

pawelel avatar Nov 20 '25 12:11 pawelel

We made it so that if a subagent needs permission the tui will automatically navigate to the subagent session so you can see what is happening in scope

rekram1-node avatar Nov 21 '25 18:11 rekram1-node

Image There is nothing I can do except CTRL C.

pawelel avatar Nov 28 '25 08:11 pawelel

We made it so that if a subagent needs permission the tui will automatically navigate to the subagent session so you can see what is happening in scope

Does the auto-navigation work currently? I'm not seeing the session switch automatically. Does this mean the fix for the permission modals is still in progress, or are these separate issues?

mossbergmaverick avatar Dec 01 '25 18:12 mossbergmaverick

@mossbergmaverick yeah that should work, it switches to the child session automatically that needs permission

rekram1-node avatar Dec 02 '25 00:12 rekram1-node

Using opencode in Rider’s built-in terminal causes the terminal to behave incorrectly.

Steps to reproduce: Run opencode in the Rider terminal (I’m using only the default agents).

Observed behavior:

Pressing Esc does not interrupt the “working” animation, and my messages get queued instead.

When I press Ctrl+C, the terminal switches into some kind of mouse-input mode — every mouse move prints weird characters into the terminal.

The terminal returns to normal only after closing and reopening it inside Rider.

Additional note: This behavior occurs only with opencode. Other tools do not trigger the issue.

pawelel avatar Dec 08 '25 10:12 pawelel