Skip to content

fix(computer-use): preserve clipboard text on Windows, macOS and Linux - #3440

Merged
bobleer merged 2 commits into
GCWing:mainfrom
bobleer:bob/computer-use-clipboard
Oct 17, 2026
Merged

bobleer merged 2 commits into
GCWing:mainfrom
bobleer:bob/computer-use-clipboard

Conversation

@bobleer

@bobleer bobleer commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

ComputerUse already exposed clipboard_get and clipboard_set, but Windows passed writes through a line-oriented PowerShell pipeline, reads ignored the advertised max_output_bytes, and clipboard helpers could wait indefinitely. This change makes plain-text reads/writes preserve Unicode, empty strings, and LF/CRLF on Windows, macOS, and Linux.

  • Use an STA Windows Forms helper with raw UTF-8 IO, explicit AppKit string types on macOS, and the selected Linux display server's text clipboard (wl-clipboard for Wayland; xclip/xsel for X11).
  • Bound helper IO and cleanup; never retry a potentially completed write through another helper. Keep clipboard contents out of command arguments and diagnostics.
  • Honor max_output_bytes while retaining the old max_bytes alias and result fields. Require the control owner lease for reads and deny global clipboard access during window-only sharing.
  • Document the existing actions and Linux dependencies; add native round trips to the three-OS CI matrix, with isolated Xvfb and headless Sway seats on Linux.

Validation completed locally: Services Core 20 tests including real macOS AppKit round trips on a private named pasteboard; 59 focused Core tool tests; five control contract tests; 11 Desktop admission tests; full Desktop build; Windows and Linux service/test cross-checks; repository hygiene and GitHub configuration checks; shell syntax and diff checks.

Native CI evidence on the final commit: Windows system clipboard round trip passed (one test, zero ignored); macOS clipboard suite passed including the real named AppKit pasteboard (20 tests, zero ignored); isolated Linux X11 and Wayland round trips each passed (one test, zero ignored per display server). All 14 PR checks passed, including the three OS Rust jobs, three CLI jobs, frontend, Linux x64/ARM64 release validation, and the final Rust/CLI result. CI run.

Remote coverage: tool fixtures reject clipboard actions for SSH workspaces and headless hosts before native IO. Relay remote control, Peer Device Mode, and live Detached Dispatch were not exercised end to end. Clipboard operations remain on the executing desktop host; no controller-local fallback is introduced. No persisted shape is changed.

@bobleer
bobleer merged commit 4018eb9 into GCWing:main Oct 17, 2026
14 checks passed
@bobleer
bobleer deleted the bob/computer-use-clipboard branch October 18, 2026 09:44
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.

1 participant