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
Input sometimes starts to only show ASCII escape codes #5181
@bcardarella So the actual issue is memory pressure and the process getting killed, which doesn't reset the terminal, stdin staying in raw mode with mouse capturing enabled, ending up in the spilled escaped sequence issue.
Can you run with opencode spawn, which separates the server and TUI in own processes. Then when the high memory usage happens, could you check which of the processes has the high memory usage? On macos you can run ps -axww -o pid,ppid,command | grep opencode which should give you something like this:
Where the second process 19989 is the TUI, so you can lookup which process actually has the high memory usage. That would help diagnosing if it is an agent or TUI issue.
Edit: Sorry I meant what @vruss posted doesn't look like opencode.
Oh I forgot to mention it happens after I exit opencode with ctrl+c. Then that terminal window is bugged and keep spewing characters as I move my mouse aroudn until I close it.
Steps to reproduce for me:
Start opencode from terminal
Type any prompt
Kill process with ctrl+c
Now mouse will enter stuff in terminal, if not, then repeat step 1-3
I just did that like 50 times with PowerShell 7.5.4 on win11 and it exits cleanly with ctrl+c. It definitely looks like windows is shutting down the process before any cleanup can happen. The signal seems to be fine, just SIGINT for ctrl+c. Maybe windows/bun has a limit in which a process needs to be shut down after the signal and if it is too slow it will not get to the cleanup part. I can try moving the the terminal cleanup up front before other shutdown stuff so it happens as the first thing when a signal is received. I'll try that tomorrow and give you a snapshot to test.
Ok thank you @kommander ! Just some some more context. I tried this in Alacritty and WezTerm too, with powershell and gitbash as shell and they all have the same behavior.
Activity
github-actions commentedon Dec 6, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
vruss commentedon Dec 8, 2025
Having same issue on Windows both in git bash and powershell using both the new Windows terminal and built in VS Code terminal
kommander commentedon Dec 8, 2025
You are mentioning version
1.0.34, which had that issue, is that a typo in the version or can you upgrade to the latest version, which is quite ahead?bcardarella commentedon Dec 8, 2025
It's version 1.0.134
kommander commentedon Dec 8, 2025
What command are you running to get this?
bcardarella commentedon Dec 8, 2025
It happens when the opencode memory grows crazy high. 10s of GBs. There's no specifc command, if I run for 3 - 4 hours of work it'll happen every time
kommander commentedon Dec 8, 2025
But that doesn't look like opencode?
Edit: Sorry I meant what @vruss posted doesn't look like opencode.
kommander commentedon Dec 8, 2025
@bcardarella So the actual issue is memory pressure and the process getting killed, which doesn't reset the terminal, stdin staying in raw mode with mouse capturing enabled, ending up in the spilled escaped sequence issue.
Can you run with
opencode spawn, which separates the server and TUI in own processes. Then when the high memory usage happens, could you check which of the processes has the high memory usage? On macos you can runps -axww -o pid,ppid,command | grep opencodewhich should give you something like this:Where the second process
19989is the TUI, so you can lookup which process actually has the high memory usage. That would help diagnosing if it is an agent or TUI issue.bcardarella commentedon Dec 8, 2025
Will do!
vruss commentedon Dec 9, 2025
Oh I forgot to mention it happens after I exit opencode with ctrl+c. Then that terminal window is bugged and keep spewing characters as I move my mouse aroudn until I close it.
Steps to reproduce for me:
kommander commentedon Dec 9, 2025
I just did that like 50 times with PowerShell 7.5.4 on win11 and it exits cleanly with
ctrl+c. It definitely looks like windows is shutting down the process before any cleanup can happen. The signal seems to be fine, justSIGINTforctrl+c. Maybe windows/bun has a limit in which a process needs to be shut down after the signal and if it is too slow it will not get to the cleanup part. I can try moving the the terminal cleanup up front before other shutdown stuff so it happens as the first thing when a signal is received. I'll try that tomorrow and give you a snapshot to test.vruss commentedon Dec 9, 2025
Ok thank you @kommander ! Just some some more context. I tried this in Alacritty and WezTerm too, with powershell and gitbash as shell and they all have the same behavior.