Skip to content

TUI silently drops pasted input during startup capability queries (tmux) #42915

Closed as not planned

Description

@jonaqiprojections-PixC

Describe the bug

Pasting text into the TUI prompt input is silently dropped if the paste arrives while the TUI is still running its startup terminal-capability queries (OSC 4/10/11 palette, XTVERSION, XTGETTCAP, DECRPM, CPR). The paste never appears in the input box, with no error or notification. This makes "paste right after starting opencode" (e.g. an API key, an initial prompt) fail reliably in tmux.

Reproduction (deterministic)

Environment: opencode 1.18.18, Linux VPS over SSH, tmux 3.4, TERM=xterm-256color.

  1. Start a tmux session and launch opencode in a pane.
  2. Within the first ~10 seconds (while the pane is still doing capability queries), run:
    tmux set-buffer "hello" && tmux paste-buffer -p
    
  3. Observe: the text never appears in the input box.

Timing matrix measured with fresh sessions (paste-buffer -p then tmux capture-pane):

paste at result
t=3s dropped
t=5s dropped
t=7s dropped
t=9s dropped
t=10s dropped
t=12s pasted
t=14s pasted

Bracketed paste sent from the "outer" terminal through tmux in steady state works fine; only the startup window drops input.

Root cause (from the bundled source in 1.18.18)

During startup the terminal query session (packages/tui SZ class, detectOSCSupport/queryPalette/querySpecialColors + waitForXtVersion) subscribes to stdin data and consumes everything that arrives while queries are pending:

subscribeInput($) {
  if (this.oscSource) return this.oscSource.subscribeOsc((Z) => { $(Z) })
  return this.stdin.on("data", $), () => { ... }
}

Any bytes that are not OSC replies (i.e. ordinary typed/pasted input) are read by the query listener and discarded. In tmux, which does not answer the OSC color queries, this window lasts ~10-11s. On a real terminal over SSH it is shorter but still nonzero, and any paste in that window is lost silently.

Expected behavior

Input arriving during startup should be buffered and applied once the TUI is ready (or at least not silently eaten) - the same way the app buffers its own output until the renderer attaches.

OpenCode version

1.18.18 (also affects earlier versions - the query-session stdin subscription predates it)

Environment

  • OS: Linux (Ubuntu 24.04) VPS, accessed over SSH
  • Terminal: tmux 3.4 inside xterm-256color
  • Multiplexer: tmux 3.4

Activity

  1. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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