Bug: Interrupt does not work as expected #1653

Closed
opened 2026-02-16 17:31:57 -05:00 by yindo · 15 comments
Owner

Originally created by @nikhilmaddirala on GitHub (Sep 8, 2025).

Originally assigned to: @rekram1-node on GitHub.

Here's a simplified version of what happened in this example: https://opencode.ai/s/KWIabDZ8

  • I ask question 1
  • Opencode starts responding to question 1
  • I interrupt by hitting Esc twice
  • I ask question 2
  • Opencode responds to question 1 (it doesn't seem to register question 2)
  • I interrupt and ask question 2 again
  • Opencode still responds to question 1
  • ...
Originally created by @nikhilmaddirala on GitHub (Sep 8, 2025). Originally assigned to: @rekram1-node on GitHub. Here's a simplified version of what happened in this example: https://opencode.ai/s/KWIabDZ8 - I ask question 1 - Opencode starts responding to question 1 - I interrupt by hitting Esc twice - I ask question 2 - Opencode responds to question 1 (it doesn't seem to register question 2) - I interrupt and ask question 2 again - Opencode still responds to question 1 - ...
yindo closed this issue 2026-02-16 17:31:57 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 8, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #684: interrupt sometimes has no effect - describes interrupt API having no effect and needing multiple attempts
  • #888: press ESC again to interrupt does not work - ESC oscillates between states without actually interrupting
  • #1179: ESC often doesn't work - hitting ESC multiple times doesn't interrupt the flow
  • #848: ESC isn't interrupting anything - ESC key stops nothing despite repeated attempts
  • #1734: Esc not working on agent hangs - ESC interruption prompts to press again but doesn't stop operation
  • #2438: Seems to freeze on "working..." with no changes - ESC and double ESC do nothing, just toggles

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Sep 8, 2025): This issue might be a duplicate of existing issues. Please check: - #684: interrupt sometimes has no effect - describes interrupt API having no effect and needing multiple attempts - #888: press ESC again to interrupt does not work - ESC oscillates between states without actually interrupting - #1179: ESC often doesn't work - hitting ESC multiple times doesn't interrupt the flow - #848: ESC isn't interrupting anything - ESC key stops nothing despite repeated attempts - #1734: Esc not working on agent hangs - ESC interruption prompts to press again but doesn't stop operation - #2438: Seems to freeze on "working..." with no changes - ESC and double ESC do nothing, just toggles Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Sep 8, 2025):

thanks for raising this, I will take a look

@rekram1-node commented on GitHub (Sep 8, 2025): thanks for raising this, I will take a look
Author
Owner

@rekram1-node commented on GitHub (Sep 10, 2025):

Looking at the thinking block it seems like a grok code fluke maybe, it kinda confused itself:

The user message is: "@general who are youUse the above message and context to generate a prompt and call the task tool with subagent: general

Interpreting user queries
The user has asked "who are you" directed at "@general," suggesting a request for information about this entity.
Another query, "who are you" directed at "@tyrion," indicates a similar request for details about that entity.
Both queries seem to seek identification or background information, likely expecting a description of roles or identities.
Preparing response approach
Need to generate prompts based on the user’s messages to address each query separately.
The prompts will involve calling a task tool with a subagent, likely "general" for the first and "tyrion" for the second.
Aim is to ensure responses are tailored to each entity while maintaining clarity and relevance.
Preparing response approach
The task involves generating prompts for "@general who are you" and "@tyrion who are you," each calling the task tool with their respective subagents.

so the llm definitely got both questions

@rekram1-node commented on GitHub (Sep 10, 2025): Looking at the thinking block it seems like a grok code fluke maybe, it kinda confused itself: ``` The user message is: "@general who are youUse the above message and context to generate a prompt and call the task tool with subagent: general Interpreting user queries The user has asked "who are you" directed at "@general," suggesting a request for information about this entity. Another query, "who are you" directed at "@tyrion," indicates a similar request for details about that entity. Both queries seem to seek identification or background information, likely expecting a description of roles or identities. Preparing response approach Need to generate prompts based on the user’s messages to address each query separately. The prompts will involve calling a task tool with a subagent, likely "general" for the first and "tyrion" for the second. Aim is to ensure responses are tailored to each entity while maintaining clarity and relevance. Preparing response approach The task involves generating prompts for "@general who are you" and "@tyrion who are you," each calling the task tool with their respective subagents. ``` so the llm definitely got both questions
Author
Owner

@nikhilmaddirala commented on GitHub (Sep 10, 2025):

@rekram1-node

so the llm definitely got both questions

In addition to both questions, the llm needs to get some message indicating "the user canceled the first question and then asked the second question" else it's bound to get confused by looking at two separate questions.

@nikhilmaddirala commented on GitHub (Sep 10, 2025): @rekram1-node > so the llm definitely got both questions In addition to both questions, the llm needs to get some message indicating "the user canceled the first question and then asked the second question" else it's bound to get confused by looking at two separate questions.
Author
Owner

@rekram1-node commented on GitHub (Sep 10, 2025):

Yeah that makes sense

@rekram1-node commented on GitHub (Sep 10, 2025): Yeah that makes sense
Author
Owner

@rekram1-node commented on GitHub (Sep 18, 2025):

