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
[Bug] Terminal flooded with raw mouse escape sequences (SGR) when running commands #26198
The CLI enables mouse tracking in the terminal, but if a process runs or gets interrupted, it fails to send the escape sequence to disable mouse tracking before handing control back to the prompt. As a result, the terminal gets stuck in raw mouse reporting mode.
Any tiny mouse movement over the terminal window instantly floods the command line with ANSI SGR coordinates ([555;100;66M), making it impossible to type.
Environment
OS: Windows 11
Terminal: Windows Terminal (PowerShell)
OpenCode Version: 1.14.40 (Saw this in other previous version too)
Steps to Reproduce
The model decides on its own to execute a system command (in my case, the DeepSeek V4 pro it needed to run Stop-Process to kill a stale Node server).
Expected Behavior
Because OpenCode uses mouse tracking for interactivity, it is expected that the terminal remains in mouse-tracking mode while the CLI is active. However, when the CLI hands control back to the standard shell (such as when executing a system command like Stop-Process), it must either:
Disable tracking (via \x1b[?1000l or \x1b[?1006l) before the prompt is returned to the user, OR
Suspend tracking during the execution of child processes and resume it immediately after, ensuring that shell input is never interpreted as mouse coordinates.
Currently, the CLI appears to lose track of its state during the process execution, leaving the terminal in a dirty state where mouse events are leaked into the standard input buffer.
Actual Behavior
The terminal captures the mouse movements as literal text inputs. My prompt gets spammed with a massive block of gibberish like this: -[555;100;66M[555;100;67M[555;100;68M[555;100;69M[555;...
Screenshots
Reacted by SpaceZhenya, ilyar, Aleksei Sukontsev, Ash Bryant and Andrey Solovev
If your issue is not already covered by these, please add any additional context that distinguishes it.
This issue started happening again in v1.14.40 on Windows 11. I have reviewed the existing issues listed above (especially #20458), and while they share the same symptoms, it’s clear the fix is either incomplete or regressing.
It is frustrating to see this persist, especially since the technical cause, incorrect ordering of stdin.setRawMode(false) and disableMouse(), has been identified before. If the terminal is taken out of raw mode before the \x1b[?1000l (or 1006l) sequence is sent, those characters are echoed back to the prompt as literal text.
I am reporting this because the dirty state is still leaking into the shell in the latest release. This deserves a permanent fix in the core TUI lifecycle rather than relying on users to manually reset their terminals.
Note: I have also confirmed that this issue persists when running Ubuntu via WSL2. This suggests the bug isn't just isolated to the Windows console driver, but is a fundamental issue in the CLIs TUI cleanup logic across different shell environments, I guess.
@thdxr as I mentioned in the steps to reproduce, the model itself is executing the kill command. In my case, DeepSeek V4 Pro decided to run Stop-Process in PowerShell to kill a stale Node server.
However, I want to add that this has now happened twice in v1.14.41. At first, I thought it was just a corrupted session from my previous setup, so I did a completely clean/hard uninstall of OpenCode (wiping the app, all configs, everything).
After the clean install, it happened again on v1.14.41, this time while using a Kimi model. This second time, it wasn't even a kill process (I can't remember exactly what command it ran because the terminal instantly went completely crazy).
IMHO, this suggests it's not just tied to Stop-Process, but rather any command execution/hand-off by the model can potentially interrupt the TUI lifecycle and leave the terminal flooded.
The same issue occurs in Linux environments. Reproduction only occurs when there are a large number of contexts in the session memory; exiting normally occurs with few or no contexts.
@toi500 you are asking the model to kill all node processes and it seems to identify opencode as node process and kills it. Killed that way the process has no way to do cleanup.
@toi500 you are asking the model to kill all node processes and it seems to identify opencode as node process and kills it. Killed that way the process has no way to do cleanup.
No. If you read this issue in full, you will see that neither I nor other users are asking the model to kill anything. What you see here #26198 (comment) it was just a easy way to show how to reproduce the bug.
I handle any manual processes on my own, but as you are well aware, I am in control of what the model does.
you will see that neither I nor other users are asking the model to kill anything
What is this if not asking the model to kill processes? It identifies the opencode process as node process and kills it, at that point there is nothing any process/app can do to cleanup properly.
I have this bug only when I am using opencode in gitbash. I just opened
opencode and I could use it there
сб, 16 трав. 2026 р. о 01:38 toi500 ***@***.***> пише:
Activity
github-actions commentedon May 7, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is not already covered by these, please add any additional context that distinguishes it.
toi500 commentedon May 7, 2026
This issue started happening again in v1.14.40 on Windows 11. I have reviewed the existing issues listed above (especially #20458), and while they share the same symptoms, it’s clear the fix is either incomplete or regressing.
It is frustrating to see this persist, especially since the technical cause, incorrect ordering of
stdin.setRawMode(false)anddisableMouse(), has been identified before. If the terminal is taken out of raw mode before the\x1b[?1000l(or1006l) sequence is sent, those characters are echoed back to the prompt as literal text.I am reporting this because the dirty state is still leaking into the shell in the latest release. This deserves a permanent fix in the core TUI lifecycle rather than relying on users to manually
resettheir terminals.toi500 commentedon May 7, 2026
Note: I have also confirmed that this issue persists when running Ubuntu via WSL2. This suggests the bug isn't just isolated to the Windows console driver, but is a fundamental issue in the CLIs TUI cleanup logic across different shell environments, I guess.
toi500 commentedon May 8, 2026
@kommander, still happening in v1.14.41 too.
thdxr commentedon May 8, 2026
we're having a hard time reproducing this. what is killing the process?
toi500 commentedon May 9, 2026
@thdxr as I mentioned in the steps to reproduce, the model itself is executing the kill command. In my case, DeepSeek V4 Pro decided to run Stop-Process in PowerShell to kill a stale Node server.
However, I want to add that this has now happened twice in v1.14.41. At first, I thought it was just a corrupted session from my previous setup, so I did a completely clean/hard uninstall of OpenCode (wiping the app, all configs, everything).
After the clean install, it happened again on v1.14.41, this time while using a Kimi model. This second time, it wasn't even a kill process (I can't remember exactly what command it ran because the terminal instantly went completely crazy).
IMHO, this suggests it's not just tied to Stop-Process, but rather any command execution/hand-off by the model can potentially interrupt the TUI lifecycle and leave the terminal flooded.
SpaceZhenya commentedon May 9, 2026
I have the same proplem too!
toi500 commentedon May 11, 2026
@thdxr, version 1.14.48
I just asked the LLM to run
$ Get-Process -Name node -ErrorAction SilentlyContinue | Stop-Process -Forcetoi500 commentedon May 15, 2026
Happened again. It keeps breaking long context sessions, corrupting any well crafted session you try to build.
Just frustrating.
l246804 commentedon May 15, 2026
The same issue occurs in Linux environments. Reproduction only occurs when there are a large number of contexts in the session memory; exiting normally occurs with few or no contexts.
kommander commentedon May 15, 2026
@toi500 you are asking the model to kill all node processes and it seems to identify opencode as node process and kills it. Killed that way the process has no way to do cleanup.
thdxr commentedon May 15, 2026
i am getting rid of the node wrapper when installed via npm - has been on our list for a while but no one could get to it
toi500 commentedon May 15, 2026
No. If you read this issue in full, you will see that neither I nor other users are asking the model to kill anything. What you see here #26198 (comment) it was just a easy way to show how to reproduce the bug.
I handle any manual processes on my own, but as you are well aware, I am in control of what the model does.
kommander commentedon May 15, 2026
What is this if not asking the model to kill processes? It identifies the opencode process as node process and kills it, at that point there is nothing any process/app can do to cleanup properly.
toi500 commentedon May 15, 2026
What?
I just told you that was my way to tell @thdxr how to reproduce the bug.
Original Issue:
Other users:
Please do not ping me again unless you want to discuss the actual technicality of the issue. I am not here for excuses or to waste my time.
SpaceZhenya commentedon May 27, 2026
github-actions commentedon Jul 27, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.