Repository navigation
iOS: stop the foreground reconnect storm (#10482) #10491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
austinywang
wants to merge
36
commits into
main
Choose a base branch
from
issue-10482-ios-foreground-reconnect-storm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 35 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
fd4a7e7
test(ios): reproduce the foreground reconnect storm (#10482)
austinywang 91c2a87
fix(ios): stop the foreground reconnect storm (#10482)
austinywang a202839
fix(ios): tie dead-stream backoff cancellation to the recovery owner …
austinywang f5a95dd
fix(ios): reset dead-stream backoff streak at session boundaries (#10…
austinywang 4d09f20
fix(ios): harden reconnect storm lifecycle state
austinywang 25b4063
fix(ios): order render-grid fixture arguments
austinywang c15c3b2
test(ios): make mirror remount coverage deterministic
austinywang 8da6f9b
refactor(ios): place mirror state in terminal kit
austinywang 077dcec
docs(ios): document reconnect lifecycle seams
austinywang e299c99
fix(ios): export mirror state core dependency
austinywang d735d90
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang 172d19e
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang 4cb18ee
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang f7bef0c
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang d07db53
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang cc5e458
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang 676160c
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang 3b9572f
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang 60450ef
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang eb6f82e
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang e8cfeb1
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang 58342f6
Merge branch 'main' into issue-10482-ios-foreground-reconnect-storm
austinywang 2414d12
test(ios): cover reconnect state invalidation
austinywang 4da5488
fix(ios): validate reconnect mirror freshness
austinywang 7957ec6
fix(ios): keep hydration replay authoritative
austinywang b1f94cc
Merge remote-tracking branch 'origin/main' into issue-10482-ios-foreg…
austinywang b932976
Merge remote-tracking branch 'origin/main' into issue-10482-ios-foreg…
austinywang e5f4da2
fix(ios): preserve reconnect hint and producer freshness
austinywang 1bc98f7
fix(ios): keep workspace hint stable across reconnects
austinywang 969130d
fix(ios): expose mirror retention state to shell
austinywang f4db660
test(ios): avoid mutating policy in assertion macros
austinywang 62c3fbe
fix(ios): accept same-producer history growth after replay
austinywang 6d7e54b
fix(ios): require primary scrollback for hydration
austinywang 593af47
test(ios): avoid unused tuple assertion warning
austinywang 6dae54a
Merge remote-tracking branch 'origin/main' into issue-10482-ios-foreg…
austinywang 2cecebc
fix(ios): preserve recovery wakeups across backgrounding
austinywang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
46 changes: 46 additions & 0 deletions
46
...muxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+TerminalMirrorLifecycle.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import CMUXMobileCore | ||
| internal import CmuxMobileTerminalKit | ||
|
|
||
| extension MobileShellComposite { | ||
| /// Marks every mounted terminal mirror as blank at an intentional teardown | ||
| /// boundary. Surface identifiers can be reused by another Mac or account, | ||
| /// so retaining the old producer metadata would risk skipping hydration. | ||
| func invalidateMountedTerminalMirrors() { | ||
| for surfaceID in terminalByteContinuationsBySurfaceID.keys { | ||
| var mirrorState = terminalMirrorStatesBySurfaceID[surfaceID] | ||
| ?? MobileTerminalMirrorState() | ||
| mirrorState.invalidate() | ||
| terminalMirrorStatesBySurfaceID[surfaceID] = mirrorState | ||
| } | ||
| } | ||
|
|
||
| /// Mark a mounted mirror blank so its next screen-anchored replay hydrates | ||
| /// the local scrollback from the current producer. | ||
| func markTerminalMirrorHydrationNeeded(surfaceID: String) { | ||
| var state = terminalMirrorStatesBySurfaceID[surfaceID] | ||
| ?? MobileTerminalMirrorState() | ||
| state.invalidate() | ||
| terminalMirrorStatesBySurfaceID[surfaceID] = state | ||
| } | ||
|
|
||
| /// Record the producer identity and history baseline of a delivered frame. | ||
| @discardableResult | ||
| func recordTerminalMirrorFrame(_ frame: MobileTerminalRenderGridFrame) -> Bool { | ||
| var state = terminalMirrorStatesBySurfaceID[frame.surfaceID] | ||
| ?? MobileTerminalMirrorState() | ||
| let retainedMirrorWasActive = state.retainedAcrossReconnect | ||
| state.record(frame) | ||
| terminalMirrorStatesBySurfaceID[frame.surfaceID] = state | ||
| return retainedMirrorWasActive && state.hydrationNeeded | ||
| } | ||
|
|
||
| /// Returns whether a retained mirror's provisional zero-row replay failed | ||
| /// its producer-identity and history-freshness checks. | ||
| func terminalMirrorRequiresHydration( | ||
| surfaceID: String, | ||
| frame: MobileTerminalRenderGridFrame | ||
| ) -> Bool { | ||
| terminalMirrorStatesBySurfaceID[surfaceID]?.requiresHydration(for: frame) | ||
| ?? true | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.