microsoft / microsoft/vscode-remote-release
OSC52 clipboard escape sequences not working in Remote SSH terminal
Nobody has claimed this yet.
- Dominant language
- Dockerfile
- Stars
- 4.2k
- Forks
- 469
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Problem
OSC52 escape sequences for clipboard operations work in VS Code's local integrated terminal but are silently ignored when connected via Remote SSH.
Environment
- VS Code version: Latest (Feb 2026)
- Remote - SSH extension: Latest
- Local OS: macOS
- Remote OS: Ubuntu (headless server, no X11/DISPLAY)
- Terminal: VS Code integrated terminal
Steps to Reproduce
- Connect to a remote server via VS Code Remote SSH
- Open the integrated terminal
- Run:
printf "\033]52;c;$(printf "%s" "test clipboard" | base64)\007" - Try to paste (Cmd+V on Mac) in any application
Expected: "test clipboard" should be in system clipboard
Actual: Nothing is copied to clipboard
Evidence That Local Terminal Works
The same OSC52 command works perfectly in:
- VS Code's local integrated terminal
- iTerm2 with direct SSH connection
- Any terminal that supports OSC52
Related Issues
- xterm.js #3260 - OSC52 support added via PR #4220 (April 2024)
- VS Code #193508 - OSC52 support added to VS Code terminal (June 2024)
- GitHub Community #153471 - Same issue reported for Codespaces
- vscode-remote-release #5905 - Related clipboard feature request
- vscode-remote-release #8049 - tmux clipboard issue (duplicate)
Technical Analysis
OSC52 works by having the local terminal emulator intercept escape sequences and write to the system clipboard. Over SSH, these sequences should pass through transparently and be handled by the local VS Code terminal.
The issue appears to be that VS Code Remote SSH's terminal forwarding either:
- Strips OSC52 sequences before they reach the local terminal emulator
- The xterm.js clipboard addon isn't loaded/active in Remote SSH context
- There's a security policy blocking clipboard access in remote terminal sessions
Impact
This breaks clipboard functionality for:
- CLI tools that use OSC52 (opencode, claude-code, neovim with OSC52 plugin, etc.)
- tmux copy-paste workflows
- Any remote development workflow requiring programmatic clipboard access
Workaround
Currently, users must either:
- Use mouse selection + Cmd+C (defeats the purpose of CLI tools)
- Use a separate terminal app (iTerm2) with direct SSH instead of VS Code Remote SSH
Request
Please ensure OSC52 escape sequences are properly forwarded and handled in Remote SSH terminal sessions, matching the behavior of local integrated terminals.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the OSC52 command in a VS Code Remote SSH integrated terminal and compare it with the local terminal and direct iTerm2 SSH behavior. Read the related xterm.js #3260, VS Code #193508, and remote-release #5905 and #8049 discussions before tracing terminal forwarding. Done means OSC52 clipboard writes work remotely without breaking existing local behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vscode
- Domain
- cli, developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100