Repository navigation
Description
EDIT: solved in 1.2.25
Bug
Starting with v1.2.17, the TUI intermittently breaks when running inside tmux. The text input area renders as a grey box (maybe it's my terminal background color, default Ubuntu terminal), typing and keyboard shortcuts don't work, and mouse movements inject raw SGR escape sequences as text (e.g. ^[[<35;164;12M). The issue does not occur outside tmux, although there are some rendering bugs when switching tabs in the terminal
Root cause
The regression was introduced by commit 3ebebe0 ("fix(process): prevent orphaned opencode subprocesses on shutdown")
Reverting thread.ts and worker.ts from 1.2.17 version to their 1.2.16 version seems to solve the issue. I also tested with a modified 1.2.20 version and it also fixed it.
Environment
Environment
- OS: Ubuntu 22.04 Linux x64
- Terminal: GNOME Terminal (default Ubuntu terminal)
- tmux: 3.2a
- tmux config: set -g default-terminal "tmux-256color", set -ga terminal-overrides ",256col:Tc", no set mouse on, no extended-keys
Plugins
None
OpenCode version
1.2.17 and 1.2.20
Steps to reproduce
- Open a tmux session (tested with tmux 3.2a)
- Run opencode (v1.2.17 or later)
- The textarea loses its styling/borders and appears as a plain region against the terminal background
- Typing text and pressing Enter does not send the prompt
- Ctrl+P does not open the action palette
- Moving the mouse injects raw escape sequences into the input area
- Text extends beyond the original text area boundaries and wraps
The bug is intermittent — it doesn't always reproduce on first launch, but reproduces consistently across multiple attempts. It has never been observed with v1.2.16.
Screenshot and/or share link
No response
Operating System
Ubuntu 22.04
Terminal
Default Ubuntu terminal
Activity
hrez commentedon Mar 7, 2026
It's 100% reproducible for me. No newer opencode version works under tmux including 1.2.21. I have to revert to 1.2.16 for opencode to be usable.
environment: tmux 3.2a, 22.04.1-Ubuntu
tobwen commentedon Mar 8, 2026
Damnit, we worked on the exactly same problem and nearly have equal screenshots. I just provided a PR. Let's hope it will get merged: #16565
hrez commentedon Mar 8, 2026
Unfortunately 1.2.22 does not fix this. So, #16565 isn't the whole story.
Almazick commentedon Mar 9, 2026
Same problem here. I just updated to 1.2.22, and OpenCode in the CLI is completely unusable. I don’t understand how this issue has been going on for a week and nobody noticed, when you can’t even use OpenCode at all.
iloveferrari commentedon Mar 9, 2026
你opencode打开的工程里是不是包含了.git目录?如果有你删了试试?
jwkicklighter commentedon Mar 9, 2026
Same issue on MacOS with tmux 3.5a and 3.6a
thdxr commentedon Mar 9, 2026
what we were seeing is some terminals send SIGHUP to the process when the tab is closed and because opencode didn't handle it, it would hang
we added exiting on SIGHUP
i personally use tmux and haven't seen an issue - can someone track down why tmux is sending SIGHUP?
thdxr commentedon Mar 9, 2026
it's also possible it's not related to the SIGHUP change
i need more information than what is being provided here - i can't reproduce any of it
what does "completely unusable" mean
tobwen commentedon Mar 9, 2026
My 2 cent (I'm poor):
My special issue #16564 was fixed with #16565. I cherry picked every commit, traced the function calls and figured out that the second
stop()puts PuTTY and other terminal emulators in a bad state... And a simpleresetor control-characters couldn't reset it.As I discussed in Discord, the real problem might be more upstream in the
stop()functtion in OpenTUI. All thisAlternate Screenis horror, since it uses a separate buffer in terminal emulators and when there's screen or tmux in between, it can be even worse. I has to do with theSGR Mouse Modeof xterm-aware/non-fully-aware applications, I guess.I think of writing a small OpenTUI test application, but the annoying thing is: I wasn't able to automate the testing, since it needs mouse interaction. Maybe I could write an application, which reads the characters on the screen so that bisecting and debugging is easier.
See the picture posted by me and in the first post... You literally can't use opencode anymore, when you're in this state. These escape sequences not even fill the monitor, it makes keyboard interaction impossible.
thdxr commentedon Mar 9, 2026
we traced down at least one of the issues to these binds in tmux conf - investigating further
jwkicklighter commentedon Mar 9, 2026
Yep, that was from my config on X. I confirmed that removing the
select-windowbinds got rid of the problem for me.My config is based on the Omarchy config with a few keybinds changed, in case that's relevant to anyone else.
asaf92 commentedon Mar 10, 2026
For what it's worth, I don't have any select-window bindings:
One thing I noticed:
ctrl+p doesn't work, it just types ^P into the "grey buffer" thing, but if I follow up with enter or ctrl+m then it does work and open the menu.
roccolycos commentedon Mar 10, 2026
same error in 1.2.24
Almazick commentedon Mar 10, 2026
Everything works from beta version
bunx opencode-ai@betahrez commentedon Mar 10, 2026
tab doesn't switch agents, cntl-p only inserts ^P, arrows don't work, esc doesn't work, enter or shift-enter or cntr-enter or cntr-j just adds a new line. So, can't even send a prompt at all. That's why it's unusable.
The regression came in 1.2.17. Which makes it one of the commits from 1.2.16.
P.S. I have neither M-[ nor select-window in .tmux.conf
dronax commentedon Mar 10, 2026
I faced the same issue with same environment (tmux and wsl), now i am using local build instead of the packaged build. It is working without any issue.
asaf92 commentedon Mar 10, 2026
I can also confirm that a local build (using commit
5ec5d1dac) seems to worktobwen commentedon Mar 10, 2026
Funny, an older build worked only when it's in
~/.opencode/bin/opencode. When I moved it somewhere else, it broke. I really gave up debugging this.tobwen commentedon Mar 10, 2026
@asaf92 In your local build? Because your PR got closed.
asaf92 commentedon Mar 11, 2026
Yeah no need for the PR. Try to build the latest dev branch
karamanliev commentedon Mar 12, 2026
opencode works fine for me in a regular tmux window or pane, but I usually run it in a scratch popup, where I see the same broken behavior shown in the OP’s screenshot.
It happens in both an arch linux desktop PC and a ubuntu 24.04 laptop. Both PCs have
1.2.24installed.asaf92 commentedon Mar 13, 2026
Works in 1.2.25
thdxr commentedon Mar 21, 2026
do you mind checking latest beta to see if it still works right?
npx opencode-ai@betahrez commentedon Mar 22, 2026
0.0.0-beta-202603212143 works fine