Repository navigation
fix(serving): keys desktop Chrome leaves on the shell go back to the patch - #1412
Conversation
|
Review (GPT 6.1 Sol), at 40697a2: nothing blocking in the broker fix. What it checked in the guard:
It agreed that the race caught in CI's log justifies bringing this listener back, after #1302 dropped it. One should-fix, fixed in 659a5f4. The new broker test's comment now says what it proves: the keys come back. It doesn't reproduce the race itself; the CI log is the evidence for that. |
|
Review (GPT 6.1 Sol), rounds 2 to 5, on the guard after 659a5f4.
Round 5 also confirmed the rest, in Chromium:
Round 5's P2, dismissed. Firefox doesn't fire the shell window's
|
Acceptance: PASS with notesChecked The race fix holds, the hidden-selection case that failed at How I checked. I used the same throwaway probes as last time, kept outside the repo and never committed, in checkouts at Done means
CI.
Rollback answers: they match the diff. A revert removes three window listeners in Not run
Notes
|
…#1415) ## What changed A tier 1 test of the shortcuts sheet failed on CI now and then: "the sheet's row asks Patchy, waits past the reply deadline, then comes back on its row with the answer", in `test/browser-tier1/hotkeys.spec.ts`. It failed on #1412's `browser` job, which doesn't touch the sheet or its stand-in shell: ``` Expected: [{ "args": {}, "op": "shortcuts.setting" }] Received: [] > 1673 | expect((await stubbed(page)).asked).toEqual([{ op: "shortcuts.setting", args: {} }]); ``` The sheet asks over a `MessagePort`, so the stand-in shell records the ask when the message arrives. That can be after the sheet has hidden. The test read the stand-in's list once, straight after `toBeHidden()`. Now it polls the list until the ask is there. No issue was filed for it. It's a test-only fix. ## Look at **The change at `hotkeys.spec.ts:1673`.** The assertion is the same; it now waits for the message instead of racing it. ## How it was verified Locally, in the repo's config (headless shell), running only this test: ``` main, --repeat-each=20 --max-failures=0 3 failed, 17 passed (all three at line 1673) this branch, --repeat-each=20 --max-failures=0 20 passed ``` `oxlint` and `bun fmt --check` are clean on the file. CI runs the rest. Hit every surface: none apply. It's a test-only change. ## Release impact Tick exactly one. - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required. Test only. - **What does a revert leave behind?** Nothing; the test goes back to racing the message. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
…patch Co-Authored-By: Claude Opus 5.5 <[email protected]>
16fd923 to
3a7e93e
Compare
… its own process (#1302) ## What changed CI's browser tier ran Playwright's `chrome-headless-shell`, which keeps a patch's sandboxed frame in the shell's process. Desktop Chrome gives it its own process. That's how #1299 shipped: in desktop Chrome a patch didn't hear the keyboard until clicked, while CI was green. #1298 fixed #1299 on `main`. This PR moves the tier 1 suite's `chromium` project to desktop Chromium, so a focus or keyboard bug that only Chrome shows fails CI. It no longer holds anything back: every test in the suite runs in desktop Chromium. #1407's `firefox` project still runs `focus.spec.ts` alone. Closes #1299 ## Look at **`playwright.tier1.config.ts`.** The `chromium` project sets `channel: "chromium"`, the full build in new headless mode, and #1407's `firefox` project sits beside it unchanged. The headless-shell hold-out is gone. #1406 fixed the local-hotkeys test's accessibility helper, which couldn't read an out-of-process frame, and the test now passes in desktop Chromium. `pnpm test:browser` runs `chromium`, as on `main`, so `package.json` doesn't change. **What landed first.** In desktop Chromium on CI, `switcher.spec.ts` failed often (#1402). #1412 fixed that on `main`, with one real desktop-Chrome focus race fixed in the shell's broker and switcher tests that acted too early. One of #1412's tests, the tab switch in `switcher.spec.ts`, skips in the headless shell, which keeps every tab focused. It starts running on CI with this PR. **The frame really is out of process.** CDP's `Target.getTargets` lists it as its own `iframe` target in desktop Chromium, and not in the headless shell. ## How it was verified - **On CI at this head, `a92a7f1`:** the `browser` job passed twice in a row. Each time desktop Chromium passed 180 and Firefox 8, with none failed or skipped. The local-hotkeys test and the tab-switch test ran in desktop Chromium. - **Locally:** the local-hotkeys test passed 3 of 3 in desktop Chromium, and the Firefox project 8 of 8. - **Earlier heads, stacked on #1412 before it merged:** - Five passes in a row at its first head, and two or three at each later one. - One failure was the #1377 flake, since fixed on `main` by #1414. - One `test (bun)` failure was a `Fleet.test.ts` clock-step case, which passed on rerun. - The other failures were gaps in #1412's own fix, each fixed in #1412. - **CI cost.** No new download. `playwright install chromium` without `--only-shell` already puts both Chromium builds in Chromium's cache entry, and the action's comment says why it stays that way. - **Not checked:** headed Chrome on a real display. New headless is the same browser build and runs the frame out of process, as the target count shows. Hit every surface: - **Dev loop docs:** `docs/DEVELOPMENT.md` says the browser job runs desktop Chromium with `focus.spec.ts` also in Firefox, and that a script launching its own browser for a focus check passes the same channel. The CI job's and the Playwright action's comments say the same. - **Doesn't apply:** served pages, the wire contract, the CLI, vocabulary, migrations, company resources, reverse states and the repo layout. ## Release impact Tick exactly one. - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required. Test and CI configuration and doc lines; nothing ships. - **What does a revert leave behind?** Nothing. CI goes back to the headless shell. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
…ey shortcuts (#1421) ## What changed This adds release 42's What's new entry, written from `1cd6d12`. It covers everything merged since release 41's `through` (`a25a9c5`), and sets the `patchy` release to `0.42.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | New: Tell Patchy what it's missing | #1217, #1218, #1219, #1227, #1228 | | New: Turn off single-key shortcuts | #1276, #1279, #1301 | | Fixed: Typing reaches the patch again | #1407, #1412 | | Fixed: Dialogs in patches keep your place | #1420, #1255 | | Behind the scenes: plainer facts for agents building patches | #1249, #1256, #1297, #1418 | | Behind the scenes: Patchy stores teams and audiences ahead of teams | #1416 | | Patch changes: Mod+/ and `client.close()` in patchy/hotkeys; single-key shortcuts can be off; Tab wraps in plain modal dialogs | #1279, #1301, #1420 | #1376 is release 41's own entry. #1400, #1406, #1414, #1415, #1302, #1413 and #1419 are test, CI and dev tooling and need no line. The teams bridge (#1416) ships alone in this release so teams (#1417) can follow in the next one with a release to roll back to that reads its data closed. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. - **Rollback safety, from the live commit `7f93b91` (release 41) to this PR's merge.** No PR in the range is labelled `one-way`, and every Release impact answer says release 41 still works: - **#1217** adds migration `0037_feedback`, a schema release 41 never reads. **#1227** and **#1228** write into it. - **#1276** adds migration `0038_single_key_shortcuts`, a column with a default that release 41 never selects. - **#1416** adds migrations `0039_company_teams` to `0041_connection_audiences`, which hold tables that stay empty until teams ship, and widens one scope check. Its CI rehearsal ran `7f93b91 → head → 7f93b91 → head` on one set of data, and all four steps passed. - **#1279**, **#1301**, **#1255** and **#1420** change the SDK and the shell. Patches built on this release carry a `shortcutSetting` manifest field that release 41 reads without refusing, and its shell names no frame, so every shortcut stays on. - **#1218** and **#1219** add CLI commands and an optional `feedbackHint` in `--json` failures. A CLI from this release refuses to publish to an older instance before sending anything, as any mismatched release does. - Everything else is skill text, docs, tests and CI. If this release misbehaves, roll back to `7f93b91` (release 41). Written by Claude Opus 5.5 in Claude Code, through T3 Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
In desktop Chrome, where a patch's frame runs in its own process, the keyboard could land on Patchy's shell instead of the patch just after the patch opened. The patch showed a focused field, but typing went nowhere, and ⌘⇧K could open the switcher while keys still went to the patch. The shell now spots when its own page takes focus the person didn't ask for, while it holds nothing of its own, and gives the keys back to the frame. A press or selection on the shell's own content, such as a download card, keeps its focus.
The other switcher failures in #1402 were tests acting before the browser could keep up. They now wait for the real signal.
Closes #1402
Look at
The bug, in
packages/serving/src/broker.ts. A diagnostic run on #1302's branch logged every trusted focus, blur, press and switcher message in the shell and its frame. Of 405 switcher runs in desktop Chromium on CI, the grabby case failed once:When a frame's new document commits while the shell's page holds focus, Chromium gives the frame's process page focus without saying which frame has it. Blink resets that process's focus to the main frame and reports it back. If the broker's
frame.focus()onhelloreaches the browser first, that stale report wins. The shell's page takes focus while the frame is still itsactiveElement, and both sides then believe they're in sync:frame.focus()does nothing, because the frame already is the focused element.Keys then go to the shell while the patch shows a caret. In the other order they go to the frame while the shell thinks the menu has them, which is where the flip case lost its Enter.
In that state the shell's window takes focus while the shell holds nothing of its own. Its active element is still the frame, or the body once the frame has had the keys back this way before: that move clears the shell's focused element. The broker answers a task later with
frame.contentWindow.focus(), which moves focus into the frame for real. A move to shell UI, such as the switcher or the starting cover, has its own active element by then. A frame still waiting for its relay'shellois left alone, as before.It answers only focus the person didn't ask the shell for: the race, a tab or window coming back, an alert or devtools closing. A press on the shell's own content, such as dragging across a download card's file name, brings the shell focus within that press's own task. So a capturing
mousedownon anything but the frame element marks that task, and its focus stays. A press on the frame element is the misrouted one meant for the frame. A window that comes back to text the person selected in the shell keeps the keys too, as when they select a file's name and switch tabs. Two conditions limit that:blurnotes whether the frame was its active element, meaning the keys went into the patch, by a click or the shell's own hand-off. Once they have, a selection still showing in the shell holds nothing: the fourth version missed that, and every fall after a click back into the patch stayed on the shell. The race starts from the frame having the keys, so it still repairs.getSelection().toString()isn't empty). A selection left in content since hidden, such as a download card folded away under "1 more file", is still not collapsed but copies nothing. Counting it, as the third version did, turned the repair off for good.A click on blank shell space then behaves as on
main, with the keys staying on the shell.The new test is
keys that fall out of the frame onto the shell go back to the frame, and ⌘⇧K ↵ still flips. The frame's ownparent.focus()reproduces what the broker sees: keys on the shell's document while the frame is still its active element. It doesn't reproduce the full disagreement between processes, becauseparent.focus()blurs the frame normally. So the test proves the keyboard comes back; the CI log above, captured as it happened, is the evidence for the race itself. It falls out twice, since the second time the shell's body is active: the first version of this fix covered only the frame, and its test failed on #1302's CI after an earlier repair had cleared the shell's focused element.Two more tests use a patch that offers four files, so the shell shows three cards and folds the oldest away under "1 more file":
text selected in the shell's own content is what Copy copies, until the keys go back to the patchdrags across a card's file name and presses Copy. It then clicks back into the patch and makes the keys fall twice; the patch must hearxeach time.across a tab and back, the shell keeps the keys for text it shows selected, and only thatswitches tabs for real, with focus emulation off. Coming back to a visible selection, Copy still copies it. Coming back to a selection in the folded card, the patch hears the next key. The test selects that one by script, because folding the card over a selection by hand leaves it there only some of the time. Playwright's headless shell keeps every tab focused, so this test runs in desktop Chromium only.The falling-out test:
Clicking a frame before it is drawn, in
test/browser-tier1/drawn.ts. Desktop Chromium sends a press to the frame's process by what the shell last drew. So a click as soon as the frame shows in the DOM lands on the shell. A probe hides the frame withvisibilityorinert, then clicks the moment it is back:A person can't click a frame before it is drawn. The switcher specs now wait two animation frames before clicking into a frame they just showed. With the broker fix, such a press no longer strands the keys on the shell, but the field under it still never hears it.
The notice case was a test race. It recorded
/switcher.jsonahead of the notice's own navigation request. A signed-out notice loads no switcher, so that request came from the patch before it. That case, and the public-patch case, now wait for the patch's own list request to land before they watch.That wait,
listedAfter, counts only the destination page's own list. An init script notes what the tab held as each page began, before any of its own scripts run, and only a copy saved since counts. Reading the tab's copy before going instead, as this PR first did, let an ask the page before still had on its way satisfy the wait before the new page's switcher had asked. Reproduced with the page before's request held past that read and the destination's switcher script held 1.5 s:How #1402's five failures map:
blurnever ran/switcher.jsonrecordedanever typedHow it was verified
browserjob twice in a row on one head,e12a5fd: 176 passed each time, none failed or skipped, so the tab test ran there.browserjob, in the headless shell, failed once. The case washotkeys.spec.ts"the sheet's row asks Patchy, waits past the reply deadline…". Its stand-in shell loads no Patchy script, the same case also failed on that machine withmain's broker, and no issue tracks it yet. On its rerun: 175 passed, and the tab test skipped as designed.shell.spec.tsfailure, the known flaky: shell dialog focus case presses Escape before the dialog script listens #1377 flake. That test serves its own pages with no patch frame.test (bun)failure inpackages/execution/src/Fleet.test.ts, a clock-step case that passed on its rerun. Its selection guard held the keys after a click back into the patch, which Sol's review caught and theblurnote fixes.--repeat-each=3: desktop Chromium 108 of 108; headless shell 105 passed, with the tab test's 3 skipped.openOfferingnow waits for a drawn frame before any press on them, as the other specs do before clicking into a frame they just showed.hotkeys.spec.ts"the sheet's row asks Patchy…" failed 9 of 10 in the headless shell withmain's broker. Its stand-in shell loads no Patchy script, it passed in a later full run there, andmain's CI passes it. It's flaky on that machine, unrelated to this PR.pnpm typecheck, test typecheck andpnpm lintpass at this head.pnpm checkat the first head: format, lint, typecheck and synth passed. The offline tests' only failures werepackages/sdk/src/install.test.ts, where that machine's test environment has nonpmon PATH; this PR doesn't touch that package.Hit every surface: only the shell's broker script changed, so served pages; no HTML or CSS changed. The wire contract, CLI, dev loop, vocabulary, migrations, company resources, reverse states and repo layout don't apply.
Release impact
Tick exactly one.
Breaking — requires action from anyone already running this
Not breaking — no action required. One listener in the shell's broker, and tests.
What does a revert leave behind? Nothing. The shell goes back to leaving those keys where Chrome put them.
Does the release before it still work with that? Yes.
Built by Claude Opus 5.5 (
claude-opus-5-5) in Claude Code, through T3 Code.