Skip to content

Linux engine: a failed clipboard read after a delivered paste can delete a Chrome textarea's selection #260

Open

Description

@SSFSKIM

Problem & intent

On cua's own Linux engine (#171), type_text and paste into a Chrome textarea that holds a selection deliver the paste chord, then serve Chrome's CLIPBOARD request. If that read fails after the chord was delivered, Chromium treats the failure as empty text and Blink deletes the selection. cua then answers unconfirmed, which is honest, but the person's selected text is gone and the answer does not say so. The read can fail in three ways:

  • Late request. The request comes after the paste's cleanup has run. cua refuses it under the late-generation rule (clipboard/owner.rs).
  • Timeout. The read times out.
  • Stalled INCR. An INCR transfer stalls.

The mechanism was read from cua's code and from upstream sources. It was not probed live:

  • Chromium. ClipboardOzone::ReadText maps a failed read to ''.
  • Blink. ReplaceSelectionCommand deletes the selection for an empty fragment.
  • cua. cua itself never deletes text: there is no DeleteText or CutText anywhere in the engine, and every pre-dispatch refusal sends nothing.
  • The other targets are safe on a failed read:
    • GTK 3: clipboard_text_received deletes only on non-NULL text.
    • GTK 4: paste_clipboard_finish needs a successful read.
    • Gecko: InsertTextFromTransferable needs non-empty text.
    • Chrome's address bar: OnOmniboxPasteComplete rejects empty text.
    • VTE: has no editable selection.

Never observed. Every Chrome paste in the M3 gate was confirmed, and M2's failure trials had no selection.

Intent: a cua paste must never cost the person their selected text. Where cua cannot prevent that, its answer must say the selection may be gone.

Seams: the Linux engine's paste and clipboard owner (clipboard/owner.rs, the late-generation rule), and the answer text of type_text and paste.

Constraints

  • Preserve M2's cross-delivery rule: a late requestor is not served cua's text unless the design shows it is the paste's own requestor and no other paste can be.
  • Preserve the stage answers. Diagnostics stay value-free and never record the person's text or clipboard.
  • Live proof runs on the Linux VM's harness scenes, never on the person's apps.
  • Spawned by Independence 4b: cua's own Linux native engine (replace sky_linux), after #117's macOS engine #171 (M3 branch review question). Parent N/A; blocked-by N/A.

Success criteria

  1. A probe, first. A Chrome textarea with a selection. The paste chord delivered. Chrome's conversion refused, or its INCR stalled, without an owner change. Then, after Chromium's read timeout, read back the text and the selection. Result: whether the selection is deleted.
  2. If it is:
    • (a) The unconfirmed answer states that the selection may have been deleted, whenever cua knows the read failed after delivery (a refused late conversion, a timeout, a stalled INCR).
    • (b) A design that prevents the loss, weighed against the cross-delivery rule. Candidates: serve the paste's own late requestor, identified by its window and the request's timing. Or hold the selection's restore text and re-insert it on a known failure. Each comes with its cost.
  3. If it is not: a Decision Log line that closes this ticket with the probe's evidence.
  4. The same probe against the vendor's Linux build in Chrome, recorded as a finding.

Open questions

Can the paste's own late requestor be told apart from a later paste reliably enough to serve it?

Decision log

Sources

Activity

  1. added
    bug
    status:ready-for-architect
    priority:P2
    on Nov 1, 2026
  2. added a commit that references this issue on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:P2status:ready-for-architect

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions