Skip to content

fix(automation): pair widget-key's press with its release - #444

Open
phall1 wants to merge 2 commits into
vercel-labs:mainfrom
phall1:upstream/widget-key-release
Open

phall1 wants to merge 2 commits into
vercel-labs:mainfrom
phall1:upstream/widget-key-release

Conversation

@phall1

@phall1 phall1 commented Sep 19, 2026

Copy link
Copy Markdown

widget-key currently emits only key_down, so key-lifetime latches stay armed and a repeated chord does the work once.

This synthesizes the matching key_up (same key, modifiers, and timestamp; no text on release).

@vercel

vercel Bot commented Sep 19, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

phall and others added 2 commits September 19, 2026 20:01
`widget-key` dispatched a `key_down` and nothing else, so every
key-lifetime latch it armed stayed armed. Those latches exist because a
physical chord's release carries different modifier flags than its press
(Cmd is often already up by the time G comes back), so the
classification is latched on the view at the down and retired at the up
-- `consumeCanvasWidgetTabInputFocusEntry`,
`consumeCanvasWidgetTerminalPasteKeyLifetime`, and any app-level
shortcut latch built the same way. With no release ever arriving, the
SECOND drive of the same chord found the latch still held from the first
and was swallowed as the missing release: `widget-key canvas cmd+g`
twice in a row did the work once.

Fixed by synthesizing the release, not by adding an explicit release
action. Real hardware has no press without a release, so a harness able
to emit an unpaired one is a harness able to reach states no user can;
and pairing keeps every existing automation script's wire format AND its
meaning intact -- one `widget-key` line is still one keystroke. A new
release verb would instead have made correctness opt-in and left every
script written before it driving half a keystroke.

This is the discipline `widget-drag` (down/drag/up) and `widget-pinch`
(begin/change/end) already follow, down to sharing one timestamp across
the events because press and release are one gesture. The release
carries the chord's modifiers but never `text`: `key_up` is deliberately
barren in both text paths (`canvasWidgetTextEditEventFromGpuInput` and
the target-less commit fallback), so it cannot double-insert what the
press already typed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@phall1
phall1 force-pushed the upstream/widget-key-release branch from 74670ce to a1418ed Compare September 20, 2026 00:01
@phall1
phall1 marked this pull request as ready for review September 20, 2026 05:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant