GeezerVison is showing github.com — OSC52 clipboard doesn't work with VS Code Remote SSH - need fallback or detection · Issue #11909 · anomalyco/opencode
OSC52 clipboard doesn't work with VS Code Remote SSH - need fallback or detection #11909Labels opentuiThis relates to changes in v1.0, now that opencode uses opentui DescriptionProblem
v1.1.49 (released today, Feb 3, 2026) introduced OSC52 clipboard via "Use OpenTUI OSC52 clipboard implementation". This does not work with VS Code Remote SSH - one of the most popular remote development setups.
This is a regression - clipboard operations that may have worked before (or at least didn't claim success) now show a success message but silently fail.
VS Code Remote SSH has a known limitation where OSC52 escape sequences are not properly forwarded to the local terminal. This has been documented for years:
Current Behavior (v1.1.49)
- User runs opencode via VS Code Remote SSH
- User copies something (Ctrl+X Y, copy last message, etc.)
- opencode shows "Copied to clipboard" toast ✓
- Nothing is actually in the clipboard ✗
This is misleading - users think it worked when it didn't.
Environment Detection
The issue is detectable. VS Code Remote SSH sessions have:
TERM_PROGRAM=vscode
VSCODE_IPC_HOOK_CLI=/tmp/vscode-ipc-xxx.sock
Combined with no DISPLAY and XDG_SESSION_TYPE=tty, this indicates VS Code Remote SSH where OSC52 won't work.
Suggested Solutions
Option 1: Detect and Warn
When detecting VS Code Remote SSH environment, show a warning:
"Clipboard via OSC52 may not work in VS Code Remote SSH. Use mouse selection + Cmd+C instead."
Option 2: VS Code Extension Integration
VS Code extensions can access the local clipboard. Consider:
- A companion VS Code extension that opencode can communicate with
- Using VS Code's clipboard API via the extension host
Option 3: Better Error Handling
PR #8974 fires OSC52 "first, always" but has no way to verify it worked. At minimum:
- Don't show "Copied to clipboard" if we can't verify success
- Show "Attempted to copy (OSC52)" with a note about potential limitations
Option 4: Alternative Clipboard Methods
For VS Code Remote SSH specifically:
- Write to a temp file that user can manually copy
- Integrate with VS Code's terminal selection (select text programmatically)
Impact
VS Code Remote SSH is extremely popular for remote development. Many users are affected by this silent failure introduced in v1.1.49. The current behavior where opencode claims success but nothing is copied is frustrating and breaks trust.
Related
Request
Please either:
- Detect VS Code Remote SSH and warn users, OR
- Provide an alternative clipboard method for this environment, OR
- Don't claim success when we can't verify the clipboard operation worked
The current silent failure with a misleading success message is the worst possible UX. This is especially urgent since it just shipped today and will affect many users upgrading to v1.1.49. Activitygithub-actions commented on Feb 3, 2026 This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case. ErcinDedeoglu commented on Feb 3, 2026 Update: Mouse selection workaround also broken
The situation is actually worse than described. Mouse text selection doesn't work as a workaround because:
- User tries to select text with mouse
- On mouse button release, opencode intercepts the selection
- opencode unselects the text and shows "copied" message
- OSC52 fails silently
- Nothing in clipboard, and the selection is gone
So users can't even manually select text and use Cmd+C as a fallback. The auto-copy-on-selection behavior with broken OSC52 makes the terminal completely unusable for copying text in VS Code Remote SSH.
This needs urgent attention - there's literally no way to copy text from opencode in VS Code Remote SSH right now. ErcinDedeoglu commented on Feb 3, 2026 Additional finding: Shift+drag doesn't work either
Tried using Shift+click and drag to bypass TUI mouse handling - doesn't work. opencode still intercepts the selection.
Summary of what's broken in VS Code Remote SSH:
- ❌ OSC52 clipboard (silently fails)
- ❌ Mouse selection (intercepted, cleared, fake "copied")
- ❌ Shift+mouse selection (still intercepted)
- ❌ Manual Cmd+C (selection is gone before you can copy)
Literally zero ways to copy text from opencode in VS Code Remote SSH.
The only workarounds are:
- Downgrade to v1.1.48
- Use a different terminal (iTerm2 + direct SSH)
- Use
opencode export to dump session to file
This is a critical regression that needs immediate attention. okuuko commented on Feb 3, 2026 I'm hitting the same regression. My setup: opencode running in a headless NixOS microVM, accessed over SSH from Alacritty on a Hyprland/Wayland workstation.
Clipboard worked on 1.1.48, broke on 1.1.49.
The VM has no display server and no clipboard utilities (wl-copy, xclip, etc.) — OSC 52 through the SSH terminal is the only clipboard path. The old process.stdout implementation in 1.1.48 was actually working correctly in this setup. The switch to opentui's renderer.copyToClipboardOSC52 in #11744 broke it.
To confirm it's not a terminal issue: raw OSC 52 sequences sent manually from the VM still reach Alacritty and set the Wayland clipboard correctly:
printf '\033]52;c;%s\a' "$(echo -n 'test' | base64)"
The opencode TUI still shows "selection copied to clipboard" on text select, but nothing reaches the terminal/clipboard.
Environment:
- opencode 1.1.49 (self-updated from 1.1.48 where clipboard worked)
- Headless NixOS VM (no
DISPLAY, no WAYLAND_DISPLAY)
- SSH from Alacritty (OSC 52 enabled) on Hyprland/Wayland
- No clipboard binaries in VM — relies entirely on OSC 52
Reacted by Dan Grystad, crd2333, Ercin Dedeoglu and Nick Gondek zhiyozhao commented on Feb 4, 2026 Opencode osc52 support seems broken for me too. I am running opencode in tmux on a remote server through ssh. And have all my osc52 setup configured and tested, everything works fine (local iterm, ssh, tmux) except opencode. Does opencode always adopt osc52 or only adopt it when system clipboard fails?
OSC52 works with tmux, but not opencode
When dragging with mouse and release, opencode shows clipboard set and nothing in my local clipboard. However, at the same place(still in opencode), after i enter tmux copy mode with ctrl-b + [, mouse drag and release correctly update my local clipboard.
Environment
opencode: 1.1.49
server os: macos 15.6.1 Rooneyxu commented on Feb 4, 2026 Hi! I can reproduce this consistently in VS Code Remote-SSH on Ubuntu (headless / no GUI session).
Environment
Client: VS Code integrated terminal (Remote-SSH)
Remote: Ubuntu (no X11/Wayland session)
TERM_PROGRAM=vscode
OpenCode version:
✅ works: v1.1.48
❌ broken: v1.1.49 (and v1.1.50 “fallback to native clipboard” still doesn’t help)
Symptoms
In v1.1.49+, copying from the TUI (e.g. leader copy action / “Copied to clipboard” toast) reports success, but nothing is actually available to paste on the client machine.
In v1.1.48, copy/paste behaves as expected in my workflow. jc01rho commented on Feb 4, 2026 v1.1.50 still doesn't fix the issue. issue is still exist. ErcinDedeoglu commented on Feb 4, 2026
MetadataMetadataopentuiThis relates to changes in v1.0, now that opencode uses opentui DevelopmentNo branches or pull requestsIssue actions
|