Repository navigation
fix(terminal): scope server-pane wakes to the sleep and attempt they belong to - #52531
Merged
Merged
Conversation
…belong to A terminal the host serves live again is no longer remembered as slept, so a later restart by another client drops keys typed at the old screen (#10065). A wake asked by a key or reveal now ends with the reconnect attempt it started, so a failed attempt cannot wake a workspace slept in the meantime.
[Medium impact] The PR appears safe to merge; no actionable defects were found. SummaryThe PR limits remembered sleep state and user wake requests to their intended lifetime.
No actionable issues found. Tests were inspected but not run during this review.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
A server pane can wake a slept terminal when you show it or type into it. Two pieces of that wake logic remembered too much:
Both now forget at the right moment.
Before / after
Mechanism
host-slept-terminals.ts: newforgetHostSleptTerminal. The transport calls it when a subscription to that terminal attaches, which is the host serving it live. Held keys now follow only a sleep that is still in progress.remote-runtime-pty-transport.ts: the user wake is cleared on every recovery change that is not an attempt in flight (backoff, latched disconnected, parked for an external trigger, idle, disposed).requestUserWakealso drops the wake at once when there is no attempt to carry it.Kept from #52260: wake on show or type, keys typed during a real wake reach the woken terminal once and in order, a restart by another client drops them, one retry per wake gesture.
Tests
remote-runtime-pty-transport-wake-input.test.ts; each fails with its fix reverted (checked).remote-runtime-pty-transport-*unit tests: pass with the switch on and off.local-slept-terminal-wake-keys: pass, switch on and off.paired-desktop-server-slept-pane-status: 5 passed switch on; 4 passed, 1 skipped (switch-on only) switch off.pnpm run typecheck:cipasses.Switch-off changes
Both fixes run with the switch off; this code from #52260 is not gated. With the switch off, the only differences are the two rows in the table above.
Visible changes
None beyond the two bug fixes above.
Performance
None, because the changes are one set delete when a terminal subscription attaches and one flag clear on recovery phase changes.
Risk
Level: Low. The riskiest part is the wake flag clearing too early, which would make a reconnect ask as automatic and leave a slept pane slept until shown or typed into again. A plain revert backs it out.