Fix slow Cmd-V paste with mixed clipboard formats

Merged
AU
2mo ago
+55-7

Summary

Cmd-V could take the full paste worker path when ordinary clipboard text also advertised HTML or RTF. The lightweight worker now accepts usable plain text with rich-text representations, while image/file payloads and lossy or empty text continue to use the full fallback path.

Testing

  • CMUX_PASTE_HELPER=... CMUX_PASTE_PROVIDER=... python3 tests/test_plain_text_paste_worker.py — 12 tests passed on macOS 26.6.
  • The suite covers mixed HTML/RTF/RTFD fast-path delivery, lossy and empty text fallback, image/file delegation, generation changes, cancellation, and deadlines.
  • The exact pushed SHA is being compiled through the cmux fleet before runtime dogfood.

Demo Video

Not applicable: this is a terminal clipboard latency path; the executable provider harness supplies deterministic runtime evidence.

Checklist

  • Behavior changes have added or updated tests
  • No user-facing strings changed; localization audit not applicable
  • No socket methods changed
  • No docs or changelog update needed
  • Bot findings addressed: added RTFD coverage and fallback for no usable text

Summary by CodeRabbit

  • Bug Fixes
    • Clipboard content with HTML, RTF, or RTFD can be handled by other paste options when plain text is missing or appears lossy.
    • A missing text value no longer creates a plain-text clipboard flavor; empty text fields remain supported.
    • Improved handling of Unicode, short, and large text, including literal loss markers and text accompanied by rich formats.