GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tui: all pastes hang after one clipboard read timeout (Linux/Wayland) · Issue #50847 · anomalyco/opencode

tui: all pastes hang after one clipboard read timeout (Linux/Wayland) #50847

New issue
Copy link
New issue
Copy link
Closed as not planned
#60385
Closed as not planned
tui: all pastes hang after one clipboard read timeout (Linux/Wayland)#50847
#60385
Copy link
Assignees
simonklee

Description

@abran-labs
abran-labs
opened on Sep 23, 2026
Issue body actions

Summary

After a single TUI clipboard read hits the 1s timeout ("Clipboard read timed out"), every later paste in that OpenCode instance hangs forever. No attachment, no text, no error. Only restarting OpenCode fixes it.

Environment

  • opencode 2.0.14
  • Arch Linux, Hyprland 0.56 (Wayland), foot 1.28
  • Paste goes through the OpenTUI native host clipboard (Wayland data-control), timeoutMs default 1000, preferredTypes ["image/png","text/plain"]

Repro

  1. wl-copy --type image/png < screenshot.png
  2. In a shell loop, wl-copy a slightly different PNG every ~1.3s, so the clipboard owner keeps changing
  3. In opencode, press Ctrl+V repeatedly
  4. Eventually one paste shows "Clipboard read timed out"
  5. Stop the loop and copy plain text. Every Ctrl+V after that hangs: 20 out of 20 attempts hung, waiting 15s each

Expected

A timed-out read fails once. Later pastes work normally.

Actual

All later pastes (prompt.paste / bracketed paste with an empty body) hang forever until OpenCode restarts. wl-paste in another shell returns instantly the whole time, so the system clipboard itself is fine.

Suspected cause

The native clipboard operation that timed out is never settled or cancelled, or a concurrency slot or pending-op flag leaks. Every later read then queues behind it or waits on it forever. The timeout path should cancel or release the in-flight Wayland data-control read and reset the service state.

Workaround

Paste the image file path instead; the TUI attaches image paths.

Not the same as #42162 (wl-copy left in the process group after Ctrl-Z).

Activity

  1. github-actions
    assigned
    kommander
    on Sep 23, 2026
  2. simonklee
    assigned
    simonklee
    and unassigned
    kommander
    on Sep 25, 2026
  3. opencodejr commented on Oct 28, 2026

    @opencodejr
    opencodejrBot
    on Oct 28, 2026
    Contributor
    More actions

    Thanks for the detailed report. I tried to reproduce this on 2.0.14 in a headless sway (wlroots data-control) session with wl-clipboard, but couldn't get pastes to hang:

    • Owner that never answers: I froze a wl-copy --type image/png owner with SIGSTOP and pressed Ctrl+V. I got the same "Clipboard read timed out" toast. After copying plain text, the next Ctrl+V pastes worked every time, both when the frozen owner was killed and when it stayed alive with its pipe open while a new owner took over.
    • Your recipe: I wl-copy'd a different PNG every ~1.3s and pressed Ctrl+V 60 times. Every press attached an image and none timed out. After stopping the loop and copying text, 3/3 pastes worked.
    • Stress: 12 MB PNGs with the clipboard owner changing every 0.1–0.9s gave no timeouts, and later text pastes worked.

    So here the timeout itself recovers. Your hang may need a timing I didn't hit, or it may be specific to Hyprland or foot. These would help:

    1. Does it still happen on the latest release (opencode upgrade)? The bundled OpenTUI clipboard library has been updated since 2.0.14.
    2. The OpenCode log from a session where it happens, covering the timed-out paste and a few hung ones after it. Logs are in ~/.local/share/opencode/log/; running with OPENCODE_LOG_LEVEL=DEBUG adds more detail.
    3. While pastes are hanging, the output of ls -l /proc/$(pgrep -n -f opencode)/fd | grep pipe, and whether any wl-copy processes from your loop are still running (pgrep -a wl-copy).
    4. Whether it also happens in another terminal (e.g. kitty or alacritty) or another compositor, if that's easy to try.

    The only related issue I know of is #42162, which you've already ruled out (it's about wl-copy left in the process group after Ctrl-Z).

  4. abran-labs commented on Oct 29, 2026

    @abran-labs
    abran-labs
    on Oct 29, 2026 via email
    Author
    More actions
    Thanks for digging into this. I found why you couldn't reproduce it: the trigger was on my side. I run a custom Wayland <-> X11 clipboard bridge (a `wl-paste --watch` handler). That handler never drained the selection piped to its stdin, so on every image copy the first `image/png` reader stalled for ~3.16 s until the bridge's own 3 s timeout expired. I measured it with plain `timeout 5 wl-paste --type image/png` right after `wl-copy`: 12 of 14 reads took ~3.16 s, consistently across two runs. With the bridge stopped, reads took 7-9 ms. After fixing the handler (drain stdin, no kill/respawn of the owner), reads are 2-13 ms, including an 8-copy burst. This is on Hyprland 0.56.2, wl-clipboard 2.3.0, foot 1.28.0, OpenCode 2.2.0. So a ~3 s stall from a misbehaving clipboard owner is what fed OpenCode's ~1 s read timeout. That part is my setup and is fixed. The part that still seems worth keeping open is the recovery: per my original report, once a single read times out, every later paste in that OpenCode instance hangs until restart. A slow or broken clipboard owner on someone's system shouldn't wedge pasting for the rest of the session; ideally a timed-out read gets cleaned up and the next paste starts fresh. I haven't re-tested that on 2.2.0 now that my stall is gone, so if you'd rather close this as environment-specific, that's fair too. Repro tip if you want to test recovery: make a `wl-paste --watch` handler that ignores its stdin and sleeps ~3 s, copy a few MB PNG, then paste in OpenCode immediately, then try pasting text afterwards.
    …
    On Wed, Oct 28, 2026 at 12:18 AM opencodejr[bot] ***@***.***> wrote: *opencodejr[bot]* left a comment (anomalyco/opencode#50847) <#50847 (comment)> Thanks for the detailed report. I tried to reproduce this on *2.0.14* in a headless sway (wlroots data-control) session with wl-clipboard, but couldn't get pastes to hang: - *Owner that never answers:* I froze a wl-copy --type image/png owner with SIGSTOP and pressed Ctrl+V. I got the same *"Clipboard read timed out"* toast. After copying plain text, the next Ctrl+V pastes worked every time, both when the frozen owner was killed and when it stayed alive with its pipe open while a new owner took over. - *Your recipe:* I wl-copy'd a different PNG every ~1.3s and pressed Ctrl+V 60 times. Every press attached an image and none timed out. After stopping the loop and copying text, 3/3 pastes worked. - *Stress:* 12 MB PNGs with the clipboard owner changing every 0.1–0.9s gave no timeouts, and later text pastes worked. So here the timeout itself recovers. Your hang may need a timing I didn't hit, or it may be specific to Hyprland or foot. These would help: 1. Does it still happen on the latest release (opencode upgrade)? The bundled OpenTUI clipboard library has been updated since 2.0.14. 2. The OpenCode log from a session where it happens, covering the timed-out paste and a few hung ones after it. Logs are in ~/.local/share/opencode/log/; running with OPENCODE_LOG_LEVEL=DEBUG adds more detail. 3. While pastes are hanging, the output of ls -l /proc/$(pgrep -n -f opencode)/fd | grep pipe, and whether any wl-copy processes from your loop are still running (pgrep -a wl-copy). 4. Whether it also happens in another terminal (e.g. kitty or alacritty) or another compositor, if that's easy to try. The only related issue I know of is #42162 <#42162>, which you've already ruled out (it's about wl-copy left in the process group after Ctrl-Z). — Reply to this email directly, view it on GitHub <#50847?email_source=notifications&email_token=BR33TIR44ZFK3UAPQKUFJQD5WGMSTA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNBWGMYTANJTG4YKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-6463105370>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BR33TISVFLDIUTDV7Y4V6XT5WGMSTAVCNFSNUABFKJSXA33TNF2G64TZHM4TONJXGM2DGMJZHNEXG43VMU5TKNJUHE3DAOJYGMZ2C5QC> . You are receiving this because you authored the thread.Message ID: ***@***.***>
  5. simonklee
    closed this as completedin #60385on Oct 30, 2026
  6. opencodejr commented on Oct 31, 2026

    @opencodejr
    opencodejrBot
    on Oct 31, 2026
    Contributor
    More actions

    Closing this for now, since we haven't heard back. When I tried this on 2.0.14 with a Wayland data-control setup, I could trigger "Clipboard read timed out", but pastes after it kept working. Without more details from your setup there isn't enough to go on.

    If it still happens, especially on the latest release, please reply here or open a new issue. These would help:

    • The OpenCode log from a session where pastes hang (~/.local/share/opencode/log/).
    • The open pipes (ls -l /proc/<pid>/fd) and any leftover wl-copy processes while pastes are hanging.
    • Whether it also happens in another terminal or compositor.

    Thanks again for the detailed report.

  7. opencodejr
    closed this as not plannedon Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @simonklee
    simonklee

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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.