Repository navigation
fix(app): keys typed after Cmd-N then Ctrl-` reach the new terminal, not the New Tab page (P0) - #30827
Conversation
…he new terminal, not the New Tab page Judged smoke of dogfood v2.2.13-opt, round 2 step 16 (#30271): after Cmd-N, Ctrl-` and a typed line, the keys went to the New Tab page. CmdNThenCreateKeysTests types "echo held\r" through the app's dispatch (KeyRouter.interceptKeyDown, then the window) right after Cmd-N and Ctrl-` (and Cmd-D), with the daemon stopped, and passes only when the new terminal's screen shows the line and the shell's answer, and no other terminal shows it. PasswordManagerRouteTests.withApp takes a heldKeyReplay (a test window is never key). Red expected on feat-cmux-next: the keys wait in Cmd-N's New Tab hold.
…s: Cmd-N then Ctrl-` types into the new terminal Judged smoke of dogfood v2.2.13-opt, round 2 step 16 (#30271): after Cmd-N, Ctrl-` and a typed line, the line went to the New Tab page. Cmd-N opens the window's New Tab hold (NewTabInputCoordinator.beginIncoming): every key waits for the new page's field. The Ctrl-` (or Cmd-D, New Column, a browser tab) that followed opened its creation hold, but the New Tab hold runs first in KeyRouter.interceptKeyDown and nothing ended it (its chord release only fires with keys already held), so every later key still waited for the page and went to its field when it was ready. One seam for every creation that moves a window's focus: CreationInputCoordinator.begin ends that window's New Tab hold once its own hold is open (NewTabInputCoordinator.creationTookKeys, the same window lookup capture uses). The keys the New Tab hold kept run again through the key router in typing order, so they go into the creation's hold first and reach the new terminal. A script's creation (no view change allowed) opens no hold and ends none. isHolding is the same check on one line (offsets the App lines).
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
red: cmux-next checks (god files, concurrency, crash safety, l10n); no finished base run on e96e37a to compare; do not merge until green; see lane-rules Shipped in:
|
There was a problem hiding this comment.
No issues found across 4 files
You’re at about 90% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
|
Review (claude-opus-5-5 review subagent): SHIP at 6bf54eb Note: the review request named head 6bf54ebb40364b1c2e30d10a541a5ff02c2c5bd3. The real PR head is 6bf54eb (from git rev-parse and gh). Both jobs ran at the real head. Findings (correctness first, all from reading the code):
|
|
Found 6 test failures on Blacksmith runners: Failures
|
…the base loses them as a person's does Red 808acd14b268c72028550d5a at 9856f7f PASSED: the test's New Tab page never reports its field ready, so on the base the page's incoming hold reached its 4 s bound and handed the keys on to the new terminal. A person's page reports ready and takes them (smoke step 16). The test sets incomingHoldLimit to 120 s, so the page's hold keeps its keys while the page opens, as it does for a person until their page is ready. The pass condition is unchanged: the new terminal's screen shows the typed line and its answer within 15 s.
…minal's keys in the creation hold, as feat does Green 3f0893af4165fda1bde2f4ad at 673b6bf (with #30827's fix): the 10 keys typed after Cmd-N then Ctrl-` now left the New Tab hold, but went to the Ctrl-` stand-in terminal's view ("to TerminalSurfaceView"), and the new terminal's screen stayed "sh-3.2$". On this line (107f5da, 050651b) the creation hold gives a new terminal's keys to its early view, which sends them to the daemon by the terminal id its create minted. With #29530 a create on a stand-in pane (Cmd-N's first pane, a split in flight) waits for the daemon's pane before it is sent, so the daemon does not know that id yet when the keys come. feat-cmux-next never gives the optimistic Ctrl-` an early tab: its keys wait in the creation hold for the daemon's terminal. DaemonService.queuesCreatingInput(on:) answers false for a stand-in target (ProvisionalPane.isStandIn); Ctrl-` and Cmd-D use it for their early tab, so those keys wait in the hold and run again once focus landed on the daemon's terminal. New Column and New Row are unchanged (not covered by a test here). Test seam (only this part of feat's HeldKeyReplay, #28436): CreationInputCoordinator.replay, NSApp.sendEvent by default; the tests set their window's. Tests: the ported #29530 key test and #30827's CmdNThenCreateKeysTests (Ctrl-` and Cmd-D) set it and keep Cmd-N's page hold open as a person's page does; the pass condition is the new terminal's screen text.
|
Review (opus-5.5 second-pass key-routing reviewer): SHIP at 3cfc05a Scope: whole diff 914e25d..3cfc05a, read with KeyRouter.interceptKeyDown, NewTabInputCoordinator (all its lookups), CreationInputCoordinator and every Root cause: correct. Fix: correct. The Test commit 3cfc05a ( Non-blocking notes (follow-ups, not holds):
|
… it is not needed Probe 7ec3a8abe34e5cbc20966aae at 66e36b7 (this branch without that rule, with the Ghostty runtime started in the test harness) passed all five key tests: CmdNThenCreateKeysTests 2/2 (Ctrl-` and Cmd-D after Cmd-N: the typed line shows in the new terminal, no other terminal shows it) and CmdNThenNewTerminalTabTests 3/3. The failures that led to the rule (3f0893af, 37f96e2b) came from the harness, whose terminal views had no Ghostty surface. So this line keeps its own early-key path (107f5da, 050651b) unchanged: queuesCreatingInput(on:) and ProvisionalPane.isStandIn go. The test replay seam CreationInputCoordinator.replay stays (the default is NSApp.sendEvent, as before).
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Summary
and a typed line, the line's keys went to the New Tab page (a Chromium page window), not the new terminal. Found while porting #29530 to the dogfood line (#30271): its end-result test shows the new terminal's screen empty (sh-3.2$`) and all 10 keys "consumed" by the key router, none held by the creation hold.NewTabInputCoordinator.beginIncoming), so every key waits for the new page's field. The Ctrl-(or Cmd-D, New Column, New Row, a browser tab) pressed then opens its creation hold, but the New Tab hold runs first inKeyRouter.interceptKeyDown, and nothing ended it (its chord release fires only when it already holds keys). So the keys typed after the Ctrl-waited for the page and went to its field.CreationInputCoordinator.beginends that window's New Tab hold once its own hold is open (NewTabInputCoordinator.creationTookKeys, the same window lookupcaptureuses). The keys that hold kept run again through the key router in typing order, so they go into the creation's hold first. A script's creation (no view change allowed) opens no hold and ends none. No App line growth.Testing
CmdNThenCreateKeysTests(9856f7f): Cmd-N with the daemon stopped, then Ctrl-(and Cmd-D), then "echo held" Return, each key through the app's dispatch (interceptKeyDown, then the window; held keys replay the same way). Pass only when the new terminal's screen shows the line and the shell's answerheld`, and no other terminal shows it.incomingHoldLimitto 120 s, so the page hold keeps its keys while the page opens, as a person's does until their page is ready.CmdNThenCreateKeysTestsat 13df94d (the head with the fix 6bf54eb reverted; run as rolebase, display, CMUX_TEST_REQUIRE_GUI=1): 6577bde00daddb56b5f50bb0 FAILED both tests at CmdNThenCreateKeysTests.swift:98: the new terminal's screen issh-3.2$, and all 10 keys were consumed with "New Tab hold true".and Cmd-D: the typed line andheld` show in the new terminal, and no other terminal shows the line), CmdNThenNewTerminalTabTests 3/3, gui-session-v1 console line present.fix/p0-ctrlbt-keys-feat-probe, 33bbdc9, never merge): 84e76d4a69e34c0788d6bd68 FAILED: screensh-3.2$, 10/10 keys consumed with "new-tab hold true". The bug is on feat. fix(app): Ctrl-` right after Cmd-N opens its terminal; a create on a pane still opening waits for it (P0 STATUS 2080) #29530's own 3 tests pass on that tip because they do not go through the router.Observed / Not run
sh-3.2$, 10 of 10 keys consumed by the router, creation hold count 0).from a Home field) go through the sameCreationInputCoordinator.begin` seam and were checked by reading only.Changelog
No capture: key routing fix; evidence is the display-worker end-result test.
perf claim: none.