Skip to content

fix: keep wayland clipboard copies responsive - #3015

Open
akbash-bot wants to merge 1 commit into
masterfrom
akbash/3014-wayland-clipboard-freeze
Open

fix: keep wayland clipboard copies responsive#3015
akbash-bot wants to merge 1 commit into
masterfrom
akbash/3014-wayland-clipboard-freeze

Conversation

@akbash-bot

Copy link
Copy Markdown
Collaborator

Issue

On Wayland, double-clicking a token can freeze Herdr while wl-copy keeps serving the clipboard selection. Existing and newly attached clients then stop responding.

Problem

Herdr waited for wl-copy to exit after sending the copied text. A clipboard owner can stay alive until another application replaces the selection, so that wait blocked Herdr's control path.

How did we fix it?

Herdr now returns after handing the text to wl-copy and reaps the clipboard owner on a dedicated thread when it eventually exits. Other Linux clipboard helpers still wait for and report their exit status as before.

Verification

The regression test blocked before the fix while a fake wl-copy remained alive. It now verifies immediate return, exact arguments and text, and eventual child reaping. Focused tests, formatting, and clippy pass. The full suite passed 3,487 of 3,488 tests; live_server_holds_one_pty_master_fd_per_pane still fails because its replacement server does not appear, and the same failure reproduces with this change removed.

refs #3014

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ad2bbf87-61ed-4f30-91f2-9dc583973bb9

📥 Commits

Reviewing files that changed from the base of the PR and between ffc4e26 and 96d0530.

📒 Files selected for processing (2)
  • docs/next/CHANGELOG.md
  • src/platform/linux.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Wayland clipboard writes now return after wl-copy receives data. A background reaper waits for the clipboard owner and logs failures. Tests cover long-lived and finite clipboard commands. The changelog records the fix.

Changes

Wayland clipboard handling

Layer / File(s) Summary
Nonblocking clipboard process lifecycle
src/platform/linux.rs
run_clipboard_command detaches long-lived wl-copy processes to a reaper thread. It retains synchronous status handling for finite commands and reaps children when thread startup fails.
Clipboard behavior validation and changelog
src/platform/linux.rs, docs/next/CHANGELOG.md
Tests verify return timing, payload, arguments, cleanup, and exit-status results. The changelog adds the unreleased Wayland clipboard fix.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Merge Risk: ⚪ Minimal · up to 96d05

This localized Wayland clipboard responsiveness change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant run_clipboard_command
  participant wl-copy
  participant clipboard_reaper_thread
  run_clipboard_command->>wl-copy: Start process and send clipboard data
  wl-copy-->>run_clipboard_command: Receive data
  run_clipboard_command-->>run_clipboard_command: Return success without waiting
  clipboard_reaper_thread->>wl-copy: Wait for process exit
  clipboard_reaper_thread->>clipboard_reaper_thread: Log exit failure if present
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: keeping Wayland clipboard copies responsive.
Description check ✅ Passed The description directly explains the Wayland clipboard freeze, the nonblocking fix, testing, and the unrelated full-suite failure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch akbash/3014-wayland-clipboard-freeze

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Trigger automated AI reviews for pull requests admitted by the PR gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants