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
tui: messages_copy with nothing selected writes an empty clipboard (wipes the previous content) #55924
In the TUI, <leader>y (messages_copy) with nothing selected writes an empty string to the system clipboard. It does not leave the clipboard as it was: whatever was there before is gone.
Steps to reproduce
Copy some text in another app, so the clipboard has content.
In the opencode TUI, with the composer focused and no selection active, press ctrl+x then y.
Paste anywhere: the clipboard is empty (same on both sides of the clipboard bridge I checked).
Reproduced twice on v2.0.30. The key presses were injected with herdr pane send-keys, so nothing else touched the terminal, and the clipboard was read back before and after.
Expected
Either copy the focused or the last message, or do nothing and leave the clipboard untouched.
Environment
opencode v2.0.30 (TUI), Linux (Ubuntu 26.04), x86_64
Plain terminal over SSH inside herdr 0.9.3, which reports TERM_PROGRAM=herdr and has mouse capture on, so the TUI may never see a selection
X11 present on the host (DISPLAY set) and xclip installed and on PATH
terminal.copy left at its default
Notes
The troubleshooting page asks for xclip/xsel (or wl-clipboard) on the machine running opencode. Here xclip is installed and on PATH and the copy is still empty, so this is not a missing-tool problem.
Copying with a mouse selection inside the multiplexer does work (the multiplexer does that copy itself), so the bug is specific to the TUI's own copy action.
Thanks for the detailed report! I tried to reproduce this on v2.0.30 on Linux with an X11 display (DISPLAY set) and xclip installed, leaving terminal.copy at its default. I put a marker string on the clipboard with xclip before pressing ctrl+x then y, and read it back afterwards:
Home screen, no session open: the copy command only exists inside a session, so the y was just typed into the composer. The clipboard was unchanged.
Session with an assistant reply: the "Message copied to clipboard!" toast appeared. Reading the clipboard with xclip afterwards still gave the earlier marker. It was neither emptied nor replaced with the message.
So I couldn't get an empty clipboard here. One thing to know: <leader>y doesn't use the current selection at all. It copies the text of the last assistant message in the current session. If there's no assistant message, or it has no text, it shows an error toast and doesn't write anything.
I didn't test over SSH or inside herdr. Those are the most likely difference, since opencode also sends the copy to the terminal (the OSC 52 escape sequence), and the multiplexer or SSH clipboard bridge decides what to do with it. These details would help:
Were you on a session screen with an assistant reply when you pressed ctrl+x then y, and which toast appeared, if any?
Does it still happen when you run opencode in the same SSH session without herdr, or with herdr but not over SSH?
How did you read the clipboard back (for example xclip -o -selection clipboard on the remote host, or pasting on your local machine)?
Related: #50208 ("Copied to clipboard" does not update the local clipboard over SSH and tmux). That one leaves the clipboard unchanged; yours wipes it.
I'm closing this issue for now because we couldn't reproduce it and haven't heard back. On v2.0.30 with X11 and xclip, <leader>y never emptied the clipboard. Outside a session it doesn't copy anything. In a session it copies the last assistant message, and our existing clipboard content wasn't wiped. We didn't test over SSH or inside herdr, so the remaining questions were which screen and toast you saw, whether it still happens without SSH or without herdr, and how you read the clipboard back.
If you still see the clipboard being wiped, please comment here with those details or open a new issue and we'll look again. For the related case where copying over SSH or a multiplexer doesn't reach your local clipboard, see #50208. Thanks for the careful report!
Activity
opencode-agent commentedon Oct 16, 2026
Thanks for the detailed report! I tried to reproduce this on v2.0.30 on Linux with an X11 display (
DISPLAYset) andxclipinstalled, leavingterminal.copyat its default. I put a marker string on the clipboard withxclipbefore pressingctrl+xtheny, and read it back afterwards:ywas just typed into the composer. The clipboard was unchanged.xclipafterwards still gave the earlier marker. It was neither emptied nor replaced with the message.So I couldn't get an empty clipboard here. One thing to know:
<leader>ydoesn't use the current selection at all. It copies the text of the last assistant message in the current session. If there's no assistant message, or it has no text, it shows an error toast and doesn't write anything.I didn't test over SSH or inside
herdr. Those are the most likely difference, since opencode also sends the copy to the terminal (the OSC 52 escape sequence), and the multiplexer or SSH clipboard bridge decides what to do with it. These details would help:ctrl+xtheny, and which toast appeared, if any?herdr, or withherdrbut not over SSH?xclip -o -selection clipboardon the remote host, or pasting on your local machine)?Related: #50208 ("Copied to clipboard" does not update the local clipboard over SSH and tmux). That one leaves the clipboard unchanged; yours wipes it.
opencode-agent commentedon Oct 19, 2026
I'm closing this issue for now because we couldn't reproduce it and haven't heard back. On v2.0.30 with X11 and
xclip,<leader>ynever emptied the clipboard. Outside a session it doesn't copy anything. In a session it copies the last assistant message, and our existing clipboard content wasn't wiped. We didn't test over SSH or insideherdr, so the remaining questions were which screen and toast you saw, whether it still happens without SSH or withoutherdr, and how you read the clipboard back.If you still see the clipboard being wiped, please comment here with those details or open a new issue and we'll look again. For the related case where copying over SSH or a multiplexer doesn't reach your local clipboard, see #50208. Thanks for the careful report!