Repository navigation
fix(terminal): keep a brand-new remote pane's typing for the terminal it creates - #33859
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
34d2c4a4-0e4e-4e31-9c53-ef6d4f2b5b7c
Files selected for processing: 6-
src/renderer/src/components/terminal-pane/pty-connection-preconnect-input.test.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-transport-options.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport-reattach-type-ahead.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-recovery-input-hold.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
-
| !options.sessionId && isFirstConnect && opts.keepTypeAheadForNewTerminal === true | ||
| isFirstConnect = false | ||
| const expected = newTerminal | ||
| ? recoveryInputHold.expectNewTerminal() |
There was a problem hiding this comment.
Keep new-terminal input held until the expectation settles.
If the subscription becomes ready before connectPane() returns, subscribeToHandle() calls releaseHeldInput() while this expectation still has a null endpoint. RemoteRuntimeRecoveryInputHold.release() in src/renderer/src/components/terminal-pane/remote-runtime-recovery-input-hold.ts Lines 170-180 discards the typing and replaces it with an empty hold. The successful create then binds only that empty hold. Defer release until settlement assigns the created endpoint. Test a subscribed response that arrives before connecting resolves.
677666e to
8d04351
Compare
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
472a3ef8-40af-4b13-8658-d92c48994cb1
Files selected for processing: 8-
src/renderer/src/components/terminal-pane/layout-serialization.tssrc/renderer/src/components/terminal-pane/pty-connection-preconnect-input.test.tssrc/renderer/src/components/terminal-pane/pty-connection-remote-new-terminal-typeahead.test.tssrc/renderer/src/components/terminal-pane/pty-connection/pane-transport-options.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport-reattach-type-ahead.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/components/terminal-pane/replayed-history-terminals.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
4227c70 to
ddfeb81
Compare
… never an adopted or restored terminal
…check only what the create can't cause
…ew remote pane's typing
ddfeb81 to
b5a950f
Compare
ELI5
Keys you type into a brand-new terminal on a WSL host or paired server, before its shell exists yet, used to be thrown away. Now they're kept and sent to that new shell once it's created.
What Changed
Before: on a WSL host, opening a new terminal and typing right away lost those keys. That happened even when the terminal already had keyboard focus, because the host hadn't finished creating the shell.
After: a brand-new terminal pane delivers what you typed before and during its creation, in order, to the shell it creates.
When it decides:
Mechanism: paired-server panes, which include WSL hosts, hold typing in
remote-runtime-recovery-input-hold.tsuntil the pane binds a terminal. When a connect created a fresh terminal instead of restoring one,connectHoldingRestoredInputcalledexpect(null), which discards the held typing. That guard exists so keys typed on an old, restored screen never run in a replacement shell (#10065). But it also dropped a brand-new pane's keys, where there's no old screen at all.keepTypeAheadForNewTerminal.pane-transport-options.tssets it only for a pane with no startup work (the same check fix(terminal): keep keys typed before a pane's terminal exists #33281 uses) and no terminal bound to or restored for its leaf.expectNewTerminal(). The held typing is kept and, once the create binds, attached to the terminal it made, then released as usual.Held typing is delivered only when the first create is a genuine fresh create: the host's result has neither
isReattachnorcoldRestore. If the host adopts an existing terminal for that tab and leaf, or restores history into the new one, the typing is dropped as before. Otherwise text typed for a blank pane could run at a live REPL or agent prompt, or under restored history (#10065).Held typing is also dropped when:
restoreScrollbackBuffersflags the terminal, and the flag is checked at connect and again at bind;releasePreconnectInputrecheck from fix(terminal): keep keys typed before a pane's terminal exists #33281);Local, WSL-via-IPC and SSH panes don't use this transport and are unchanged.
Why
The guard is right for restored screens, so this keeps it and carves out only the case it was never meant for: a pane that never showed a terminal. Reusing the existing hold keeps ordering, limits and acknowledged writes the same as for reattach type-ahead.
Linked Issue
N/A (internal). Found on a Windows WSL host.
Visual Proof
N/A: nothing changes on screen except that typed keys arrive. The tests below cover it.
Testing
remote-runtime-pty-transport-reattach-type-ahead.test.ts, under "a brand-new pane":echo hi\ronce the terminal binds. This fails without the fix.New
pty-connection-remote-new-terminal-typeahead.test.tsrunsconnectPanePtywith the real options builder and the real remote transport, so the fresh create writes the leaf binding as in the app:echo hi\r, and the leaf ends up bound to the new terminal;restoreScrollbackBuffersbefore the bind drops the keys. This test fails without the replay mark;Also in the transport test file:
pty-connection-preconnect-input.test.ts:pnpm tcpasses. The fullpnpm lintand the terminal-pane suite run in CI. Locally, under very heavy machine load, the suite timed out in unrelated files.Not run against a real WSL host.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
ORCA_LAYOUT_OWNER_IS_MAIN,restoreScrollbackBuffersreceives no buffers, so nothing sets the replay mark. That's safe today, because there history arrives through a reattach with a session id, which never takes the new-terminal path. Revisit before phase F turns that flag on.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)