Skip to content

feat(clipboard): forward copies through Herdr and SSH - #417

Merged
fcoury merged 4 commits into
mainfrom
fcoury/clipboard-transports
Oct 22, 2026
Merged

fcoury merged 4 commits into
mainfrom
fcoury/clipboard-transports

Conversation

@fcoury-oai

@fcoury-oai fcoury-oai commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Copies in Red currently target the clipboard on the machine running the editor. Over SSH or herdr --remote, this leaves the attached client's clipboard unchanged, even when applications such as Neovim copy successfully through the same connection.

Route buffer, agent, and plugin copies through the active frontend. Auto selects OSC 52 for SSH, tmux, and persistent Herdr panes, including panes without SSH variables; local sessions retain native clipboard behavior. Add explicit backend selection, bounded terminal writes, visible delivery failures, and red clipboard diagnostics. Remote paste uses Red's register or the terminal paste shortcut without querying the client's clipboard.

Detached sessions forward transient copies to the current attachment, including background plugin copies, and discard pending delivery on disconnect. Native paste is requested only during paste actions. Detach IPC becomes version 4; restart older detached owners before using an updated frontend. The plugin host API version is unchanged.

Refresh Wasmtime/Cranelift and TLS certificate dependencies to address all four RustSec findings from the security audit. Pending copy effects survive multi-chunk detached pastes until the frontend consumes them.

How to Test

  1. In a Herdr remote pane, run red clipboard. Expect Osc52 and herdr=true, including when SSH_CONNECTION and SSH_TTY are absent. Run red clipboard --test-copy, then paste into an application on the client machine and check the Unicode test token.
  2. Open a text file, yank a line with yy, and paste on the client. The exact line should arrive. Repeat with red --detach=clipboard-check; detach with Ctrl+Backslash and reattach with red --attach clipboard-check. Reconnect must not replay the earlier copy.
  3. Launch with -c 'clipboard.max_bytes=3', then yank a longer line. Expect a size error without changing the external clipboard; p must still paste the full line inside Red. With OSC 52, the terminal paste shortcut remains the route for external clipboard text.
  4. In a local desktop session, confirm red clipboard selects Native, then verify native copy and paste still work.

Validation: all-target/all-feature Clippy passes, 25 focused clipboard tests and all 30 detached mouse-selection tests pass, and all 5 detach tests pass with RUST_MIN_STACK=8388608. Four retained PTY smoke scenarios verify routing, exact Unicode OSC 52 output, oversized-copy register fallback, and detached copy/no reconnect replay. This verifies terminal output, not an actual desktop paste through the user's Herdr remote client.

The configured local registry lacks main's locked zip 9.0.4. Local checks used an isolated source copy with zip =9.0.3 and Wasmtime =48.0.5; neither pin is included in this PR. The updated lockfile uses published crate checksums and dependency metadata; cargo audit reports zero vulnerabilities and no warnings. CI passes against the exact updated dependency set on Linux, macOS, and Windows, including Clippy, runtime/plugin checks, performance, and the security audit. The detach suite's default-stack overflow also reproduces on unchanged main with the same compatibility dependencies.

Route buffer and agent copies through native, OSC 52, tmux or explicit command providers. Keep detached clipboard effects transient and request client reads only for paste actions. Add bounded delivery, diagnostics, documentation and regression coverage.

Validation: clippy, fmt, Linux/Windows compile checks, 3542 selected tests and live Ghostty/tmux paste checks. The excluded visual-block stack test also fails unchanged main.
@fcoury

fcoury commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T02:53:55.387483Z 23d9913 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23d9913a11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/headless/mod.rs Resolved
@fcoury
fcoury merged commit 9166ce8 into main Oct 22, 2026
20 checks passed
@fcoury
fcoury deleted the fcoury/clipboard-transports branch October 22, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants