Skip to content

Clipboard paste can run after its caller was told timeout (Deadline.race timer vs Date.now) #144

Open

Description

@SSFSKIM

Found while making cua's timing tests event-driven for CI (PR #143).

Deadline.race rejects when its setTimeout timer fires, but the queued operation then decides by checking Date.now() >= at. On a busy event loop the timer can fire before the wall clock reaches at. If the clipboard lock is released in that window, the queued paste still runs, even though its caller was already told "timeout". A fill that reported a timeout can therefore still paste.

  • Seen once on an unloaded hosted macOS gate, in the "a fill's paste has the caller's budget" test, before that test moved to a controlled clock (3d3ebe3).
  • Where the fix belongs: src/browser-service/budgets.mjs or paste.mjs. For example, once the race has rejected, the operation re-checks against the timer's own end (or a settled flag) rather than Date.now().
  • With the paste's in-queue deadline.check() removed, the fill-paste test fails, so that test pins the check. It cannot pin the timer/clock skew.

Details: the M2 report in the ci-kit execution (task-2-report.md, Discoveries).

Activity

  1. added
    status:ready-for-architect
    on Nov 1, 2026
  2. SSFSKIM commented on Nov 1, 2026

    @SSFSKIM
    OwnerAuthor

    [board] ready-for-architect: Board repair: filed outside the board scripts with no status label; placed in the design backlog for triage

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

    status:ready-for-architect

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions