fix: stage browser-heavy session restore (#10786)
Merged
AU
2mo ago+930+930+012345678901234567890123456789-76-76-01234567890123456789
Summary
Stage browser-heavy session restoration so restored browser tabs remain lightweight until they are visible or explicitly focused. WebKit state, panel identity, tab metadata, mute state, and persisted navigation state are preserved.
Fixes #10786
Implementation
- Restore entry points propagate deferred-browser mode and coalesce restore-time focus/geometry callbacks.
- Workspace and DockSplitStore own the idempotent placeholder-to-BrowserPanel transition; no panel callback side channel or scheduler yield is used.
- CanvasPaneDescriptor carries panel object identity, so CanvasRootView remounts a same-ID pane when its placeholder is replaced while reusing unchanged mounts.
- Workspace.materializedPanel centralizes materialize-then-reresolve behavior for focusPanel, reconcileFocusState, and applyTabSelectionNow; the live BrowserPanel receives the normal focus/autofocus path.
- Restored windows temporarily disable automatic AppKit key-view traversal during topology assembly, then restore and recalculate it.
- Existing hidden-WebKit reclamation paths remain authoritative: BrowserHiddenWebViewDiscardManager, BrowserPanel close teardown, and the system memory-pressure responder. Repeated restore/close profiling remains follow-up work (#7596, #5731).
Validation
- Passed:
swift test --package-path Packages/macOS/CmuxCanvasUI(46 tests), includingdescriptorObjectReplacementRemountsSelectedContent. - Passed: Swift parser checks,
git diff --check,scripts/check-pbxproj.sh,scripts/lint-pbxproj-test-wiring.sh,scripts/check-package-resolved-policy.py,scripts/check-workspace-package-groups.py --check, andcmux-policy-check(no Aziz-derived findings). - A tagged Debug build passed at
6b1079b21fbefore subsequent main synchronization. - The final tagged cloud build attempt (
33168916502) reached CmuxGit compilation but failed on the unrelatedorigin/main#10326 compile break (GitMetadataService+ConfigWatchPaths.swift: staticjoinedPathand DispatchWorkItem/signature errors). Main later advanced to6dc9dea996, but #10326 remains present until the open upstream revert/repair lands; the PR itself changes no CmuxGit files. - The focused
cmux-unitBrowserPanelSessionRestoreTests build was blocked by the same independent CmuxGit errors; no failure from this PR's tests was observed. - No app launch/reproduction was performed, per request.
Review status
- All 8 inline review threads are resolved, with replies documenting each fix and the focused test evidence.
- GitHub checks for HEAD
bd52f76eae84dd459ef377a3dcdf0db8a6946fd8are passing or skipped: Testbox broker, Socket security, Vercel previews/comments, Cubic, and CodeRabbit. - Canonical autoreview was retried twice; both attempts were blocked by the Codex workspace credit limit (
Your workspace is out of credits). Retry command:/Users/austinwang/manaflow/cmuxterm-hq/skills/autoreview/scripts/autoreview --mode branch --base origin/main.
Commits
09cf5a0634/6489cf1ce1: original failing regression test and implementation.6ac399780c,16e1bf80c2,bd52f76eae: synchronized successiveorigin/mainupdates with clean merges.5c3da030a9: canvas replacement and live-focus regression tests.dc5dd55e6d: canvas remounting and focus re-resolution fix.813d03a2d4: isolated deferred browser panel types and wired them into the Xcode target.5a7f77cb1d: centralized deferred-browser materialization and re-resolution.