Skip to content

[Bug]: A busy embedded frame delays copy keys (and, with #32801, clicks) in a streamed Browser tab #34186

Closed

Description

@Sean-R-Wilson

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

In a streamed (server-runtime) Browser tab, the server reads every frame's clipboard recorder before it dispatches a copy key, so a frame that is busy holds that key until it finishes.

  1. Open a page that embeds a frame running in its own process, for example a cross-origin iframe served with Origin-Agent-Cluster: ?1.
  2. Have the frame run a long task (3 seconds of synchronous JavaScript).
  3. During that task, press Cmd+C in the main frame. With fix(server): offer site-copied text to the controlling viewer #32801, a left click on the main frame waits the same way.

Expected behavior

Input to a responsive main frame reaches it straight away, whatever an embedded frame is doing.

Actual behavior

The input reaches the page only after the busy frame finishes. Measured in headless Chromium through Playwright 1.60, using the same Page.createIsolatedWorld and Runtime.evaluate read the server makes:

Order Main frame received the click after
Click sent straight away 13 ms
Click sent after reading the busy frame's recorder (as the server does) 2900 ms

Reading an idle frame takes about 1 ms. A plain cross-site iframe stays in the page's process in the headless shell, so its busy work stalls the whole page anyway. The extra wait only shows when the busy frame has its own process.

Code on main @ a0efdae:

#32801 adds the same pre-dispatch read on a clean left press, to clear the previous click's copy (ServerBrowser.ts L2575 on its head), so ordinary clicks wait too.

Impact

Minor bug or occasional failure

Version or commit

main @ a0efdae; #32801 @ 0fa45a3

Environment

Headless Chromium (Playwright 1.60 chrome-headless-shell), macOS 27.0.1. Found during review of #32801.

Notes for a fix

The obvious fixes each opened a new timing gap in the #32801 review, which is why it stayed out of that PR:

  • A timeout on the read: a late answer has already emptied the frame's buffer, so a real copy is lost.
  • Clearing in the background: it can race a page that copies on pointerdown.
  • Clearing only in the clicked frame: other frames keep stale text that a later click can offer.

A fix probably needs each recorded copy tied to the press or key that made it, so a slow read can be skipped without emptying anything.


Investigated with Claude Opus 5.5 (Claude Code in T3 Code).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions