microsoft / microsoft/vscode-remote-release

OSC52 clipboard escape sequences not working in Remote SSH terminal

Open
#11,475 0 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ssh
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

  1. Connect to a remote server via VS Code Remote SSH
  2. Open the integrated terminal
  3. Run: printf "\033]52;c;$(printf "%s" "test clipboard" | base64)\007"
  4. 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

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:

  1. Strips OSC52 sequences before they reach the local terminal emulator
  2. The xterm.js clipboard addon isn't loaded/active in Remote SSH context
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.