We made some tweaks for interruptions I think this should be addressed a lot better now, but if it continues happening lmk and we can adjust

@rekram1-node commented on GitHub (Sep 18, 2025): We made some tweaks for interruptions I think this should be addressed a lot better now, but if it continues happening lmk and we can adjust
Author
Owner

@westykid commented on GitHub (Oct 23, 2025):

it continues... looking at https://github.com/sst/opencode/issues/888 I wonder if this is an linux-specific thing too?

I use opencode (0.15.14) in a VM running Ubuntu 22.04 on a Mac Sonama host.

I have never got any model to stop on double (or multiple) esc presses. I normally use Grok 4 Fast. But I have tried with many different models via many different providers.

@westykid commented on GitHub (Oct 23, 2025): it continues... looking at https://github.com/sst/opencode/issues/888 I wonder if this is an linux-specific thing too? I use opencode (0.15.14) in a VM running Ubuntu 22.04 on a Mac Sonama host. I have never got any model to stop on double (or multiple) esc presses. I normally use Grok 4 Fast. But I have tried with many different models via many different providers.
Author
Owner

@rekram1-node commented on GitHub (Oct 23, 2025):

is it registering the key press at all? does it say anything indicating that it was captured

@rekram1-node commented on GitHub (Oct 23, 2025): is it registering the key press at all? does it say anything indicating that it was captured
Author
Owner

@westykid commented on GitHub (Oct 23, 2025):

Yes it does - I get 'esc again' flash up (bottom left notice) - but nothing happens after second press except message disappearing - the same cycle of two esc key presses can be repeated with IMO no UI errors... it just won't stop what it's doing... without a force quit...

@westykid commented on GitHub (Oct 23, 2025): Yes it does - I get 'esc again' flash up (bottom left notice) - but nothing happens after second press except message disappearing - the same cycle of two `esc` key presses can be repeated with IMO no UI errors... it just won't stop what it's doing... without a force quit...
Author
Owner

@rekram1-node commented on GitHub (Oct 23, 2025):

that’s weird hmm never seen that happen

i cant replicate either :/

can u show logs for it by chance?

@rekram1-node commented on GitHub (Oct 23, 2025): that’s weird hmm never seen that happen i cant replicate either :/ can u show logs for it by chance?
Author
Owner

@westykid commented on GitHub (Oct 23, 2025):

Yes - but from where do I get those? I'll take a video of it too if you like but tomorrow...

@westykid commented on GitHub (Oct 23, 2025): Yes - but from where do I get those? I'll take a video of it too if you like but tomorrow...
Author
Owner

@rekram1-node commented on GitHub (Oct 23, 2025):

awesome thanks!

~/.local/share/opencode/log/….

^ they are by timestamp so ideally u start a new opencode instance then do the double esc mid session then close and copy latest log file

@rekram1-node commented on GitHub (Oct 23, 2025): awesome thanks! ~/.local/share/opencode/log/…. ^ they are by timestamp so ideally u start a new opencode instance then do the double esc mid session then close and copy latest log file
Author
Owner

@westykid commented on GitHub (Oct 24, 2025):

I think I may have identified an issue that is due to my system not opencode - let me do some more testing first to confirm scenarios but I have just tried a new session (with Grok 4 Fast) and for the first time (that I've seen) I got 'Request was aborted'... exactly the expected behaviour... (I have 7 opencode instances running at once - some through PTY - all with different model/provider combinations ... and a custom WIP MCP cluster ... get's a bit tricky to binary chop issues... )

@westykid commented on GitHub (Oct 24, 2025): I think I may have identified an issue that is due to my system not opencode - let me do some more testing first to confirm scenarios but I have just tried a new session (with Grok 4 Fast) and for the first time (that I've seen) I got 'Request was aborted'... exactly the expected behaviour... (I have 7 opencode instances running at once - some through PTY - all with different model/provider combinations ... and a custom WIP MCP cluster ... get's a bit tricky to binary chop issues... )
Author
Owner

@westykid commented on GitHub (Oct 24, 2025):

Happy days @rekram1-node ... I was getting confused and testing in a wrong instance - one that lived in PTY - therefore contaminating the SUT - I used opencode to help fix it 👍

Root Cause: Buffer-to-string conversion in stdin forwarding was altering timing and byte boundaries, breaking double-ESC detection.

... which would have taken me days to figure out.

Tested a few times (3) and got an abort every time.

So - my bad... apologies... but thank you for being so very, very proactive 🖖🏻

@westykid commented on GitHub (Oct 24, 2025): Happy days @rekram1-node ... I was getting confused and testing in a wrong instance - one that lived in PTY - therefore contaminating the SUT - I used opencode to help fix it 👍 > **Root Cause**: Buffer-to-string conversion in stdin forwarding was altering timing and byte boundaries, breaking double-ESC detection. ... which would have taken me days to figure out. Tested a few times (3) and got an abort every time. So - my bad... apologies... but thank you for being so very, very proactive 🖖🏻
Author
Owner

@rekram1-node commented on GitHub (Oct 24, 2025):

Yeah no probs glad we got it figured out

@rekram1-node commented on GitHub (Oct 24, 2025): Yeah no probs glad we got it figured out
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1653