Skip to content

fix(cli): /copy falls back to native clipboard on OSC 52-blind terminals#15856

Open
cola-runner wants to merge 2 commits into
NousResearch:mainfrom
cola-runner:codex/fix-15664-copy-native-clipboard-fallback
Open

fix(cli): /copy falls back to native clipboard on OSC 52-blind terminals#15856
cola-runner wants to merge 2 commits into
NousResearch:mainfrom
cola-runner:codex/fix-15664-copy-native-clipboard-fallback

Conversation

@cola-runner

Copy link
Copy Markdown
Contributor

Summary

  • macOS Terminal.app silently swallows OSC 52, so `/copy` reported success while the host clipboard never changed (/copy command does not work on macOS Terminal.app (OSC 52 not supported) #15664).
  • Add `_write_native_clipboard()` that runs alongside the existing OSC 52 write, picking the right helper per platform: `pbcopy` (macOS), `wl-copy`/`xclip`/`xsel` (Linux), `clip` (Windows).
  • The command now reports success when either OSC 52 or the native helper lands, so SSH/tmux scenarios still work and Terminal.app users finally get a real copy.

Test plan

  • `pytest tests/cli/test_cli_copy_command.py` — 11 passed
    • 4 existing tests updated to patch both clipboard writers
    • 5 new tests for `_write_native_clipboard` per platform
    • 2 new tests for the success/failure logic (success when only native works; failure only when both fail)

Closes #15664

🤖 Generated with Claude Code

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 26, 2026
cola-runner and others added 2 commits April 29, 2026 18:48
macOS Terminal.app does not honour OSC 52, so /copy looked successful
to the user but the host clipboard never changed (NousResearch#15664).  Add a
best-effort native fallback (pbcopy / wl-copy / xclip / xsel / clip)
that runs alongside the OSC 52 write — the operation now reports
success when either path lands, keeping the existing SSH/tmux story
working while finally fixing the local-Terminal.app case.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cola-runner cola-runner force-pushed the codex/fix-15664-copy-native-clipboard-fallback branch from f3f5de3 to a027e28 Compare April 29, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/copy command does not work on macOS Terminal.app (OSC 52 not supported)

2 participants