Repository navigation
perf(window): release closed connection windows and keep startup work off the main thread - #4431
Merged
Merged
Conversation
…f the main thread
…ssion's transcript deleted
datlechin
marked this pull request as ready for review
November 23, 2026 07:32
datlechin
enabled auto-merge (squash)
November 23, 2026 07:32
This was referenced Nov 23, 2026
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
MainContentView, whose@Stateheld those actions and the window. It now binds toWindowSidebarState.@State viewWindowis gone; readers usecoordinator.contentWindow.ConnectionWorkspacestrongly.TabWindowController.windowWillClosetears each hosted workspace down one turn later, once the window is off screen. A workspace another window hosts by then is skipped.MainContentCoordinator.teardown()runs once, so the schema provider hold is released once.windowShouldClose(D2). The button sends its own action, notperformClose:, soEditorWindow.performClosenever saw it. A second click while the question is up asks nothing more.DeferredSecretRead, finding 21a). Same reads, same answers, same log lines. Local only still reads this Mac's item first.LegacyLicenseStorereads the set-aside digest and the payload from defaults before it touches the Keychain.9d0d481cf1)memory --only windowcycles, 20 open + close cyclesmemory --only closecheck, coordinators after one closelaunch --only keychain,kc-connectKeychain calls on main (relaunch / first launch)kc-welcomestore reads, license readslaunch --only bbl, 500 stored sessions minus 6 connections: footprintui-responsiveness --scenarios selection, edit stateconfigurehits per Cmd-A, inspector hiddenTests changed on purpose
New tests
ConnectionWindowReleaseTests: a closed window lets go of its coordinator and actions and empties its panes (fails on main), two connections, teardown only after the window is ordered out, a workspace hosted elsewhere is kept, a removed workspace and an ended session release their coordinator, the schema provider hold is released once, the last window stops its agent sessions.ConnectionWindowCloseQuestionTests: no work closes, staged work asks and Cancel keeps the window, an open cell edit lands first, a second click asks nothing, a window with no browse content asks about an agent reply, Option-click detection, one Review Changes alert per event, Discard closes all, Review stops at the first Cancel, a window closed meanwhile is skipped, one window gets its own question.WindowCloseButtonUITests: a real click on the close button asks, Cancel keeps the edit, Don't Save closes.HiddenInspectorEditStateTests,DriverOpenSecretReadTests,LegacyLicenseStoreTests, and new cases inAgentSessionRegistryTestsandConnectionLocalStatePurgeTests.Deliberately not fixed here
$TMPDIRthat the one-time sweep never lists again. Main keeps listing$TMPDIRat every launch (in the background; 72 to 75 ms CPU at 24,983 entries on the audit Mac, 4,578 entries here) and at quit on the main thread.NSWindow: the unit test host keeps closed windows in an autorelease pool it never drains. The memory bench above counts the window's split view and workspace in the real app.ptr_refscheck before the build was skipped: the bench counts settle the cause.Docs: TableProApp/docs#272