perf(workstation): release idle content hosts when the tab pool empties - #848
Open
Harry19081 wants to merge 1 commit into
Open
perf(workstation): release idle content hosts when the tab pool empties#848Harry19081 wants to merge 1 commit into
Harry19081 wants to merge 1 commit into
Conversation
Bound the AppShell keep-alive instead of keeping every visited host mounted forever: with no real tabs (Launchpad only) the code, browser, and project hosts all unmount, the hidden Launchpad unmounts behind real tabs, and the Agent Station simulator is kept warm while hidden only as long as a session is attached. The Browser host's unconditional deferred pre-mount is replaced by explicit mount triggers (pending new-session request via the remount-safe consumed-tick atom, live engine sessions, background browser-session tabs), so the Launchpad "New Browser" flow and restored sessions keep working without a permanently mounted host. Pre-commit hook ran. Total eslint: 5, total circular: 0
Member
Author
|
orgii://cloud/session/ref?v=1&org=bfa7b134-2486-45fa-81ad-a369441fafb4&owner=e17cf230-b78f-4b1b-8480-6005832983b7&session=claudecodeapp-fc51ef5d-d978-4309-88ae-f69b15f534b4 |
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.
Summary
Bounds the AppShell's host keep-alive so an idle WorkStation stops holding every previously-visited surface in memory. With no real tabs (Launchpad only), the code / browser / project hosts and the hidden Agent Station simulator all unmount; while real tabs exist, visited hosts stay mounted-but-hidden exactly as before so tab switches remain instant.
Problem
The keep-alive in
AppShellContentwas monotonic: once a host mounted it never unmounted (visitedModesonly ever grew), the code host was mounted from launch even on the empty Launchpad (file-tree autoload, git/diff/diagnostics/output hooks all live), the Browser host was unconditionally pre-mounted one frame after startup, and the Agent Station simulator stayed mounted forever after one visit — even back in My Station with no session. An idle window paid RAM and background-work costs for surfaces showing nothing.Solution
AppShell/hostMountPolicy.ts+ unit tests covering the mount matrix.mainPaneHasRealTabsAtom/mainPaneHasBrowserHostTabsAtominstore/workstation/tabHost.ts(Launchpadstarttabs never count as real work; subscribers only re-render when the boolean flips).useAppShellDockclears the visited set when the pool empties and drops the deferred Browser pre-mount; the active host still mounts synchronously via theis*Modebranch, so first-tab-open latency is unchanged.browser-sessiontabs, live engine sessions, or a pending New-Browser request — the request consumer inBrowserLayoutwas already remount-safe via the module-scoped consumed-tick atom, and the engine-sessions trigger bridges the gap between request consumption and the sessions ↔ tab-strip sync creating the tab.workstationActiveSessionIdAtom), so mid-session My Station ↔ Agent Station toggles stay instant but an idle simulator releases its subtree.Potential risks
Validation / Test plan
tsc --noEmitclean; eslint clean on touched files.vitest run src/modules/WorkStation/AppShell/ src/store/workstation/— 23 files, 228 tests passed, including the newhostMountPolicy.test.tsmatrix (empty-pool release, pending-request mount, session-bridge gap, agent-station session gating).