Fix project context eviction during in-flight project open#454
Draft
cursor[bot] wants to merge 1 commit into
Draft
Fix project context eviction during in-flight project open#454cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
rootsBoundToWindows() only counted bound window/tab roots. During a slow project open (init finished but window not yet rebound), background rebalance could treat the new context as idle and close it — breaking the open flow. Include pending window roots (from #453) and in-flight init promise keys in the active-root set used for rebalance retention. Co-authored-by: Arul Sharma <arul28@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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.
Bug and impact
During a slow project open (new window with
projectRoot, or switching repos), the desktop could tear down the freshly initialized project context before the window was rebound. The user would see a failed or empty project open, broken IPC, or subtle state corruption after what looked like a successful init.Trigger: Open a large project in a new window (or switch projects) while another window action schedules context rebalance — e.g. closing a tab, mobile sync handoff, or focus change. If init completes but
bindWindowToProjecthas not run yet, rebalance treated the new root as idle.Root cause
PR #453 added
pendingLocalProjectRootsfor runtime IPC authorization during open, butrootsBoundToWindows()— used byrebalanceProjectContexts()— still only counted boundwindowProjectRoots/ tab roots. In-flight opens and mobile-sync context warmups (projectInitPromises) were invisible to rebalance.Fix
projectInitPromises.collectRootsBoundToWindows()with unit tests.Validation
npx vitest run src/main/services/projects/projectContextRoots.test.ts(2 tests passed)Complements #453; distinct from open automation PRs on Files v2 / runtime IPC null guards.