Skip to content

Clipboard copy fails in tmux when allow-passthrough is off #25253

Closed as not planned

Description

@rich-jojo

Summary

OpenCode's TUI clipboard helper always wraps OSC 52 in the tmux DCS passthrough envelope whenever TMUX or STY is present:

const passthrough = process.env[\"TMUX\"] || process.env[\"STY\"]
const sequence = passthrough ? `\x1bPtmux;\x1b${osc52}\x1b\\` : osc52

That breaks copy actions in tmux sessions where allow-passthrough off is required. In that topology, tmux's DCS passthrough is intentionally blocked, so OpenCode copy surfaces no longer reach the client clipboard.

Reproduction

  1. Start a tmux session on a Linux host over SSH.
  2. Keep set -g set-clipboard on and set -g allow-passthrough off in tmux.
  3. Run opencode inside tmux.
  4. Try any clipboard action such as:
    • copying a selected message
    • right-click selection copy
    • Copy session transcript
    • any other Clipboard.copy(...) path

Observed

Clipboard actions do not update the local terminal clipboard.

Expected

OpenCode should support a non-passthrough clipboard mode for tmux sessions where allow-passthrough is off, for example:

  • a raw OSC 52 mode / env override, or
  • tmux-aware fallback behavior that does not require DCS passthrough.

Why this matters

allow-passthrough off is a legitimate tmux hardening/workaround state. If OpenCode assumes tmux passthrough is always available whenever TMUX exists, clipboard support silently regresses in exactly the environments where tmux users need a safer topology.

Traceability

  • Tools used: OpenCode

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on May 1, 2026
  2. github-actions commented on May 1, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please consider closing one of the duplicates and consolidating the discussion.

  3. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on May 3, 2026
  4. sebastien commented on May 7, 2026

    @sebastien

    FYI OpenCode crashes Ghostty when used in tmux with passthrough ghostty-org/ghostty#12551 -- had to disable it, but now I've lost copy/paste.

  5. github-actions commented on Jul 8, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions